Repository navigation
Conversation
Owner
Author
|
Written-by: Fledge Platform Dev-3 Tip
Red first on the same commit: |
Owner
Author
|
Security: PASS at e6b205a
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Written-by: HugoXK
Author: Fledge Platform Dev-3
Commit identity:
commit.authorandcommit.committerare bothFledge Platform Dev-3 <dev3@fledge.invalid>, read back fromGET /repos/HugoXK/fledge/commits/e6b205ad500ee8fdf2fa2c9becc2ceae6559bceeafter the push.Fixes #1192
Current vs expected
Current. A restore-for-real run that the drill refuses leaves
/var/tmp/fledge-restore/column.keyon disk: the block's onlyrm -fsits afterfi, andexit 1in theelsebranch returns before it. The block then tells the operator tosudo rm -rfthe directory only "after/healthzanswers and one page loads", which a refused restore never reaches.Expected. The key file is gone on every exit of the block, and a refused drill still stops the block before anything is copied in.
What changed
docs/deploy.md: theelsebranch now runssudo rm -f /var/tmp/fledge-restore/column.keybeforeexit 1.exit 1stays in the same shell as theif, so the block still stops; the success path keeps its own removal and its comment.test/columnCheck.test.ts: the guard reads each documented key fence for structure instead of accepting arm -fanywhere in it. A block passes when the removal sits inside theelsebranch that stops it, or when a trap removes the file and the block propagates the subshell status before it copies anything in. A subshell trap whoseexit 1ends only the subshell is rejected with that reason.changelog.d/1192.security.md: one fragment.Shape chosen, and the shape rejected
The card allows two shapes. I took the first — remove the key before
exit 1, keepingexit 1in the block's own shell — and the ratchet still accepts the second (trap plus an explicit$? -ne 0stop) so a later rewrite can use it. The rejections are the point:( trap … EXIT; … )with the drill inside and no status check is rejected: the trap removes the key, butexit 1inside the subshell no longer stops the block, sosudo cp … restored.db "$DB_PATH"runs after a refusal — a key leak turned into copying an unverified database over the live one.rm -fonly on the success path is rejected, which is the defect itself.Red first
At the base
044c7515with the committed test file copied in (test/columnCheck.test.tssha25695ababcd780c289f25f3d9e8d056013b681d6d553bd71739e0fd6effae291ce4),npx tsx --test test/columnCheck.test.tsgives 13 tests, 12 pass, 1 fail:The same file at this tip is 13/13.
The ratchet is a text check over the two documented fences, not shell static analysis, as the card asks. It also pins the pre-fix fence (
REFUSAL_LEAK_BLOCK) and asserts that text fails, so a later rewrite cannot quietly restore the success-path-only shape; and it asserts the rejected trap shape fails while the accepted trap-plus-status shape passes.Uncertainty and residual risk
SIGKILL, a closed terminal) still skips both removals: this fence has notrap. This slice fixes the refusal path the card names; trap-based cleanup needs the propagated-status shape to stay safe and is a different change.elseandfias whole lines. A one-lineif …; then …; else …; fifence would be reported as a failure rather than silently accepted, so the failure mode is a false alarm, not a false green.0700directory. The refusal path still leaves the drill's scratch files there by design — they are the evidence of the refusal — and the block already tells the operator to remove the directory after a successful restore.#1187's drill block, the/admindrill row, the status file, andsrc/jobs/service.ts:3807(the card's recorded residual,src/jobs/**, a different slice).Ran:
npx tsx --test test/columnCheck.test.tsat the base044c7515with the committed test file copied in — 13 tests, 12 pass, 1 fail (the refusal-path guard).npx tsx --test test/columnCheck.test.tsat this tip — 13/13.npm run checkat this tip — exit 0: lint11 warning(s) in 8 entries match the baseline,tsc --noEmitclean, 3294 tests / 3294 pass / 0 fail / 0 skipped, build clean.node scripts/changelog.mjs check—changelog: 4 fragment(s) ok;node scripts/version.mjs check—version: 0.4.5 ok.node scripts/risk-gate.mjs --base 044c7515a6111560bf96cdd20e8c724535cefc0aat this tip — output below.Not run:
exit 1behaviour is argued from the block's own text rather than from running it.Risk
risk-tier: T1is computed from the paths the gate reads (docs/**T0,test/**T1), which is also how the card describes this slice; nosrc/**ordeploy/**file changes. The gate decides the requirement, not this paragraph — I am asking for a PASS at the tip anyway, and the Lead routes the Gate Security read.Docs and changelog
The runbook is the code here, so
docs/deploy.mdchanges in the same commit as the guard that reads it. Changelog:changelog.d/1192.security.md.