Remove GitHub auth from agent steps to mitigate prompt injection#14
Open
bholmesdev wants to merge 1 commit intomainfrom
Open
Remove GitHub auth from agent steps to mitigate prompt injection#14bholmesdev wants to merge 1 commit intomainfrom
bholmesdev wants to merge 1 commit intomainfrom
Conversation
…n-time token for applying writes
captainsafia
reviewed
Mar 5, 2026
| - name: Checkout Repo | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| persist-credentials: false |
Collaborator
There was a problem hiding this comment.
Should we update the "Checkout PR" step here to use the token to fetch as is the case with the other workflows?
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
A maintainer adapting our example workflows for Vite identified that passing
issues: write(or any write-scoped token) directly to the Oz Agent step exposes a prompt-injection attack surface: a malicious issue body or comment could instruct the agent to delete issues, remove comments, or abuse any permission granted by the token.This PR hardens example workflows so the agent step never has access to GitHub credentials, and write operations are handled in post-processing action steps.
Changes
Across all 6 example workflows (
examples/):persist-credentials: falseto allactions/checkoutsteps so theGITHUB_TOKENis not stored in the local git config where the agent could access it. This is needed because credentials are shared across the job, and need to be manually applied at each step to avoid splitting examples across multiple jobs (see Alternatives Considered).GH_TOKEN/envfrom allwarpdotdev/oz-agent-actionsteps. This does hurt the simplicity of our examples by blocking agent writes, so I'm open to discussion here.respond-to-comment,auto-fix-issue,fix-failing-checks): added just-in-timegit remote set-urlwithGH_TOKENin the trustedcommit-and-pushstep.ghcommands or call the GitHub API directly.Permission tightening:
review-pr: removed unnecessaryissues: write(only needspull-requests: write).suggest-review-fixes: removed unnecessaryissues: write.Documentation:
README.mdexplaining the tokenless-agent pattern.Alternative considered: separate jobs (Vite's approach)
Vite's PR solves this by splitting workflows into two jobs: a read-only job that runs the agent, and a write-capable job that consumes the agent's output via job
outputs. Because jobs run on separate VMs, the write token never exists in the agent's environment.We chose not to adopt this approach here because:
auto-fix-issue,respond-to-comment,fix-failing-checks) have the agent modify files that then get committed. Transferring a dirty working tree across jobs requiresactions/upload-artifact/actions/download-artifact, adding complexity and latency that's inappropriate for example workflows meant to be simple and copy-pasteable.review-pr,suggest-review-fixes,daily-issue-summary), the two-job split would be strictly better and is worth considering as a follow-up.Stripping credentials from the agent's environment within a single job is a middle ground here.