Repository navigation
fix: keep other secret files out of image builds - #330
Merged
Merged
Conversation
Exclude common secret names at any depth from the build context, as trs-filer does. All of cloud_registry/ is sent to the build, so a local key or credentials file there would end up in an image layer. Closes #329 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMUX3EU35poH13xMgG
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMUX3EU35poH13xMgG
Reviewer's GuideThe PR hardens Docker image builds by extending .dockerignore with trs-filer-aligned patterns for common secret files at any depth, while adding context-level regression tests that validate nested exclusions without filtering legitimate source files. File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #330 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 22 22
Lines 2368 2368
=========================================
Hits 2368 2368 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
uniqueg
marked this pull request as ready for review
November 2, 2026 19:05
There was a problem hiding this comment.
Hey - I've reviewed your changes and they look great!
Linked issues
#329 Exclude other secret files from image builds · 2 of 2 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Exclude the same common secret file names as trs-filer from image builds at any depth. | ✅ Met | .dockerignore adds patterns for .env files, PEM and key files, SSH keys, P12/PFX files, credentials JSON, .netrc, .git-credentials, and .pypirc. |
| 2 | Add a test for the exclusions. | ✅ Met | test_context_without_secret_files checks representative names at the root and in included folders, and verifies near-match source filenames remain included. |
Sourcery assessment
Approved.
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.
Summary
.dockerignoreexcluded**/.env*but no other secret files, and all ofcloud_registry/is sent to the build. A localcloud_registry/server.pemwould be copied into an image layer.*.env,*.pem,*.key, SSH keys,*.p12,*.pfx,credentials*.json,.netrc,.git-credentials,.pypirc.test_context_without_secret_fileschecks them at the root and in included folders, and that similar source file names stay in.No tracked file matches the new rules. No user or operator doc describes the build context, so no docs change.
Closes #329
Verification
docker buildof a scratch image from all tracked files plus planted dummy secrets: none of the secrets reach the context, and all 25 trackedcloud_registry/files do.pytest tests/test_image_build.py -k 'secret_files or env_files or context_files', without the repo'sconftest.py: 3 passed. The new test fails against the old.dockerignore.ruff checkandruff format --checkon the test pass.Declined review findings
.npmrc,.pgpass,*.jks,.aws/,gcp-credentials.json(adversarial reviewer, low): a list of names can never be complete, and this one deliberately matches trs-filer. An allowlist of file types undercloud_registry/would close the gap, but that is a design decision for both registries.Open questions
None.
🤖 Generated with Claude Code
https://claude.ai/code/session_011FSoqMUX3EU35poH13xMgG
Summary by Sourcery
Exclude common secret files from Docker image build contexts while preserving legitimate source files with similar names.
Bug Fixes:
Tests: