Skip to content

Strip write capability from the untrusted-triggered claude.yml run - #27

Open
Jartans-Familiar wants to merge 1 commit into
mainfrom
agent/sable/67968025
Open

Strip write capability from the untrusted-triggered claude.yml run#27
Jartans-Familiar wants to merge 1 commit into
mainfrom
agent/sable/67968025

Conversation

@Jartans-Familiar

Copy link
Copy Markdown
Member

Summary

issues, issue_comment, pull_request_review and pull_request_review_comment carry content any GitHub account can author, and this repo's trigger gate was the literal @claude string with no membership check at all — Row B of the Security finding, JAR-681. Any GitHub user opening an issue containing @claude got a write-scoped App token and --dangerously-skip-permissions.

  • Mint the App token with permission-contents/issues/pull-requests: read explicitly, instead of inheriting the App installation's full grant.
  • Drop the matching job-level permissions: block to read-only.
  • Remove --dangerously-skip-permissions.
  • Pin checkout to github.ref_name (was github.head_ref || github.ref_name) so a pull_request_review* event can never resolve to a fork PR head under the token.

Reproduction test

tests/test_claude_workflow_security.py reads the shipped .github/workflows/claude.yml and asserts no write scope is minted and permission checks aren't skipped. Verified fail-before / pass-after against base revision c285befdd2e60de912736943c57d940e2057f57a:

  • Before: test_untrusted_trigger_mints_no_write_scope fails on the job-level contents: write grant; test_permission_checks_are_not_skipped fails on --dangerously-skip-permissions.
  • After: both pass. Full suite (ruff check, ruff format --check, pytest) is green.

Test plan

  • ruff check .
  • ruff format --check .
  • pytest (125 passed, including the new regression test)

JAR-687

issues, issue_comment, pull_request_review and pull_request_review_comment
carry content any GitHub account can author, and the trigger gate is the
literal @claude string with no membership check at all — Row B, JAR-681.
Mint the App token with explicit read-only permission-contents/issues/
pull-requests instead of inheriting the App installation's full grant, drop
the matching job-level write scopes, remove --dangerously-skip-permissions,
and pin checkout to github.ref_name so a pull_request_review* event never
resolves to a fork PR head under the token.

JAR-687

Co-authored-by: multica-agent <github@multica.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant