ワンクリックで
codeql-permission-classification
Permission requirements for GitHub Actions
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Permission requirements for GitHub Actions
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Use when creating PRs, linking issues, managing PR comments, or creating GitHub issues
Use when creating or editing GitHub Actions workflows that call reusable workflows (uses: OWNER/repo/.github/workflows/...) — org owner references must be the literal current org, and shared-CI homes are under dryvist.
Emit a paste-ready two-part handoff for a fresh session: a `## Goal statement` hard-capped under 4000 characters (measured with wc -c, never estimated) that pastes straight into Claude Code's /goal Stop hook, plus an unbounded `## Full prompt` carrying cwd, ordered reading list, hard rules, pitfalls, and deliverables. Use when forking work to a new session, spinning up an orchestrator, or when wrap-up needs a next-session prompt with a real goal and not just a task list.
Analyzes current session state and repository status without any cleanup. Full mode (default): resolves the active plan file, reads plan checklist + TaskList, gathers unfinished work/issues from conversation history, checks git status, and emits a /handoff-built next-session prompt. Mid-session mode (`/session-status mid`): a fast plain-language 'done vs remaining' snapshot for mid-flight orientation, skipping the history scan, triage, and handoff.
End-of-session handler that first checks whether the current session's plan is actually complete. If complete: refresh repo, run quick retrospective, clean gone branches, and emit a forward-looking follow-up prompt. If incomplete: skip cleanup and emit one or more `cd`-into-worktree blocks paired with ready-to-paste resume prompts so the unfinished work can be picked up cold in a new session.
Automatically finalize pull requests for merge by resolving CodeQL violations, review threads, merge conflicts, and CI failures. Handles single PR (current branch or by number), all open PRs in the repo, or all open PRs across the org. Includes bot-authored PRs in all modes.
| name | codeql-permission-classification |
| description | Permission requirements for GitHub Actions |
Single source of truth for GitHub Actions permission requirements.
GitHub Actions provides these permission scopes:
contents # Read/write repository content (checkout, tags, releases)
pull-requests # Read/write PR comments, reviews, assignments
issues # Read/write issue comments, labels, projects
deployments # Read/write deployment status
packages # Read/write packages
actions # Read/write GitHub Actions (runners, artifacts, caches)
checks # Read/write check runs and annotations
statuses # Read/write commit statuses
security-events # Read/write code scanning and secret scanning results
| Action | Required Permissions | Use Case |
|---|---|---|
actions/checkout@v6 | contents: read | Clone repository |
actions/upload-artifact@v6 | None (usually) | Store build artifacts |
actions/download-artifact@v6 | None (usually) | Retrieve artifacts |
actions/setup-node@v6 | None | Install Node.js |
actions/github-script@v6 | Depends on script | Usually contents: read minimum |
actions/create-release@v1 | contents: write | Create GitHub release |
github/codeql-action/upload-sarif@v2 | security-events: write | Upload CodeQL results |
Q1: Does your job use actions/checkout?
contents: readQ2: Does your job modify repository (create PR, tag, release)?
contents: writeQ3: Does your job post comments to PR or issues?
pull-requests: write (PR) or issues: write (issues)Q4: Does your job modify deployments?
deployments: writeQ5: Does your job use github.rest API?
Q6: Does your job call a reusable workflow?
Q7: Is your job just aggregating results with no API access?
permissions: {} (empty - no token needed)test:
runs-on: ubuntu-latest
permissions:
contents: read # For checkout
steps:
- uses: actions/checkout@v6
- run: npm test
release:
runs-on: ubuntu-latest
permissions:
contents: write # For creating release
steps:
- uses: actions/checkout@v6
- uses: actions/create-release@v1
with:
tag_name: v1.0.0
comment:
runs-on: ubuntu-latest
permissions:
contents: read # For checkout
pull-requests: write # For creating comment
steps:
- uses: actions/checkout@v6
- run: npm run lint | tee lint-result.txt
- uses: actions/github-script@v6
with:
script: |
github.rest.pulls.createReview({
pull_number: context.issue.number,
body: 'Lint check passed'
})
If .github/workflows/_validate.yml contains:
jobs:
validate:
permissions:
contents: read
pull-requests: write # This job posts comments
steps: ...
Then the caller must declare:
validate:
permissions:
contents: read
pull-requests: write # Union of nested job permissions
uses: ./.github/workflows/_validate.yml
gate:
runs-on: ubuntu-latest
permissions: {} # Explicitly no permissions needed
steps:
- uses: re-actors/alls-green@release/v1
with:
allowed-skips: job1, job2
jobs: ${{ toJSON(needs) }}
Important: When a job calls a reusable workflow via uses:, the caller job must declare permissions for all jobs within the reusable workflow.
Why: The reusable workflow's nested jobs inherit the permissions from the caller's GITHUB_TOKEN, so the caller must declare everything the callee needs.
Example mismatch (WRONG):
# ci-gate.yml
validate:
# Missing permissions!
uses: ./.github/workflows/_validate.yml
# _validate.yml
jobs:
check:
permissions:
contents: read
pull-requests: write
steps: ...
Correct:
# ci-gate.yml
validate:
permissions:
contents: read
pull-requests: write # Declare what _validate.yml needs
uses: ./.github/workflows/_validate.yml
Without explicit permissions:
GITHUB_TOKEN: read-all (dangerous!)GITHUB_TOKEN: read-write (very dangerous!)With explicit permissions:
❌ Mistake 1: Forgetting PR/issues permissions
# WRONG - Creates comment but no permission
comment:
steps:
- uses: actions/github-script@v6
with:
script: github.rest.issues.createComment({...})
✅ Correct:
comment:
permissions:
issues: write # ← Add this
steps:
- uses: actions/github-script@v6
with:
script: github.rest.issues.createComment({...})
❌ Mistake 2: Not declaring union of reusable workflow permissions
# WRONG - Reusable workflow's jobs need more permissions
my-job:
permissions:
contents: read # But reusable also needs pull-requests: write
uses: ./.github/workflows/_validate.yml
✅ Correct:
my-job:
permissions:
contents: read
pull-requests: write # Include all permissions from reusable
uses: ./.github/workflows/_validate.yml
❌ Mistake 3: Excessive permissions
# WRONG - Too much permission
build:
permissions:
contents: write # Unnecessary - only reads files
steps:
- uses: actions/checkout@v6
- run: npm build
✅ Correct (least-privilege):
build:
permissions:
contents: read # Minimum needed for checkout
steps:
- uses: actions/checkout@v6
- run: npm build
Run CodeQL scan locally:
codeql database create my_db --language=actions --source-root=.
codeql database analyze my_db actions/security-and-quality.qls --format=sarif-latest --output=results.sarif
Or wait for GitHub to scan and check:
gh pr checks # See if CodeQL permission alerts appear