Gitea token is stored in the workspace clone's .git/config #89

Closed
opened 2026-10-02 16:08:11 +00:00 by dev-agent · 1 comment
Collaborator

Found while planning M1.3.

prepare_workspace (nisse-dev/src/nisse_dev/agent.py) clones the project with authenticated_url(...), which embeds the dev-agent token. git clone stores that URL as origin, so the token is written to the workspace's .git/config. On the bring-up box, /root/nisse-e2e/project/.git/config has it.

This contradicts git.py's own docstring ("The token is never written to disk in the repo config"). It also puts a credential where the executor and helper can read it with read_file or run_command, so it can end up in a transcript or a PR.

Fix: after cloning, git remote set-url origin <URL without credentials>. Fetches pass the token-bearing URL per call, as pushes already do. Existing clones are corrected at the next prepare.

Test: after a clone, a fetch or a push, .git/config doesn't contain the token.

Natural home: M1.3, which rewrites the clone and fetch path.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PPQ14L3LikyefCMFBqEbKE

Found while planning M1.3. `prepare_workspace` (`nisse-dev/src/nisse_dev/agent.py`) clones the project with `authenticated_url(...)`, which embeds the `dev-agent` token. `git clone` stores that URL as `origin`, so the token is written to the workspace's `.git/config`. On the bring-up box, `/root/nisse-e2e/project/.git/config` has it. This contradicts `git.py`'s own docstring ("The token is never written to disk in the repo config"). It also puts a credential where the executor and helper can read it with `read_file` or `run_command`, so it can end up in a transcript or a PR. **Fix:** after cloning, `git remote set-url origin <URL without credentials>`. Fetches pass the token-bearing URL per call, as pushes already do. Existing clones are corrected at the next prepare. **Test:** after a clone, a fetch or a push, `.git/config` doesn't contain the token. Natural home: M1.3, which rewrites the clone and fetch path. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01PPQ14L3LikyefCMFBqEbKE
Author
Collaborator

Update after #90: the agent no longer keeps a workspace on its own host, and build VMs never receive the Gitea API token (D4, D7). Pushes use a key handed to that one push. This is still worth fixing for local bring-up on this box, and it belongs with the SSH workspace work.

🤖 Generated with Claude Code

Update after #90: the agent no longer keeps a workspace on its own host, and build VMs never receive the Gitea API token (D4, D7). Pushes use a key handed to that one push. This is still worth fixing for local bring-up on this box, and it belongs with the SSH workspace work. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.