Repository navigation
fix(ci): exclude auth caches from ci.cache (defensive hardening) - #2705
Conversation
ci.cache archived the entire ~/.cache/atmos root when ci.cache.paths was unset, which meant AWS SSO tokens, Azure device-code tokens, and Atmos's webflow refresh tokens could get bundled into the same CI cache archive as the toolchain. Exclude those subdirectories unconditionally in both the Atmos-managed backend and the actions/cache passthrough, with a new ci.cache.allow_unsafe_auth_cache escape hatch for anyone who needs the old behavior. Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Dependency Review✅ No vulnerabilities or license issues found.Scanned FilesNone |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a canonical ChangesAuth cache exclusion feature
Estimated code review effort: 3 (Moderate) | ~30 minutes Sequence Diagram(s)sequenceDiagram
participant archiveRoot
participant archiveSkipDecision
participant isUnderPrefix
archiveRoot->>archiveSkipDecision: evaluate entry (includes, excludes)
archiveSkipDecision->>isUnderPrefix: check defaultExcludedPaths
isUnderPrefix-->>archiveSkipDecision: match / no match
archiveSkipDecision-->>archiveRoot: prune (SkipDir) or include
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Resource Changes Found for
|
Remove ci.cache.allow_unsafe_auth_cache entirely so the auth-cache exclusion has no escape hatch, and reword the docs/PRD/fix notes to describe this as defensive hardening rather than a vulnerability fix -- ci.cache was never actually exploitable in CI, this just makes the exclusion unconditional and permanent. Also drop the changelog blog post and roadmap entry, which don't belong on a patch-level hardening change. Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
Warning Release Documentation RequiredThis PR is labeled
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/fixes/2026-07-08-ci-cache-excludes-auth-caches.md`:
- Around line 1-3: The document title currently says “by default,” but the
described behavior is unconditional, so update the heading in the markdown doc
to match the always-on exclusion behavior. Adjust the title text in the docs
entry for the CI cache/auth cache change so it clearly reflects that Atmos’s
auth session caches are excluded without opt-out, keeping the body consistent
with the heading.
In `@docs/prd/native-ci/framework/ci-cache.md`:
- Around line 181-185: The wording in the ci.cache.paths section overstates the
excluded data as only short-lived session material. Update the prose around the
carve-out to describe it as protecting authentication material more broadly, and
align the description with the later aws-sso entry by avoiding any claim that
every excluded item is ephemeral; keep the change localized to the explanatory
sentence in the ci-cache documentation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: c7c2ed4d-82dc-4fac-8f0c-221b72c18be8
📒 Files selected for processing (9)
cmd/ci/cache/paths.gocmd/ci/cache/paths_test.godocs/fixes/2026-07-08-ci-cache-excludes-auth-caches.mddocs/prd/native-ci/framework/ci-cache.mdpkg/ci/cache/archive.gopkg/ci/cache/archive_test.gopkg/ci/cache/exclusions.gopkg/schema/schema.gowebsite/docs/cli/configuration/ci/cache.mdx
💤 Files with no reviewable changes (1)
- cmd/ci/cache/paths_test.go
✅ Files skipped from review due to trivial changes (2)
- pkg/schema/schema.go
- website/docs/cli/configuration/ci/cache.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
- pkg/ci/cache/exclusions.go
Title reflects the unconditional (no opt-out) behavior rather than "by default", and the excluded-auth-material description no longer implies everything excluded is short-lived (aws-sso includes an OAuth client secret). Co-Authored-By: Claude Sonnet 5 <[email protected]>
TestRunCachePaths_JSON_ExcludePathsField and TestRunCachePaths_YAML_ExcludePathsField wrapped the expected substring in filepath.ToSlash, but json/yaml output (unlike the github format) emits raw OS-native-separator paths with no slash normalization. That happened to match on Unix but failed on Windows, where the backslashes get escaped in the JSON text. Assert on the bare subdir name instead, which is platform-independent. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…f package pkg/ci/cache hardcoded auth's internal cache-subdirectory names as literal strings with comments pointing at the owning files, synced by hand via four separate drift-guard tests in the auth packages. Replace that with pkg/auth/cachepaths, a dependency-free leaf package that is the single source of truth for these subdirectory names; each owning file (sso_cache.go, device_code_cache.go, webflow.go, provisioning/writer.go) now aliases its constant from there instead of duplicating the literal. pkg/ci/cache only depends on the lightweight cachepaths package, not on the auth provider packages (which pull in AWS SDK, MSAL, Azure SDK) -- so the exclusion list can no longer drift, and the drift-guard tests are gone. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2705 +/- ##
=======================================
Coverage 81.19% 81.20%
=======================================
Files 1630 1632 +2
Lines 154206 154238 +32
=======================================
+ Hits 125205 125246 +41
+ Misses 22083 22073 -10
- Partials 6918 6919 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
|
These changes were released in v1.223.0-rc.7. |
what
ci.cache(the CI build cache) now excludesaws-sso,azure-device-code,aws-webflow, andauth— the subdirectories under~/.cache/atmoswhere Atmos persists session credentials — unconditionally, with no opt-out, regardless ofci.cache.paths.pkg/ci/cache/archive.go) and theatmos ci cache pathsoutput used with the nativeactions/cacheGitHub Action (rendered as!-prefixed glob exclusions, working around a knownactions/toolkitglob-depth limitation).website/docs/cli/configuration/ci/cache.mdx,docs/prd/native-ci/framework/ci-cache.md) and an internal fix note (docs/fixes/) are included.why
ci.cache's default behavior (cache the entire XDG cache root whenci.cache.pathsis unset) meant Atmos's own auth session material (AWS SSO tokens/refresh token/client secret, Azure device-code tokens, Atmos's webflow refresh token) sat in the same directory tree that gets archived by default.ci.cachewas never demonstrated to be exploitable or vulnerable in CI. A repo's GitHub Actions cache is already scoped to that repo, and everything involved is short-lived, rotating session material. This change just makes it structurally impossible for these directories to end up in a cache archive, rather than relying onci.cache.pathsconventions.references
docs/prd/native-ci/framework/ci-cache.md#default-excluded-auth-paths