Part of #634.
htpasswd.entry's apply ends with:
mv -f "$staged" "$path"
# A credentials file readable by anyone is the credential leaked.
chmod 600 "$path"
Its observe returns a single field — whether the stored hash verifies against the password.
A file with the right hash at mode 644 is therefore reported already, and the chmod
never runs. The def's own comment says what that costs.
sudo.write and sshd.config, the two defs built like it, each observe a secured field
beside their content field. This one does not.
Build
Add the mode to the observe, as its neighbours do — state(valid: …, secured: …). Their
spelling is [ "$(stat -c '%a' "$f")" = "600" ]; file.mode uses an awk numeric compare
for a reason worth reading before copying either (#543).
Validation
- An adverse case: a correct file chmod'd 644 on purpose, then the def, then assert the
mode on the machine. Verified red before the fix.
- The existing
adverse-htpasswd.entry.shellf and adverse-htpasswd.regex-login.shellf
stay green — neither asserts the mode today, which is how this survived.
Part of #634.
htpasswd.entry's apply ends with:Its observe returns a single field — whether the stored hash verifies against the password.
A file with the right hash at mode 644 is therefore reported
already, and thechmodnever runs. The def's own comment says what that costs.
sudo.writeandsshd.config, the two defs built like it, each observe asecuredfieldbeside their content field. This one does not.
Build
Add the mode to the observe, as its neighbours do —
state(valid: …, secured: …). Theirspelling is
[ "$(stat -c '%a' "$f")" = "600" ];file.modeuses an awk numeric comparefor a reason worth reading before copying either (#543).
Validation
mode on the machine. Verified red before the fix.
adverse-htpasswd.entry.shellfandadverse-htpasswd.regex-login.shellfstay green — neither asserts the mode today, which is how this survived.