A private org's Actions job cannot read the org's own forge packages (Forgejo 15 DeterminePackageAccessMode TODO; PR 54 task 2878) #61

Open
opened 2026-11-22 22:01:25 +00:00 by saturnus · 2 comments
Member

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 db action_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:

// TODO: ActionUser permission check
accessMode := perm.AccessModeNone
if owner.IsOrganization() {
    ... // org members by team unit; otherwise read only if the org is visible to the doer

The run token's user (the Actions user) is no org member, and macula-io is private, 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

  • IDEA (no yes yet; a new check needs Raf's yes, B11): a lint could refuse a forge /api/packages/ URL in a workflow, naming this issue.
  • Upstream: worth reporting to Forgejo once someone checks whether a later release resolves the TODO.

Refs #42

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 db `action_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`: ``` // TODO: ActionUser permission check accessMode := perm.AccessModeNone if owner.IsOrganization() { ... // org members by team unit; otherwise read only if the org is visible to the doer ``` The run token's user (the Actions user) is no org member, and `macula-io` is `private`, 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 - IDEA (no yes yet; a new check needs Raf's yes, B11): a lint could refuse a forge `/api/packages/` URL in a workflow, naming this issue. - Upstream: worth reporting to Forgejo once someone checks whether a later release resolves the TODO. Refs #42
Author
Member

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.

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.
Member

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:

  • task 3407, the image as the job's own container: by digest (git.macula.io/macula-io/macula-ci-martha@sha256:71c6a0f9...728): failed, the job container could not pull the private image.
  • task 3408, a step running docker login git.macula.io with the job token and then docker pull of 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.credentials on 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)

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: - task 3407, the image as the job's own `container:` by digest (git.macula.io/macula-io/macula-ci-martha@sha256:71c6a0f9...728): failed, the job container could not pull the private image. - task 3408, a step running `docker login git.macula.io` with the job token and then `docker pull` of 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.credentials` on 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)
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
martha-ai/martha#61
No description provided.