Skip to content

Pin poutine Docker image to the digest-pinned constant - #50279

Merged
pelikhan merged 2 commits into
mainfrom
copilot/sighthound-fix-security-findings
Aug 4, 2026
Merged

Pin poutine Docker image to the digest-pinned constant#50279
pelikhan merged 2 commits into
mainfrom
copilot/sighthound-fix-security-findings

Conversation

Copilot AI commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Sighthound flagged five exec.Command sites in pkg/cli as command injection. All five pass argument slices (no shell) and four already validate their dynamic arguments. Auditing them surfaced one genuine issue: poutine.go invoked Docker with a mutable :latest tag rather than the digest-pinned constant used by every other scanner.

Change

  • pkg/cli/poutine.go — replace the hardcoded ghcr.io/boostsecurityio/poutine:latest literal with the PoutineImage constant in both scan paths (directory and single-file) and their verbose echo strings.
 cmd := exec.Command(
     dockerPath, "run", "--rm",
     "-v", volumeMount, "-w", "/workdir",
-    "ghcr.io/boostsecurityio/poutine:latest",
+    PoutineImage,
     "analyze_local", ".", "--format", "json", "--quiet",
 )
  • pkg/cli/poutine_test.go — regression test asserting PoutineImage is digest-pinned and passes validateDockerImageRef.

This also aligns poutine with the image pre-pull logic in docker_images.go, which already referenced the pinned constant — previously the pulled image and the executed image could diverge.

Findings assessed as already mitigated

Finding Existing control
runner_guard.go:114 ValidateAbsolutePath on git root; buildDockerVolumeMount; buildRunnerGuardContainerScanPath (Clean + within-root + ./ prefix against option injection); ResolveExecutablePath
grant.go:176 validateDockerImageRef (name/tag/digest allowlist, no leading -, no whitespace/control chars); buildDockerReadonlyFileMount with regular-file stat
poutine.go:109/229 buildDockerVolumeMount
upgrade_command.go:507 Flag allowlist; ValidateExecutablePath; argv control-character screen

No changes made to those sites.

Copilot AI linked an issue Aug 4, 2026 that may be closed by this pull request
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix security findings in github/gh-aw Pin poutine Docker image to the digest-pinned constant Aug 4, 2026
Copilot AI requested a review from pelikhan August 4, 2026 14:43
@pelikhan
pelikhan marked this pull request as ready for review August 4, 2026 14:53
Copilot AI balanced review requested due to automatic review settings August 4, 2026 14:54
@pelikhan
pelikhan merged commit 6860c3b into main Aug 4, 2026
20 of 22 checks passed
@pelikhan
pelikhan deleted the copilot/sighthound-fix-security-findings branch August 4, 2026 14:54
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

No ADR enforcement needed: PR #50279 does not have the 'implementation' label and has only 15 new lines of code in business logic directories (threshold: 100).

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Pins Poutine execution to the existing digest-pinned image constant, aligning execution with image pre-pulling.

Changes:

  • Uses PoutineImage for directory and single-file scans.
  • Adds a digest-validation test, though it does not cover command construction.
Show a summary per file
File Description
pkg/cli/poutine.go Replaces mutable Poutine image references.
pkg/cli/poutine_test.go Validates the image constant is digest-pinned.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread pkg/cli/poutine_test.go
Comment on lines +364 to +368
func TestPoutineImageIsPinnedByDigest(t *testing.T) {
if _, err := validateDockerImageRef(PoutineImage); err != nil {
t.Fatalf("PoutineImage %q failed docker image reference validation: %v", PoutineImage, err)
}
if !strings.Contains(PoutineImage, "@sha256:") {

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look correct and improve supply-chain security by ensuring the executed poutine image matches the digest-pinned constant used by the pre-pull logic. All four call sites are updated consistently and the regression test validates the pinning invariant.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 13.2 AIC · ⌖ 10.3 AIC · ⊞ 5.4K

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skills-Based Review 🧠

Applied /diagnosing-bugs — the fix correctly addresses the root cause (:latest tag instead of pinned digest) and adds a regression test. No blocking issues.

📋 Key Themes & Highlights

Positive Highlights

  • ✅ Root cause properly fixed: all four exec.Command sites in both scan paths now use PoutineImage
  • ✅ Regression test TestPoutineImageIsPinnedByDigest guards against future drift (validates both validateDockerImageRef and @sha256: presence)
  • ✅ Aligns the executed image with the pre-pull constant in docker_images.go — eliminates the execute/pull divergence
  • ✅ Comment strings updated to use <PoutineImage> placeholder, keeping docs consistent

Minor Follow-up (non-blocking)

pkg/cli/README.md line 461 still documents PoutineImage as "ghcr.io/boostsecurityio/poutine:latest" — this is now stale and could mislead readers. Worth a one-line update.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 23.3 AIC · ⌖ 10.6 AIC · ⊞ 7.1K
Comment /matt to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: Approve — no blocking issues

Small, correct, well-scoped fix: replaces the hardcoded ghcr.io/boostsecurityio/poutine:latest tag with the existing digest-pinned PoutineImage constant in both the directory and single-file scan paths (command args + verbose echo comments), and adds TestPoutineImageIsPinnedByDigest to guard against regression.

Review notes
  • All four exec.Command call sites and both verbose-echo comment strings were updated consistently — no missed occurrence of the old :latest literal remains in poutine.go.
  • PoutineImage (defined in docker_images.go) is validated via validateDockerImageRef and is digest-pinned (@sha256:...), matching the pre-pull logic in docker_images.go so the pulled and executed images now match.
  • New test TestPoutineImageIsPinnedByDigest correctly asserts both the reference validation and the digest requirement.
  • No correctness, security, or performance concerns found in the diff. Comment-only changes are accurate (comments were updated to reflect the constant instead of leaving a stale literal).

🔎 Code quality review by PR Code Quality Reviewer · auto · 14.8 AIC · ⌖ 6.25 AIC · ⊞ 7.9K
Comment /review to run again

@github-actions github-actions Bot mentioned this pull request Aug 4, 2026
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

Test Quality Score: 100/100 — Excellent

Analyzed 1 test: 1 design, 0 implementation.

📊 Metrics (1 test)
Metric Value
Analyzed 1 (Go: 1, JS: 0)
✅ Design 1 (100%)
⚠️ Implementation 0 (0%)
Edge/error coverage 1 (100%)
Duplicate clusters 0
Inflation No (1.5:1 ratio)
🚨 Violations 0
Test File Classification Notes
TestPoutineImageIsPinnedByDigest pkg/cli/poutine_test.go:364 Design test, high value Validates security invariant: docker image pinned by SHA256 digest

Verdict

Passed. 0% implementation tests (threshold: 30%). Security invariant properly tested with valid error handling and digest pinning validation.

🧪 Test quality analysis by Test Quality Sentinel · haiku45 · 19.4 AIC · ⌖ 5.67 AIC · ⊞ 8.5K ·
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Test Quality Sentinel: 100/100. 0% implementation tests (threshold: 30%).

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.84.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[sighthound] Security findings in github/gh-aw

3 participants