Two more defs report already over a machine their own apply would have changed. Same
mistake as #594, in defs that epic did not look at.
Found by an external review; each verified in the files.
| def |
apply guarantees |
observe asks |
htpasswd.entry |
the user's line and the file at 0600 |
does the stored hash verify |
system.timezone |
/etc/localtime and /etc/timezone |
what does the link point at |
htpasswd.entry is the sharper one: the file it leaves at 644 holds credentials, and the
def's own apply carries the comment "A credentials file readable by anyone is the
credential leaked." Its observe never checks that the chmod happened.
sudo.write and sshd.config — the two defs shaped like it — both observe a secured
field beside their content field. htpasswd.entry observes one field.
Why this is an epic and not two bugs
Because it is the third time. #486 and #480 were the first, #594 the second with four
defs, and here are two more the sweep missed. The fixes are small; the question worth
answering at the end is not.
test/e2e/adverse-cases.md names the category ("right-shaped but wrong") and holds five
worked examples. What it does not have is a way to find the next one without a human
reading every def. Candidates, to weigh rather than assume:
- a check that every field an
apply writes has a matching field in the observe — not
decidable in general, but a def whose apply runs chmod and whose observe never reads a
mode is a shape a linter can see;
- a sweep asserting, per def, that each of its adverse cases fails when the observe is
weakened — expensive, and closer to mutation testing than to a gate;
- or accepting that this is a review discipline and writing it as one, which at least stops
it being rediscovered by an outside reader every few weeks.
Sub-issues
Locked decisions
- Each fix arrives with an adverse case verified red first — a weak observe passes its
unit test by construction, so only a machine in the wrong state proves anything.
- The observe changes, never the apply. Both applies are correct.
Two more defs report
alreadyover a machine their ownapplywould have changed. Samemistake as #594, in defs that epic did not look at.
Found by an external review; each verified in the files.
htpasswd.entrysystem.timezone/etc/localtimeand/etc/timezonehtpasswd.entryis the sharper one: the file it leaves at 644 holds credentials, and thedef's own apply carries the comment "A credentials file readable by anyone is the
credential leaked." Its observe never checks that the chmod happened.
sudo.writeandsshd.config— the two defs shaped like it — both observe asecuredfield beside their content field.
htpasswd.entryobserves one field.Why this is an epic and not two bugs
Because it is the third time. #486 and #480 were the first, #594 the second with four
defs, and here are two more the sweep missed. The fixes are small; the question worth
answering at the end is not.
test/e2e/adverse-cases.mdnames the category ("right-shaped but wrong") and holds fiveworked examples. What it does not have is a way to find the next one without a human
reading every def. Candidates, to weigh rather than assume:
applywrites has a matching field in theobserve— notdecidable in general, but a def whose apply runs
chmodand whose observe never reads amode is a shape a linter can see;
weakened — expensive, and closer to mutation testing than to a gate;
it being rediscovered by an outside reader every few weeks.
Sub-issues
htpasswd.entrydoes not observe the mode its apply setssystem.timezonedoes not observe/etc/timezoneLocked decisions
unit test by construction, so only a machine in the wrong state proves anything.