Release job keeps a write token on disk while running the whole check suite

未關閉 適合新手
#251 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
83/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
github-actions, javascript
領域
ci-cd, security

研究方向

閱讀 .github/workflows/release.yml,著重檢查 workflow 權限、checkout 步驟和 CITATION push 步驟。確認其他 workflow 如何停用持久化憑證,接著執行 npm test 或完整的 npm run check 檢查。完成的標準是只有 push 步驟取得寫入權杖,而且發行時仍會更新 main 上的 CITATION.cff。

由索引模型根據 Issue 內容生成。

描述

good first issue hardening priority: low

Summary

release.yml grants contents: write at workflow level and checks out without persist-credentials: false, so the write token sits in .git/config while lint, tests, validate and build run, long before the one step that pushes.

Where

  • .github/workflows/release.yml:17-18 (permissions)
  • .github/workflows/release.yml:35-39 (checkout)
  • .github/workflows/release.yml:59-61 (npm run check)
  • .github/workflows/release.yml:94 (push)

Details

The other workflows already follow least privilege (PR CI uses persist-credentials: false; thumbs splits its write job). This is defence in depth; the code that runs is main's own and the job refuses non-main refs.

Impact

Narrows what any future change to the check scripts could do with the token during a release.

Suggested fix

Check out with persist-credentials: false and push in the CITATION step with an explicit token passed through env:, for example git push "https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}" HEAD:main.

Acceptance criteria

  • Checkout uses persist-credentials: false
  • Only the push step has access to the write token
  • A release still updates CITATION.cff on main

Getting started

  • Relevant files: .github/workflows/release.yml
  • Run the tests: npm test; the full local gate is npm run check (Node 22+, no install step)
  • Related docs: CONTRIBUTING.md, site/README.md

Filed by repo-audit/full-audit at 4adb944. Severity: low. Effort: S. audit-key: security|.github/workflows/release.yml|persist-credentials

主要語言
JavaScript
星號
58
分支
15
平均合併
1 天 15 小時
30 天內合併 PR
12

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

TMHSDigital/Free-Game-Dev-Assets 的其他 Issue

查看 TMHSDigital/Free-Game-Dev-Assets 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。