Hardening: repo-scoped-only client mode for dir-resolved services #264
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#264
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?
Security-audit follow-up, defense-in-depth. The dir= report carve-out (ADR 0027) borrows the target checkout's own credential via
GetConfigForDirand builds its service withgitea.NewClientWithConfig(cfg.URL, cfg.Token, "/repos/"+owner+"/"+repo)(internal/mcp/helpers.go:636). The repo-prefix narrows the repo-relative calls, but the constructedHTTPClientstill carries the full API surface -/user,/orgs,/admin, search - so the only thing keeping the borrowed token repo-scoped is that the four carve-out handlers happen to call only repo-scoped issue methods.The
getconfigfordirdrift guard pins the credential call sites, but it cannot catch a future edit that widens WHAT one of those handlers does with the client it already has - that would ship without tripping any guard.Proposal: a repo-scoped client mode for dir-resolved services that structurally refuses any request whose path is not under
/repos/{owner}/{repo}(constructor flag or wrapper type), so the boundary is enforced by the client rather than by handler discipline. A test asserting the refusal keeps it pinned.Not a live vulnerability today - the current handlers are verified repo-scoped - purely closing the future-edit gap.