bug: setup_forge reachability check uses unauthenticated curl against /api/v1/version, fails on REQUIRE_SIGNIN_VIEW=true forgejos #581
Labels
No labels
action
backlog
blocked
bug-report
cannot-reproduce
in-progress
in-triage
needs-triage
prediction/actioned
prediction/dismissed
prediction/unreviewed
priority
rejected
reproduced
tech-debt
underspecified
vision
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: disinto-admin/disinto#581
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?
Description
lib/forge-setup.shline 53 (setup_forge) checks whether Forgejo is already running with an unauthenticated GET:The stock disinto compose file sets
FORGEJO__service__REQUIRE_SIGNIN_VIEW=trueon the forgejo service — which makes every unauthenticated API call (including/api/v1/version) return HTTP 403. Socurl -sfsees the 4xx and exits with code 22, and init thinks Forgejo is down.Init then tries to (re)start Forgejo with
docker compose up -d forgejo. On a running factory where forgejo is already up, this is harmless but misleading. On a box where the caller isn't in the docker group (e.g. running init as a non-root user without docker access), it fails with a permission error and init aborts entirely — unable to even check whether the already-running forgejo could be talked to.Reproduction
Start a disinto factory with the stock compose (or anything that sets
REQUIRE_SIGNIN_VIEW=true):Confirm forgejo is reachable but locked-down:
Run
bin/disinto init— it will print "Forgejo not reachable" and attempt to restart the container.Environment
aeaef88+ later merges)FORGEJO__service__REQUIRE_SIGNIN_VIEW=trueFix
Add the FORGE_TOKEN to the reachability check:
This works on both locked-down and open forgejos because
Authorization: tokenwith an empty token is accepted as "anonymous" by forgejo when sign-in is not required, and with a valid token when it is.Alternative: hit an endpoint that is specifically designed to be public on forgejo (e.g.
/api/healthzif it exists — need to verify in the forgejo image being used).Context
Discovered while running
bin/disinto initas an idempotency experiment on harb-dev-box to see if it would create the missing ops repo. This was the very first step that failed. Patched locally to complete the experiment — filing for a permanent fix. Part of a cluster of ~9 init bugs found during that experiment.