Skip to content

fix(publish): scan extends parent files for sensitive data - #14590

Draft
htoyoda18 wants to merge 1 commit into
docker:mainfrom
htoyoda18:fix/publish-scan-extends-parents
Draft

htoyoda18 wants to merge 1 commit into
docker:mainfrom
htoyoda18:fix/publish-scan-extends-parents

Conversation

@htoyoda18

@htoyoda18 htoyoda18 commented Dec 6, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does

publish pushes local extends parent files as layers of the OCI artifact, but the sensitive data check only scanned the top-level compose files, so a secret in an extends parent was published without the prompt. This makes the check scan the same files publish pushes.

Related issue

Addresses #14589

This covers the extends part of the issue. The YAML comments part is not addressed here: its fix needs a decision, so I'll follow up on it in the issue.

Changes made

  • internal/publish/publish.go: move the walk that collectEnvCheckFindings already used (top-level files plus local extends parents, transitively, mirroring processExtends) into walkPublishedComposeFiles, and use it in checkForSensitiveData too. Each file is still scanned through the re-marshalled model rather than the raw bytes. composeFileAsByteReader is removed because nothing uses it anymore.
  • internal/publish/publish_test.go: Test_checkForSensitiveData_extendsParents covers a secret in an extends parent and in a grandparent.
  • internal/e2e/publish_test.go and testdata/TestPublishDetectSensitiveDataInExtends/: an e2e scenario with the reproduction from the issue. Answering n to the sensitive data prompt now exits with 130, and the prompt reports services.base.labels.ci.token.

Testing done

  • Unit tests pass: make test
  • E2E tests pass: make e2e-compose or make e2e-compose-standalone
  • Linting passes: make lint
  • Code formatted: make fmt
  • Manually tested (describe):

AI tool used (if applicable)

I used Claude Code to investigate edge cases and assist with code review.
I personally reviewed and verified all the code.

Additional context

(not mandatory) A picture of a cute animal, if possible in relation to what you did

image

Signed-off-by: Hiroto Toyoda <hirototoyoda20020927@gmail.com>

This branch has not been deployed

No deployments
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.

1 participant