Security: drift.yml pull_request trigger + host-docker-socket smoke job is a pwn-request vector #266
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#266
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?
Once the repo is public and takes fork PRs,
drift.ymlhas a classic pwn-request shape that needs closing (or a runner-config confirmation) before launch.The chain:
.forgejo/workflows/drift.yml:35-36triggers onpull_request.forgejo-smokejob is gated byif: ${{ vars.RUN_FORGEJO_SMOKE == 'true' }}(line 99) and runsdocker ps/docker execagainst the HOST docker socket to provision the sidecar admin (around line 167).run:blocks andtests/integration/forgejo-smoke.sh(invoked ~line 183).On Codeberg the var is unset, so the job is skipped - safe there. The exposure is on the org runner, where
RUN_FORGEJO_SMOKE=trueand the docker socket is reachable: a hostile fork PR that editsdrift.ymlorforgejo-smoke.shgets code execution with host-docker-socket access, which is host root. The provisioned admin token itself is confined to the ephemeral throwaway Forgejo sidecar and can't reach outside the job - the risk is the socket, not the token.This is blocked if and only if the runner does NOT auto-run untrusted fork-PR workflows (manual approval required). That policy lives in runner config, not repo source, so it can't be confirmed from here.
Fix (either):
pull_requestfrom the socket-privileged smoke job - restrict it topush/schedule/workflow_dispatchso PR-controlled code never runs in the socket-privileged context.Option 2 is the durable fix and doesn't depend on runner policy staying correct. This is the single most important pre-public item from the security sweep.