fix: fix: Forgejo API tokens rejected for git HTTP push — agents must use password auth (#361) #362
No reviewers
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: disinto-admin/disinto#362
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/issue-361"
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?
Fixes #361
Changes
AI Review
Summary
This PR correctly addresses Forgejo 11.x rejecting API tokens for git HTTP push by:
forge-setup.sh(password reset on each re-run, so always consistent with.env)FORGE_PASSinforge-push.shremote URLs instead ofFORGE_TOKENentrypoint.shso all worktree git ops use password authThe overall design is correct and the idempotency behavior (password reset on re-run) is explicitly handled.
Findings
minor
docker/agents/entrypoint.sh:122:chmod 755on the generated credential helper makes it world-readable, and the plaintext password is embedded in the file. In the container context onlyagentandrootexist, so practical exposure is low — butchmod 700would be safer and is conventional for credential files.minor
docker/agents/entrypoint-llama.sh: The llama entrypoint adds${FORGE_PASS:-${FORGE_TOKEN}}for the initial clone, but unlikeentrypoint.shit never sets up the git credential helper. Worktreegit fetchcalls in the llama container won't have password auth configured. Push is covered bypush_to_forge()embedding credentials directly in the remote URL, so this is only a gap for fetch operations from worktrees. Worth a follow-up but not blocking.Pre-existing (not introduced by this PR)
lib/forge-push.shhardcodesdev-botas the git username in the remote URL. Other bots sourcing this library with their ownFORGE_PASSwould authenticate with a mismatched username. This predates this PR and is out of scope here.Verdict
APPROVE — Correctly fixes Forgejo 11.x token rejection for git push by switching all agents to password-based HTTP auth; logic is sound and idempotent.
Reviewed at
daf9151| AGENTS.mdAI Review: APPROVE — Correctly fixes Forgejo 11.x token rejection for git push by switching all agents to password-based HTTP auth; logic is sound and idempotent.
AI Review
Summary
This PR fixes git push failures caused by Forgejo 11.x rejecting API tokens for HTTP git operations. The fix adds a
FORGE_PASSvariable per bot and wires it into the credential helper, clone URLs, and push URLs.Assessment
The overall approach is correct. Password auth is the right solution when API tokens are rejected for HTTP git push.
entrypoint-llama.sh
entrypoint-llama.sh:27: Fallback${FORGE_PASS:-${FORGE_TOKEN}}is safe;FORGE_TOKENremains a valid fallback for read-only clone ifFORGE_PASSis absent.entrypoint.sh (credential helper block)
\$1to avoid premature shell expansion — the generated script is syntactically correct.cat >/dev/nullto drain stdin properly follows the git credential helper protocol.dev-botwhen the API call fails is sensible.entrypoint.sh(credential helperchmod 755): The generated helper embeds the plaintext password and is world-readable/executable. In an isolated container this is low-risk, butchmod 700would be strictly safer since the password is stored in the file.forge-push.shboth referenceFORGE_PASS(dev-bot's password). Other bots haveFORGE_REVIEW_PASS,FORGE_PLANNER_PASS, etc. This is acceptable if only dev-bot performs git push, which aligns with the existing architecture.forge-push.sh
_assert_forge_push_globalsnow correctly requiresFORGE_PASS; hard failure on missing password is the right behavior.dev-bothardcoded in the auth URL is consistent:FORGE_PASSis specifically dev-bot's password per thebot_pass_varsmapping inforge-setup.sh.forge-setup.sh
bot_pass_varsassociative array cleanly maps each bot to its password env var.grep -q … sed -i … || printf …) correctly handles both first-run and re-setup scenarios.bot_passis already used to create the Forgejo account in the existing loop, so storing it to.envin the same iteration keeps them consistent.External action / vault / security scan
No external publish, deploy, or third-party API calls introduced. All changes are local container setup and forge-internal git operations — no vault dispatch required.
Verdict
APPROVE — Correct fix: switches git HTTP auth from API tokens to passwords per Forgejo 11.x requirements; logic is sound and conventions are followed
Reviewed at
daf9151| AGENTS.mdAI Review: APPROVE — Correct fix: switches git HTTP auth from API tokens to passwords per Forgejo 11.x requirements; logic is sound and conventions are followed