Skip to content

fix(ci): reject unsafe generated file additions - #6445

Merged
devantler merged 1 commit into
mainfrom
codex/fix-ci-auto-commit-symlink-vulnerability
Aug 2, 2026
Merged

fix(ci): reject unsafe generated file additions#6445
devantler merged 1 commit into
mainfrom
codex/fix-ci-auto-commit-symlink-vulnerability

Conversation

@devantler

@devantler devantler commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

🤖 Generated by the Agentic Engineer

Motivation

  • Prevent the auto-commit job from dereferencing symlinks or special files and publishing their targets, which can leak runner/checkout secrets when the job checks out with an App token.
  • Avoid persisting the generated GitHub App credential in local git config during the auto-commit path so tokens are not left on disk in the worktree metadata.
  • Ensure the GraphQL FileAddition payload only contains regular non-executable files that the API can faithfully represent instead of silently losing mode info or dereferencing symlinks.

Description

  • Disable credential persistence in the auto-commit checkout by setting persist-credentials: false for the job checkout step so the App token is not written into local git config.
  • Add a fail-closed guard in the commit payload builder that rejects any changed path that is a symlink, not a regular file, or is executable, and aborts before reading the file contents.
  • Update the inline workflow comments to document that file modes/symlinks are not expressible via the API and that the pipeline rejects non-regular/non-representable generated files rather than dereferencing them.

Testing

  • Ran a static workflow assertion that verifies persist-credentials: false is present for the checkout step and that the file-type guard appears before the base64 -w0 content read; assertion succeeded.
  • Executed a shell regression PoC that created a symlink to a secret, then validated the workflow logic rejects the symlink before any base64 read; the symlink was rejected as expected.
  • Performed git diff --check and git diff --cached --check to validate the change and ensure no accidental whitespace/check failures; both checks passed in this environment.
  • mega-linter-runner -f go and actionlint could not be run because those executables are not available in the current environment (not run).

Codex Task

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

MegaLinter analysis: Success

✅ Linters with no issues

actionlint, bash-exec, git_diff, hadolint, jscpd, jsonlint, lychee, markdown-table-formatter, markdownlint, prettier, prettier, shellcheck, shfmt, stylelint, syft, trivy-sbom, trufflehog, v8r, v8r, yamllint

Notices

📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining SECURITY_SUGGESTIONS: false)

See detailed reports in MegaLinter artifacts

MegaLinter is graciously provided by OX Security
Show us your support by starring ⭐ the repository

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

@devantler I will review the changes in #6445.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The auto-commit workflow now disables persisted checkout credentials. It documents that generated files must be regular 0644 files. It rejects symlinks, non-regular files, and executable files before submitting generated files through the GitHub API.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely identifies the main change: rejecting unsafe generated file additions in CI.
Description check ✅ Passed The description directly explains the CI security changes, file validation behavior, documentation updates, and testing results.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

@devantler I will review the changes in #6445.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

@devantler I will perform a complete review of #6445.

✅ Action performed

Full review finished.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 20 minutes.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 392475ad78

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@devantler
devantler marked this pull request as ready for review August 2, 2026 14:50
@devantler
devantler merged commit 443c1cb into main Aug 2, 2026
70 checks passed
@devantler
devantler deleted the codex/fix-ci-auto-commit-symlink-vulnerability branch August 2, 2026 14:51
@github-project-automation github-project-automation Bot moved this from 🫴 Ready to ✅ Done in 🌊 Project Board Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

1 participant