BM: Baca dalam Bahasa Melayu
World C4: Pipeline Shields
Least-privilege permissions
You will learn: how to give each job only the keys it needs with permissions.
Checked with GitHub Actions 2026-10 on 31 Oct 2026
The problem
Your release job turns red with this error:
HTTP 403: Resource not accessible by integration
What does it mean?
Pick one answer.
Watch
Each job gets a key card: the GITHUB_TOKEN: A short-lived key each job gets. It stops working when the job ends.. permissions: picks its doors. Open only what the job needs. That is least privilege: Give each worker only the keys their station needs. Nothing extra..
Drag a card into a box. Or tap the card, then tap the box.
Watch
permissions: {} at the top gives no keys. Then each job asks for its own. List some keys, and every other key becomes none.
Tap the line that lets a job create a release.
0 of 1 found
Try it
Push tag v1.4.0. The release step is refused. Pick the smallest fix that turns it green.
The line is red. Fix the yellow lines, then run again.
Workflow file .github/workflows/release.yml
name: Release on: push: tags: ['v*'] permissions: contents: read jobs: release: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - run: npm ci - run: npm test - run: gh release create "$GITHUB_REF_NAME" --generate-notes env: GH_TOKEN: ${{ github.token }}
Yellow: lines 5–6. You can change these.
The line
Push tag v1.4.0 · v1.4.0
Hint
Releases live with your code: contents.Predict
Your PR job has pull-requests: write. A stranger opens a PR from a fork. It runs on pull_request. Can it comment?
Pick one answer.
Try it
Build it. The file reads code only. The job adds one door: PR comments. Job keys replace the file’s keys, so list both.
Tap blocks to add them. Put them in order.
Blocks
Your workflow
Tap a block above to start.
Workflow file .github/workflows/
name: PR report
What runs
Nothing to run yet.
Hint
Trigger, file keys, job, job keys, then steps.You did it!
You can now give each job only the keys it needs.
Go deeper (optional)
Repo settings also pick a default key: read-only, or read and write. Don’t trust the default. Write permissions: in every workflow. Tip: split a release into a test job and a release job. Only the release job gets contents: write. Real rep: add permissions: with contents: read to one of your workflows.
Bahasa Melayu
Job release anda jadi merah dengan ralat ini:
HTTP 403: Resource not accessible by integration
Apa maksudnya?
Setiap job dapat kad kunci: GITHUB_TOKEN. permissions: pilih pintunya. Buka hanya yang job perlukan. Itulah least privilege (hak paling sedikit).
permissions: {} di atas tak beri sebarang kunci. Kemudian setiap job minta kuncinya sendiri. Senaraikan sesetengah kunci, dan kunci lain jadi none.
Push tag v1.4.0. Langkah release ditolak. Pilih pembaikan paling kecil yang jadikannya hijau.
Job PR anda ada pull-requests: write. Orang asing buka PR dari fork. Ia jalan pada pull_request. Boleh ia komen?
Bina ia. Fail hanya baca kod. Job tambah satu pintu: komen PR. Kunci job ganti kunci fail, jadi senaraikan kedua-duanya.
Kini anda boleh beri setiap job kunci yang ia perlukan sahaja.
You finished this before. Practice is always welcome!
Official docs: Workflow syntax: permissions · GITHUB_TOKEN · Secure use reference
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?