bug(config): GetConfigForDir never reads the target dir's own repo-local token — the ADR 0019/0027 contribute flow fails for repo-config-authed clones #94
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#94
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?
Observed 2026-07-15 while landing ADR 0027 (PR #92): the sanctioned foreign-contribution flow (ADR 0019: worktree →
madt_finish dir= branch=) failed against a target checkout whose token lives in repo-local git config — which is exactly how that clone is authed (its ownmadtea auth whoamireportsSource: repo configand authenticates fine). The finish had to fall back to the CLI run from inside the target checkout.Cause:
GetConfigForDir(internal/config/resolve_dir.go:54) resolves the URL from the target dir's chain (dir-localmadtea.url→ origin → global) but delegates the token toGetConfigForURL, which consults only the env override and the host-keyed secure backend. It deliberately skips the process cwd's plaintextmadtea.token— correct, that's ADR 0025's anti-cross-forge-reuse rule — but the target dir's own repo-localmadtea.tokenis skipped as collateral. No code path readsrunGitDir(dir, "config", "--local", "--get", "madtea.token").Under ADR 0027 that's backwards for the sanctioned crossings: the target checkout's own repo-scoped credential is the most scope-coherent source there is — it's that clone doing precisely its configured job against its own origin (the same coherence argument that admits the carve-outs at all). The cwd's token must stay excluded; the dir's own must be admitted.
Fix: in the
GetConfigForDirchain, after the secure-backend miss, read dir-localmadtea.token(andmadtea.user) from the target repo's--localgit config scope, paired with the URL already resolved from that same dir. Never the merged/global view (a global plaintext token is the cwd-adjacent reuse case), never another repo's local scope. The per-dir cache already isolates the result.Acceptance:
madt_finish dir=<foreign clone> branch=<b>succeeds when the target's token is stored repo-locally (today's failure), demonstrated against a clone with no secure-backend entry for its host.Refs ADR 0027 (carve-out 1 is unusable for repo-config-authed targets without this), ADR 0025, #93 (the masking that hid this), #90 (the enforcement work should treat dir-local-token-for-dir's-own-origin as the sanctioned shape).