registry(auth): require authentication for image pulls (F11) #43
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/registry-anon-pull"
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?
Summary
Audit finding F11:
/v2/tokenminted a token for anonymous clients (UserID: -1, Scope: "") and that token returned200on every package — including images of private repos (siriusdevops-site,phs-site,sirius-growth-*,sgs-leadgen), because Forgejo 16 grants the anonymous ghost userperm.AccessModeReadinservices/context/package.go::determineAccessMode. "Make the repo private" was therefore not a mitigation.Changes
apps/base/forgejo/deployment.yaml—FORGEJO__service__REQUIRE_SIGNIN_VIEW=true. This is the documented switch inrouters/api/packages/container(Authenticate): anonymous callers getUNAUTHORIZEDinstead of a ghost token, anddetermineAccessModereturnsAccessModeNone. Side effect (deliberate): the Forgejo web UI/REST API becomes login-only for anonymous visitors, including public repos. CI pushes are unaffected (REGISTRY_TOKEN,write:package).imagePullSecrets: [{name: forgejo-pull}].docs/registry-pull-auth.md— why the node carries no global credential, the out-of-band Secret recipe, the add-a-namespace recipe, and the verification commands.The
forgejo-pullSecret (kubernetes.io/dockerconfigjson, userregistry-reader,read:package) exists out of band in all four namespaces — secrets never live in this repo. A recreated namespace needs the Secret re-applied before its pods reschedule.Verification (live, after merge)
/v2/token→401 {"errors":[{"code":"UNAUTHORIZED",...}]}; anonymous manifestHEAD→401200;dockerconfigjsonpull proven from each namespaceRunning, noErrImagePull/ImagePullBackOffconfig_path = ""and nohosts.tomlon any node (no node-level credential)Refs: finding F11 of
2026-11-27-cluster-netsec-audit.md.Forgejo 16 mints an anonymous ("ghost user") registry token on /v2/token and grants it Read on every package regardless of repo visibility, so all 18 app images were world-downloadable — including images of private repos (siriusdevops-site, phs-site, sirius-growth-*, sgs-leadgen). * FORGEJO__service__REQUIRE_SIGNIN_VIEW=true: /v2/token answers UNAUTHORIZED to anonymous clients, anonymous manifests get 401. This is the documented switch in routers/api/packages/container (Authenticate) and services/context/package.go (determineAccessMode). Side effect: the Forgejo web UI/API becomes login-only for anonymous visitors. * imagePullSecrets: [forgejo-pull] on all 18 workloads that pull from the registry (osint, piedmont, sirius-growth, siriusdevops). The kubernetes.io/dockerconfigjson Secret is per-namespace and out of band (never in git); docs/registry-pull-auth.md documents why, how to recreate it, and the verification commands. No containerd-level credential.