• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stacklok / toolhive / 24804357731
67%

Build:
DEFAULT BRANCH: main
Ran 22 Apr 2026 09:51PM UTC
Jobs 1
Files 657
Run time 2min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

22 Apr 2026 09:46PM UTC coverage: 66.279% (+0.04%) from 66.243%
24804357731

push

github

web-flow
Fix Cedar upstream-claim evaluation on VirtualMCPServer (#5002)

* Populate Cedar PrimaryUpstreamProvider for vMCP

VirtualMCPServer's operator converter never set
AuthzConfig.PrimaryUpstreamProvider, so Cedar policies that referenced
upstream claims (e.g. principal.claim_department) failed at runtime.
Cedar evaluated against the ToolHive-issued AS token rather than the
upstream IDP token, and the claim was missing.

Derive the field from Spec.AuthServerConfig.UpstreamProviders[0].Name in
convertIncomingAuth when an embedded auth server with upstream providers
is configured. Mirrors injectSubjectProviderIfNeeded in
virtualmcpserver_controller.go (outgoing auth) and
injectUpstreamProviderIfNeeded in pkg/runner/middleware.go (thv run
path). Leaves the field empty when no embedded AS or no upstreams so
Cedar correctly falls back to ToolHive-issued claims in those modes.

Fixes #4997

* Reject VirtualMCPServer authz without an upstream IDP

When IncomingAuth.AuthzConfig is set but no upstream IDP is configured,
Cedar silently evaluates policies against the ToolHive-issued AS token.
That token's claim namespace (sub, aud, tsid) can overlap upstream
claims and authorize against the wrong identity, so the misconfig must
be surfaced rather than deployed.

Add validateAuthzUpstreamAvailable to the VirtualMCPServer reconciler
chain. When AuthzConfig is set but AuthServerConfig is nil or
UpstreamProviders is empty, mark the server Failed and set
AuthServerConfigValidated=False with reason AuthzRequiresUpstream. The
user-facing message points at spec.authServerConfig.upstreamProviders,
which is where the fix belongs.

Extract runAuthValidations from runValidations so the auth-related
checks live together and gocyclo stays happy. No behavior change in the
moved block.

Belt-and-suspenders companion to the converter fix in the previous
commit: the converter wires the provider name when upstreams exist; this
validator makes the absence of upstreams an explicit failu... (continued)

73 of 80 new or added lines in 2 files covered. (91.25%)

16 existing lines in 6 files now uncovered.

58727 of 88606 relevant lines covered (66.28%)

61.42 hits per line

Uncovered Changes

Lines Coverage ∆ File
7
60.59
1.18% cmd/thv-operator/controllers/virtualmcpserver_controller.go

Coverage Regressions

Lines Coverage ∆ File
4
51.22
-0.38% pkg/workloads/manager.go
3
71.85
-1.11% pkg/ignore/processor.go
3
79.38
-0.77% pkg/transport/proxy/httpsse/http_proxy.go
2
93.94
-6.06% pkg/foreach/foreach.go
2
73.63
1.29% pkg/runner/config.go
2
94.77
-1.31% pkg/vmcp/composer/dag_executor.go
Jobs
ID Job ID Ran Files Coverage
1 24804357731.1 22 Apr 2026 09:51PM UTC 657
66.28
GitHub Action Run
Source Files on build 24804357731
  • Tree
  • List 657
  • Changed 11
  • Source Changed 3
  • Coverage Changed 11
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #24804357731
  • a75ea2c4 on github
  • Prev Build on main (#24803393891)
  • Next Build on main (#24805002006)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc