fix(scan): close two fail-open paths in trustabl-scan.sh (#9) - #55
Open
Paramjeet-singh-neu wants to merge 1 commit into
Open
fix(scan): close two fail-open paths in trustabl-scan.sh (#9)#55Paramjeet-singh-neu wants to merge 1 commit into
Paramjeet-singh-neu wants to merge 1 commit into
Conversation
Closes trustabl#9. Two spots in scan/trustabl-scan.sh failed open — a broken run could be reported as a clean repo: 1. A missing/malformed overall_score scored 100. `jq -r '.overall_score // 1'` supplies the MAXIMUM value when the field is absent, so a truncated or schema-drifted JSON report read as readiness 100 / risk 0. Now treated as a scanner error (exit 2), matching the exit-code contract in docs/EVALUATION.md. Also catches empty/invalid JSON. 2. Checksum verification degraded to a warning and proceeded. An unfetchable checksums.txt, or an asset not listed in it, silently ran an unauthenticated binary. Now fails closed (exit 1) unless the operator explicitly opts out with ALLOW_UNVERIFIED_DOWNLOAD=true. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
4 tasks
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.
Closes #9.
Both spots in
scan/trustabl-scan.shfail open, so a broken run can be reported as a clean repo. @fxmedus flagged these and asked for a direction decision rather than a surprise PR — so this implements the fail-closed direction they leaned toward, and I've laid out the alternative for each below in case you prefer it.1. Missing
overall_scoreno longer scores 100jq -r '.overall_score // 1'supplies the maximum value when the field is absent, so a truncated / malformed / schema-drifted report read as readiness 100, risk 0.This PR: treat a missing,
null, empty, or unparseable score as a scanner error andexit 2— matching the exit-code contract indocs/EVALUATION.md(2 = scan did not complete, output not trustworthy).Alternative (smaller blast radius): change
// 1to// 0— a missing score becomes readiness 0 / risk 100. Fails closed but red-lights via the normal gate instead of exit 2. Happy to switch to this if you prefer.2. Checksum verification no longer degrades to a warning
An unfetchable
checksums.txt, or an asset not listed in it, previously printedWARNING … skipping verificationand ran the unauthenticated binary anyway.This PR: fail closed (
exit 1) unless the operator explicitly opts out withALLOW_UNVERIFIED_DOWNLOAD=true(for a release that genuinely ships no checksums). A real checksum mismatch already exited 1 and is unchanged.Alternative: always hard-fail with no escape hatch. I added the opt-out to avoid breaking a release that legitimately has no
checksums.txt, but I can drop it if you'd rather it be unconditional.Testing
bash -n scan/trustabl-scan.shpasses.If the new
ALLOW_UNVERIFIED_DOWNLOADinput lands, I'll follow up with a one-line addition to the README inputs table.🤖 Generated with Claude Code