fix: dispatcher admin check fails — is_admin not visible to non-admin tokens #152
Labels
No labels
action
backlog
blocked
bug-report
in-progress
prediction/actioned
prediction/dismissed
prediction/unreviewed
priority
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#152
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?
Problem
The dispatcher checks if the PR merger is admin via
GET /api/v1/users/{username}and reads.is_admin. But Forgejo only exposesis_admin: truewhen the requesting user is also a site admin. The dispatcher usesFORGE_TOKEN(dev-bot, not admin), sois_adminalways appearsfalsefor everyone.Current workaround:
FORGE_ADMIN_USERSenv var with a static list of admin usernames. But this is fragile — it must be kept in sync manually.Fix
Two changes:
bin/disintogenerate_compose: addFORGE_ADMIN_USERSto the edge service environment, populated from the human user created during init. Format:FORGE_ADMIN_USERS: "disinto-admin,johba"(comma-separated).docker/edge/dispatcher.sh: changeis_user_admin()to use an admin token for the API check. The dispatcher already has access to vault secrets — addFORGE_ADMIN_TOKEN(the disinto-admin token) to the edge environment and use it for admin verification:Either approach works. The static list is simpler; the admin token is more correct.
Affected files
bin/disintogenerate_compose (add FORGE_ADMIN_USERS to edge env)docker/edge/dispatcher.sh(use admin token or static list)Acceptance criteria
disinto initregeneration