ci(oc): Add external_dir perm - #1502
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
1 issue found across 1 file
Confidence score: 2/5
.github/workflows/opencode.ymlgrants the agent unrestricted access outside the checkout while also allowingid-token: write, creating a significant risk of unauthorized reads, writes, or use of the runner’s OIDC-enabled authentication context; restrictexternal_directoryand remove or narrowly scope the token permission.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name=".github/workflows/opencode.yml">
<violation number="1" location=".github/workflows/opencode.yml:39">
P2: Granting `external_directory: "allow"` enables the agent to read and write any path outside the checkout on the runner, unrestricted. The runner also carries `id-token: write`, so the agent can reach OIDC/materialized credentials and temp/other-checkout paths. Per opencode docs, this permission accepts a scoped map (e.g. `{ "external_directory": { "/home/runner/work/**": "allow" } }`), and managed tool-output/temp/global config dirs are already exempted from the boundary. Scope the rule to the paths the workflow actually needs instead of a blanket allow.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
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.
The default is "ask", which causes dead-end, because the user can't respond during workflow execution. The workflow runs on a GitHub runner. I assume there is no risk in free access to external_dir.
Summary by cubic
Sets
OPENCODE_PERMISSIONto allowexternal_directoryaccess in the opencode workflow. The default "ask" permission dead-ends the workflow since nobody can respond while it runs on a GitHub runner.Written for commit 324498f. Summary will update on new commits.