Commit 57c50ac
fix(elevation): ACL principal alias + scheduledTask probe full path (#18)
Two digest-comparison bugs surfaced by L3 production-profile
validation after PR #17 unblocked the apply side. Both manifest as
``post-apply observation disagrees with desired`` failures even
when the underlying icacls / scheduledTask calls succeeded — the
DACL and the task ARE the operator-declared shape on disk; the
canonical-state string the digest is taken over diverges only
because of alias / path-projection mismatches.
1. ACL: icacls accepts well-known short names (``SYSTEM``,
``NetworkService``, ``Administrators``) as INPUT but emits the
domain-qualified form (``NT AUTHORITY\SYSTEM``,
``NT AUTHORITY\NETWORK SERVICE``, ``BUILTIN\Administrators``)
on OUTPUT. ``normalizeDirAclEntry`` only collapsed whitespace,
so a recipe declaring ``aclEntry(principal = "SYSTEM", ...)``
produced a digest with ``SYSTEM:(F)`` while the observed digest
had ``NT AUTHORITY\SYSTEM:(F)`` — they never converged.
Add ``canonicalizeAclPrincipal`` (case-insensitive collapse of
the seven well-known aliases to their icacls-emitted form) and
thread it through ``normalizeDirAclEntry`` (split the entry at
the first ``:`` outside any ``(...)``; rewrite the principal
prefix; preserve the rest verbatim).
2. scheduledTask: the probe's ``'TaskName=' + $t.TaskName`` line
returned the LEAF name only (``WindowsRunner-EnvBootstrap``)
while ``canonicalScheduledTaskDesired`` carried the full path
(``\Reprobuild\WindowsRunner-EnvBootstrap``). The post-apply
re-probe digests disagreed even when the task WAS registered
in the operator-declared folder.
Emit ``$t.TaskPath + $t.TaskName`` (``$t.TaskPath`` already ends
in ``\``) so the observed canonical string carries the same
shape as the desired one.
Update the ``normalizeDirAclEntry`` smoke test to cover the new
canonicalization branches (the previous test assumed the no-op
SYSTEM:(F) shape).
--no-verify: pre-existing prek migration-mode failure
(no .pre-commit-config.yaml in repo).
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 9b115ba commit 57c50ac
3 files changed
Lines changed: 81 additions & 14 deletions
File tree
- libs/repro_elevation
- src/repro_elevation
- tests
Lines changed: 55 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1204 | 1204 | | |
1205 | 1205 | | |
1206 | 1206 | | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
1207 | 1233 | | |
1208 | | - | |
1209 | | - | |
1210 | | - | |
1211 | | - | |
1212 | | - | |
1213 | | - | |
1214 | | - | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
1215 | 1244 | | |
1216 | 1245 | | |
1217 | 1246 | | |
| |||
1222 | 1251 | | |
1223 | 1252 | | |
1224 | 1253 | | |
1225 | | - | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
1226 | 1273 | | |
1227 | 1274 | | |
1228 | 1275 | | |
| |||
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1473 | 1473 | | |
1474 | 1474 | | |
1475 | 1475 | | |
1476 | | - | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
1477 | 1482 | | |
1478 | 1483 | | |
1479 | 1484 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1175 | 1175 | | |
1176 | 1176 | | |
1177 | 1177 | | |
1178 | | - | |
1179 | | - | |
1180 | | - | |
1181 | | - | |
1182 | | - | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
1183 | 1198 | | |
1184 | 1199 | | |
1185 | 1200 | | |
| |||
0 commit comments