Security hardening: add explicit permissions: {contents: read} to both workflows #273
Labels
No labels
breaking
bug
documentation
enhancement
epic
good first issue
help wanted
refactoring
resolution/duplicate
resolution/invalid
resolution/wontfix
security
severity/critical
severity/high
severity/low
severity/medium
status/abandoned
status/blocked
status/needs-decision
status/needs-info
status/needs-verification
testing
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
sixfold-space/madtea#273
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Neither
.forgejo/workflows/ci.ymlnordrift.ymldeclares apermissions:block (verified: nopermissions:key in either file). The forge injects an auto Actions token whose fork-PR scope is forge/version-dependent and is readable by any code running in the job.For a public repo the expected default is read-only, so impact is low, but making the grant explicit is cheap defense-in-depth and removes the dependency on the forge's default staying read-only across upgrades.
Fix: add a top-level
permissions: {contents: read}to both workflows (tighten further per-job if any job needs less).Acceptance: both workflows declare an explicit minimal
permissions:block; CI still passes.Follow-up: the fix landed in
4888f3b1but had to be reverted in #306 - Forgejo does not support the workflowpermissions:field at all; every run warned "not supported in Forgejo and will be ignored. Use Authorized Integrations to grant capabilities to this job instead."Forgejo's model is inverted from GitHub's (Authorized Integrations docs): the automatic Actions token starts with limited capabilities, and Authorized Integrations (repo Settings) extend it for jobs that need more - there is no workflow-side knob to restrict below the default, so this issue's mitigation ("remove the dependency on the forge's default staying read-only") has no Forgejo equivalent.
No follow-up work needed for these workflows: neither uses the injected token at all (checkouts are anonymous shallow fetches of the public repo; drift's smoke job provisions its own token against a throwaway Forgejo container inside the job). If a future job ever needs forge write capabilities (e.g. drift filing an issue on failure), the right tool is an Authorized Integration scoped to that workflow file, ref, and event - not a
permissions:block.