fix(git): write a per-repo plaintext token only with recorded consent #611

Merged
hexajon merged 1 commit from fix/repo-token-needs-consent into main 2026-09-23 16:29:08 +00:00
Owner

Summary

With no secure backend, clone, init, and remote add wrote the token in plaintext into the repo's .git/config, even when it came from MADTEA_TOKEN and the user never passed --insecure-storage.

WriteRepoCredentials now writes the plaintext token only when a plaintext madtea.token exists in the global scope, which only auth login --insecure-storage writes. Without that consent it writes the URL and user only, and prints a notice that names the fix. madtea reads MADTEA_TOKEN on every run, so env setups keep working. A secure backend is unchanged.

New tests prove that no token reaches .git/config without consent for clone, remote add, and init. Each one fails with the check removed. The existing plaintext tests now record consent first.

ADR 0042 records the rule and refines ADR 0013.

Closes #610

Closes #610

## Summary With no secure backend, clone, init, and remote add wrote the token in plaintext into the repo's `.git/config`, even when it came from `MADTEA_TOKEN` and the user never passed `--insecure-storage`. `WriteRepoCredentials` now writes the plaintext token only when a plaintext `madtea.token` exists in the global scope, which only `auth login --insecure-storage` writes. Without that consent it writes the URL and user only, and prints a notice that names the fix. madtea reads `MADTEA_TOKEN` on every run, so env setups keep working. A secure backend is unchanged. New tests prove that no token reaches `.git/config` without consent for clone, remote add, and init. Each one fails with the check removed. The existing plaintext tests now record consent first. ADR 0042 records the rule and refines ADR 0013. Closes #610 Closes #610
fix(git): write a per-repo plaintext token only with recorded consent
All checks were successful
drift / govulncheck (pull_request) Has been skipped
drift / surface-diff (pull_request) Successful in 1m10s
drift / forgejo-smoke (pull_request) Has been skipped
ci / mcp-conformance (pull_request) Successful in 2m36s
ci / mcp-conformance (push) Successful in 7s
drift / govulncheck (push) Has been skipped
drift / surface-diff (push) Successful in -1s
drift / forgejo-smoke (push) Has been skipped
ci / gate (push) Successful in 14m32s
ci / gate (pull_request) Successful in 26m19s
2460e6b075
Closes #610
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sixfold-space/madtea!611
No description provided.