Commit 07c210c
feat(v1.100 PR-P2-5): auto-elevate shim removal gate (G3-UN-SHIM-LOCK)
Pre-PR-23 assurance blocker #5 of 2 remaining. Adds a CI gate that
fails when the uninstall auto-elevate shim and uninstall mutation
code coexist. This enforces that when PR-23 lands, the shim is
removed in the SAME PR — preventing the scaffold-era "safe by default"
UX from silently flipping meaning the moment real mutation lands.
## Rule
| shim_present | mutation_present | Result |
|:-:|:-:|---|
| 1 | 1 | **FAIL** — shim + mutation cannot coexist |
| 1 | 0 | PASS — PR-22/P2-x scaffold state |
| 0 | 1 | PASS — post-PR-23, shim correctly removed |
| 0 | 0 | PASS — trivially clean |
## Detection
**Shim detection** (`cmd/nftban-installer/flags.go`, grep for either):
- "auto-elevated to --dry-run"
- "NO MUTATION WILL OCCUR (v1.100 PR-22 scope)"
Two independent markers — if one is removed by refactor, the other
still fires. Ensures the gate doesn't silently stop working.
**Mutation detection** (`internal/installer/uninstall/*.go` +
`cmd/nftban-installer/uninstall_dryrun.go`, Go only, excluding tests):
- nft mutation verbs (add/create/delete/flush)
- systemctl lifecycle verbs (start/stop/restart/reload/enable/
disable/mask/unmask) via exec.Run or Service* methods
- External firewall binaries (ufw, firewall-cmd, iptables-restore)
- Filesystem writers (WriteFileAtomic, os.WriteFile, Create,
Remove, RemoveAll, MkdirAll, Rename)
- State persistence (sf.Transition)
## Scope lock
- NO code changes (no shim removal, no mutation added)
- NO CLI redesign
- Pure detection gate — fires if the coupling appears, silent otherwise
## Two acceptable shim remediations at PR-23 time
1. **Delete** the auto-elevate block entirely (`--mode=uninstall`
mutates unless `--dry-run` is explicit)
2. **Convert** to explicit refusal requiring `--dry-run` or
`--confirm-mutation` (no silent default either way)
## Also: tracking update
Marks blocker #4 (exec-trace CI gate, PR #488) as LANDED. Remaining
pre-PR-23 blockers: 2 (this PR = P2-5, plus P2-6 payload integrity).
Contract doc updated with the full decision table + detection logic
in internal/installer/uninstall/contract.md.
Refs: internal/installer/uninstall/contract.md §"Pre-PR-23 blockers"
+ §"G3-UN-SHIM-LOCK (PR-P2-5) — how the gate decides"
+ §"Audit C regression note" (where the two remediations were
originally committed to)
Authorization: locked Phase 2 sequencing (2026-04-20)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 4749fe1 commit 07c210c
2 files changed
Lines changed: 155 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
85 | 197 | | |
86 | 198 | | |
87 | 199 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
| 286 | + | |
286 | 287 | | |
287 | 288 | | |
288 | 289 | | |
| |||
294 | 295 | | |
295 | 296 | | |
296 | 297 | | |
297 | | - | |
298 | | - | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
299 | 340 | | |
300 | 341 | | |
301 | 342 | | |
| |||
0 commit comments