fix(security): audit remediation across builder, extraction, CI, and release verification#46
Merged
Conversation
…release verification - CI workflows (go-release.yml, ffmpeg-release.yml, ffmpeg-test.yml): prevent GitHub Actions script injection via env: expansions; reduce GITHUB_TOKEN scope - internal/pathsafe, internal/archiveextract: enforce extraction resource caps (entry count, aggregate bytes) to prevent unbounded allocation (CWE-770) - internal/builder/digests.go: add SHA-256 manifest for ~20 build dependencies; verification on both cache hit and fresh download (CWE-494); add --update-digests bootstrap mode - lib/fetch.go: remove FFMPEG_STATIGO_ALLOW_UNVERIFIED bypass; enforce verification unconditionally (CWE-345) - parseutils.go: NULL-terminate tag table in AVCodecGetTag2 (CWE-665) - go.mod: bump golang.org/x/sys to v0.45.0 and go directive to 1.26.3 (CWE-1395, CWE-770) - AGENTS.md, docs/DEVELOPMENT.md, README.md: document security considerations and bootstrap workflows - Test coverage added for all hardened paths Addresses CWE-94, CWE-78 (CI injection), CWE-345, CWE-494, CWE-665, CWE-770, CWE-1395. Signed-off-by: Martin Wimpress <code@wimpress.io>
Contributor
There was a problem hiding this comment.
1 issue found across 20 files
Confidence score: 3/5
- There is a concrete regression risk in
internal/builder/main.go:updateDigestsModeacceptsctx context.Contextbut discards it, so cancellation/interrupt signals are not honored during--update-digests. - Because this is severity 6/10 with high confidence (9/10) and affects runtime behavior (Ctrl+C/SIGTERM handling), the PR carries some user-facing operational risk rather than being purely cosmetic.
- Pay close attention to
internal/builder/main.go- restore context propagation so long-running digest updates can be interrupted cleanly.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="internal/builder/main.go">
<violation number="1" location="internal/builder/main.go:201">
P2: updateDigestsMode accepts `ctx context.Context` but immediately discards it (`_ = ctx`), breaking the interrupt/cancellation contract. Ctrl+C or SIGTERM during `--update-digests` will be silently ignored — downloads continue and the process cannot be interrupted. The remaining builder paths respect cancellation via this same `ctx`; this mode should too.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| // trust-on-first-use bootstrap; run it once in a trusted environment, verify the | ||
| // printed digests against upstream-published checksums, then paste the entries | ||
| // into internal/builder/digests.go and commit. | ||
| func updateDigestsMode(ctx context.Context, buildRoot string, libs []*Library) error { |
Contributor
There was a problem hiding this comment.
P2: updateDigestsMode accepts ctx context.Context but immediately discards it (_ = ctx), breaking the interrupt/cancellation contract. Ctrl+C or SIGTERM during --update-digests will be silently ignored — downloads continue and the process cannot be interrupted. The remaining builder paths respect cancellation via this same ctx; this mode should too.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At internal/builder/main.go, line 201:
<comment>updateDigestsMode accepts `ctx context.Context` but immediately discards it (`_ = ctx`), breaking the interrupt/cancellation contract. Ctrl+C or SIGTERM during `--update-digests` will be silently ignored — downloads continue and the process cannot be interrupted. The remaining builder paths respect cancellation via this same `ctx`; this mode should too.</comment>
<file context>
@@ -178,6 +193,52 @@ func run() error {
+// trust-on-first-use bootstrap; run it once in a trusted environment, verify the
+// printed digests against upstream-published checksums, then paste the entries
+// into internal/builder/digests.go and commit.
+func updateDigestsMode(ctx context.Context, buildRoot string, libs []*Library) error {
+ _ = ctx // grab download is not yet context-aware; retained for signature parity
+
</file context>
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.
Addresses CWE-94, CWE-78 (CI injection), CWE-345, CWE-494, CWE-665, CWE-770, CWE-1395.