Skip to content

fix: enforce Network and SMB1 Restore contracts - #63

Merged
man612 merged 8 commits into
mainfrom
fix/enforce-network-smb1-restore-contracts
Sep 19, 2026
Merged

man612 merged 8 commits into
mainfrom
fix/enforce-network-smb1-restore-contracts

Conversation

@man612

@man612 man612 commented Sep 19, 2026

Copy link
Copy Markdown
Owner

Summary

Tighten selected-network and SMB1 legacy snapshot/Restore contracts so only baselines the tool can legitimately create and exactly restore are accepted.

Gaps reproduced before this fix

Restore validation accepted tampered snapshots with:

  • selected-network baseline Private
  • selected-network baseline DomainAuthenticated
  • SMB1 baseline Unknown
  • SMB1 baseline Enabled

The Windows SMB feature state enum on the live Windows 11 audit host also includes DisablePending, Superseded, PartiallyInstalled, and DisabledWithPayloadRemoved. The current Restore logic cannot guarantee exact rollback for those states.

Fix

  • selected-network snapshot creation requires a Public baseline
  • selected-network Restore validation requires a Public baseline
  • SMB1 legacy snapshot creation requires an exactly Disabled baseline
  • SMB1 Restore validation accepts only exact Disabled for the legacy enable action
  • SMB1 Enabled / EnablePending remain no-op states that preserve Restore history
  • SMB1 Unknown, DisablePending, Superseded, PartiallyInstalled, and DisabledWithPayloadRemoved abort before snapshot/mutation because exact rollback is not guaranteed

Regression coverage

Adds tests/NetworkSmbRestoreContractSmoke.ps1 covering:

  • valid Public network baseline creation + validation
  • transactional rejection of Private/DomainAuthenticated network baselines
  • rejection of tampered Private/DomainAuthenticated snapshots
  • valid exact Disabled SMB1 baseline creation + validation
  • snapshot-maker rejection for every observed unsupported SMB1 state
  • validator rejection for every unsupported SMB1 state
  • legacy execution preflight preventing snapshot/mutation for unsupported SMB1 states

Local Windows PowerShell 5.1 verification

  • PSScriptAnalyzer 1.25.0: 0 actionable diagnostics
  • PerformanceSmoke: pass
  • FirewallRestoreContractSmoke: pass
  • NetworkSmbRestoreContractSmoke: pass
  • CombinedSafeRepairScopeSmoke: pass
  • SafeRepairNoOpSmoke: pass
  • LegacyNoOpSmoke: pass
  • PointAndPrintSafetySmoke: pass
  • RepairOutcomeSmoke: pass
  • RepairPostconditionSmoke: pass
  • RestoreOutcomeSmoke: pass
  • RestoreActionContractSmoke: pass
  • ServiceRestoreScopeSmoke: pass
  • SnapshotScopeSmoke: pass
  • RestoreSafetySmoke: pass
  • Validate.ps1: pass

Normal Safe Repair behavior is unchanged; invalid or non-restorable baselines are rejected more strictly.

@man612
man612 merged commit 5ddd186 into main Sep 19, 2026
1 check passed
@man612
man612 deleted the fix/enforce-network-smb1-restore-contracts branch September 19, 2026 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant