stacklok / stacklok/toolhive

Discovered-mode outgoing auth: should an explicit per-backend override win over discovered auth?

Open
#6,329 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs-triage
Dominant language
Go
Stars
2.2k
Forks
300
Avg merge
1d 15h
Merged PRs (30d)
184

Description

Context

Split out of the #6242 review, where this was (rightly) flagged as a behaviour change that should not be settled as a side effect of a PR about reporting unsupported auth types.

Current behaviour

With VirtualMCPServer.spec.outgoingAuth.source: discovered, auth discovered from the backend resource's own externalAuthConfigRef wins over an explicit per-backend entry in spec.outgoingAuth.backends. The explicit entry only takes effect as a fallback when the backend has no discovered auth (pkg/vmcp/aggregator/discoverer.go, applyAuthConfigToBackend).

Question

Is that the intended precedence? An operator who writes an explicit entry for a specific named backend arguably expresses stronger intent than the backend's own declaration — that is how per-backend overrides read elsewhere in the config. On the other hand, the backend resource's declaration is maintained closest to the backend, and letting the vMCP spec override it means a vMCP author can point a backend at a different credential than its owner configured — which may be exactly the point, or exactly the problem, depending on the trust model between the two roles.

Whichever way this lands, it decides which credential a live backend authenticates with, so it deserves its own decision (and probably a note in the VirtualMCPServer docs about which side wins and why). The first revision of #6242 implemented override-wins together with an ExplicitBackends marker to distinguish operator-written entries from discovery-populated ones in the generated config; that implementation was reverted per review but can serve as a reference point.

Related

  • #6242 (review discussion)
  • #5930 (the unsupported-type reporting this was split from)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in pkg/vmcp/aggregator/discoverer.go at applyAuthConfigToBackend, then read the linked #6242 review and #5930 for the existing behavior and reverted approach. Done means a precedence decision is recorded, the selected behavior is covered in the relevant implementation, and the VirtualMCPServer documentation explains which auth declaration wins and why.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
authentication
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.