madt_auth_use_ssh skips DirScope.resolve and can mutate a foreign primary checkout's remote #262
Labels
No labels
breaking
bug
documentation
enhancement
epic
good first issue
help wanted
refactoring
resolution/duplicate
resolution/invalid
resolution/wontfix
security
severity/critical
severity/high
severity/low
severity/medium
status/abandoned
status/blocked
status/needs-decision
status/needs-info
status/needs-verification
testing
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
sixfold-space/madtea#262
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?
Pre-release audit finding:
madt_auth_use_sshtakesdir=but is a documented no-resolve site - the handler passes the raw dir straight tosvcgit.RemoteUseSSH(internal/mcp/tools_auth.go:526-533; exemption recorded atinternal/mcp/tools_auth.go:44-50andinternal/parity/dirscope_drift.go:179-183).RemoteUseSSHitself performs no foreign-checkout check either.Consequence: the tool can flip the origin remote URL (HTTPS <-> SSH) of a FOREIGN PRIMARY checkout - mutating exactly the shared state ADR 0019 declares immutable. Blast radius is small (a reversible protocol flip of the same remote, no token exposure), but it breaks the checkout owner's HTTPS token-injection path and any hook expectations until flipped back, and it is the one dir-taking mutation that bypasses the guard chain every other tool routes through.
The recorded exemption rationale ("SSH auth is user-managed outside the HTTPS token model") justifies skipping credential resolution - it does not address the foreign-mutation angle at all.
Fix, either direction works:
DirScope.resolveand refuse foreign targets like the other local-git mutations do (drop the entry fromdirScopeNoResolveSites; the parity guard then enforces it), ordirscope_drift.goreason to cover the foreign-mutation angle.Option 1 seems right - there is no obvious use case for flipping a checkout you do not own.
Acceptance: either the tool refuses a foreign dir (with a test alongside the existing foreign-guard tests), or ADR 0019 + the drift-guard reason explicitly record the exemption.