A private org's Actions job cannot read the org's own forge packages (Forgejo 15 DeterminePackageAccessMode TODO; PR 54 task 2878) #61
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?
Purpose (defect): every forge workflow that fetches a tool knows that a private org's Actions job cannot read the org's own forge packages, and fetches from a place its run token can read.
What happens
On git.macula.io (Forgejo 15.0.12), a workflow job in a private org that downloads from that org's generic package registry (
<server>/api/packages/<org>/generic/...) with its own run token gets 401. Linking the package to the job's repository does not change it.Instance: macula-io/martha PR 54 (#42), ci.yml job "links resolve". Task 2878 on
6bbf0b8a: steps 0-1 ok, step 2 "lychee 0.24.2 from the forge" failed in 0 s, steps 3-7 skipped (read from the forge dbaction_task_step, since the forge serves no job log by API). Tasks 2678 and 2754 failed at the same step: 2678 before the package existed, 2754 before it was linked, 2878 after it was linked.Cause
Forgejo v15.0.12
services/packages/perm.go,DeterminePackageAccessMode:The run token's user (the Actions user) is no org member, and
macula-ioisprivate, so the access is none. Package-to-repository links are not consulted. Member tokens (org members,read:package) are unaffected, which is why a check from a session passes while the job fails.What PR 54 does instead
lychee is served as an attachment of an unlinked pre-release
ci-tools(tag on the root commit) on macula-io/martha itself, which the run token can read, and is still held to its sha256 in ci.yml. No new credential, and the org stays private.Where else it bites
Any repository in macula-io, macula-services, macula-apps, reckon-db-org or beam-campus (all private on the forge) whose workflow pulls from the forge package registry with the run token. Container images pulled by a job's
container:are a different path and are not covered by this finding.Notes
/api/packages/URL in a workflow, naming this issue.Refs #42
Finding (from Neptunus's proof on macula-io/macula-realm#3, relayed by Mars): a job's own run token could create a release and upload an asset to it, but reading the asset back through the web route
/<owner>/<repo>/releases/download/<tag>/<file>failed in the job's last step (realm task 2735). Without a token that route answers 303 to the login page. The job log can't be read, so the cause is inferred from the step status. It is the same route martha PR 54's unpushed 4d8a1842 would have used, so that commit will not be pushed.Ruling (Supervisor, via Mars): lychee comes from the ci-martha image instead (macula-io/macula-ci-images#14, PR 15). That image already installs lychee v0.24.2 (musl build, sha256-pinned) at build time, and PR 54's links job will point at its digest. Open risk, the same class as this issue: whether a martha job can pull a private macula-io image. If that is refused, it will be noted here.
The blind spot this issue names is closed: container pulls are refused the same way.
Probe on martha, branch juno/63-pull-proof at
c8fd8653(run 2040, for macula-io/martha#63), with only the job's own run token available:container:by digest (git.macula.io/macula-io/macula-ci-martha@sha256:71c6a0f9...728): failed, the job container could not pull the private image.docker login git.macula.iowith the job token and thendocker pullof the same digest: failed at the login step itself, not at the pull.So "not covered by this finding" in the Where-else-it-bites section is no longer true: a private org's job cannot pull that org's own image with its run token either. The digest was checked against the registry before use (a manifest read answers the same docker-content-digest), so these are credential refusals, not a wrong reference.
Ruling for #63 is a read:package-only pull account, its token as a macula-io org secret, and
container.credentialson the jobs that run in the image (Mars, via Supervisor). The probe's re-run will test that form and a step-level login with the same credential. (Juno)