Repository navigation
Merge upstream v0.49.0 into dp-stable (PAIINFRA-249) - #31
Conversation
* Support OIDC dynamic client registration OIDC-typed upstreams could not use Dynamic Client Registration, even when their discovery metadata exposed a registration endpoint. This forced operators to use the more verbose OAuth2 form and prevented issuer-based OIDC configurations from working with providers such as connector-gateway. Add DCR configuration and validation to OIDC runtime and CRD types, derive the standard discovery URL from the issuer when needed, and route both OAuth2 and OIDC upstreams through the shared DCR resolver. Propagate registered credentials into the OIDC provider, update secret bindings and generated manifests, and cover the adapter behavior with tests. Fixes stacklok#6538 * Fix CI: reduce complexity, wrap long lines, regen swagger buildUpstreamConfigs exceeded the cyclomatic complexity limit (19 > 15); split its per-upstream loop body into buildOneUpstreamConfig, validateUpstreamRunConfig, resolveUpstreamDCR, and applyDCRResolutionToConfig. Also wrap two lines that exceeded the line-length limit, and regenerate docs/server/swagger.* to include the new dcr_config field on OIDCUpstreamConfig. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* Fail closed on malformed list responses * Clarify template filtering test
Update issue triage workflow model to claude-sonnet-5 Co-authored-by: Dan Barr <6922515+danbarr@users.noreply.github.com>
Use Basic auth for OAuth2 upstreams (stacklok#6536) Some upstream identity providers require client_secret_basic for confidential clients and reject credentials sent in the token request body. Add token_endpoint_auth_method to OAuth2UpstreamRunConfig, default it to client_secret_basic when a secret is configured, and pass it through buildPureOAuth2Config so the existing authStyleFromMethod selects HTTP Basic while explicit client_secret_post and DCR-negotiated methods remain supported. Also validates that a confidential method (client_secret_basic/client_secret_post) has an actual secret source configured, and that the resolved secret isn't empty, and exposes the field on the operator's OAuth2UpstreamConfig CRD type so operator-managed upstreams can select client_secret_post instead of always being forced to the client_secret_basic default. Fixes stacklok#6536
* Honour a pinned cosign key on plugin sync/upgrade Signed-off-by: Samuele Verzi <samu@stacklok.com> * Split unsigned from keyless in keyed upgrades A key-pinned entry whose candidate lost its signature was reported as a signer change, whose remedy is --allow-signer-change. That override bypasses the guard but not verification, and upgrade has no unsigned-consent flag to pair with it, so the install failed unsigned-rejected one step later. Report the rejection directly and name the route that works. A candidate that moved to keyless signing is still a signer change, but it now carries the identity it moved to: the CLI infers "unsigned" from an absent NewSignerIdentity, so an unnamed one was rendered as the one thing it is not. Signed-off-by: Samuele Verzi <samu@stacklok.com> * Probe keyless before failing a keyed candidate VerifyOCIWithKey reports ErrKeylessSigned only when every attached bundle is keyless, so an artifact mid-migration — a valid keyless bundle beside a stale key-pair one — arrived as ErrSignatureInvalid and was sent to uninstall-and-reinstall. It is the supported key-to-keyless transition, so verify the candidate keylessly before naming a diagnosis. Restrict the signature-invalid verdict to ErrSignatureInvalid. Registry, transport, and context failures say nothing about a signature, and advising an uninstall over a network blip is destructive. Narrow --allow-signer-change per entry. It is project-wide, so needing it for one plugin dropped the pin on every key-pinned plugin beside it, and resolveKeyAnchor then sent a still-key-signed candidate through keyless verification, which fails ErrKeySigned. An entry whose candidate still verifies against its pin keeps it. Signed-off-by: Samuele Verzi <samu@stacklok.com> * Refuse to drop a key pin on an unproven mismatch A failed keyed verification was treated as evidence the candidate had moved off its pinned key. Under a project-wide --allow-signer-change that is enough to drop the pin, so a registry, transport, or context fault let an artifact still carrying a valid signature by the pinned key be re-anchored to keyless. Only the verifier's own signature verdicts settle the question, so an operational failure now stops the upgrade before the keyless probe runs, in both modes. Measure the candidate once and share the verdict between the guard and the override, so the two cannot disagree about what it is. Name a reinstall a caller can run. install requires the plugin argument and defaults to user scope, where --public-key is rejected outright and --allow-unsigned records nothing, so the bare flag was refused before it verified anything. Signed-off-by: Samuele Verzi <samu@stacklok.com> --------- Signed-off-by: Samuele Verzi <samu@stacklok.com>
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.83.1 to 1.83.2. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](grpc/grpc-go@v1.83.1...v1.83.2) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-version: 1.83.2 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Evict vMCP sessions when a backend is dropped When a backend is removed from a vmcp.DynamicRegistry (a generation swap), any already-open per-session connection to that backend — most visibly a long-lived SSE server-push stream — persisted until the owning client session ended. New routing stopped correctly, but the component that dropped the backend had no way to reclaim the live connection. Reuse the existing lazy-eviction/RestoreSession machinery rather than mutating a live session in place (vMCP anti-pattern #10): - Add ValidatingCache.RemoveMatching for predicate-based bulk eviction. - Add SessionManager.EvictStaleSessions, which evicts every live session holding a backend absent from the registry; onEvict closes its backend connections and the next request rebuilds it without the dropped backend via RestoreSession. - Watch the DynamicRegistry version in reconcileSessionsOnRegistryChange and evict on change, independent of status reporting. Implements stacklok#6546. * Address review: quieter eviction, shorter lock hold - Log routine session eviction at DEBUG, not WARN: a generation swap is an expected transition and the session is recoverable via restore, so a per-session WARN burst was noise (a real close failure still WARNs). - RemoveMatching now snapshots candidate keys, then acquires the cache lock once per entry instead of holding it across the whole scan, so a bulk eviction's connection teardown no longer starves new-session creation for the full burst. - Document the residual concurrent-restore window in EvictStaleSessions: a session mid-restore when the drop commits falls back to the original session-lifetime bound, never worse. * Test RemoveMatching phase-2 re-check and concurrency Cover the split-lock rework's phase-2 guard directly: a key selected in the snapshot whose predicate flips to false before removal must be left in place, not counted, not closed. Add a -race concurrency smoke test running RemoveMatching alongside Set/Get to pin the no-deadlock, no-panic guarantees. * Run cache onEvict off the lock during eviction Addresses stacklok#6549 review comments: - HIGH pkg/cache/validating_cache.go (3960349464): RemoveMatching held the cache lock while sess.Close() ran synchronously via the LRU eviction callback, so a hung just-dropped backend could block Get/Set for every session on the node. The LRU callback now only buffers evicted entries; every mutating path drains the buffer and invokes the user onEvict after releasing the lock, so onEvict never runs under the cache lock (all paths). - LOW pkg/cache/validating_cache.go (3960349496): tighten the RemoveMatching doc to state onEvict runs off the lock, and add a slow-onEvict test proving an unaffected key's Set completes while a slow eviction is in flight. * Inject reconcile poll interval to fix test data race Addresses stacklok#6549 review comments: - HIGH pkg/vmcp/server/session_reconcile_test.go (3960349452): the new reconcile test and the pre-existing status-reporting test both ran under t.Parallel() and mutated the shared package-level versionPollInterval, a genuine data race that poisoned the whole -race package run. reconcileSessionsOnRegistryChange now takes the poll interval as a parameter (Start passes versionPollInterval); the test passes its own value and no longer touches the package var. * Share backend-ID parsing and quiet eviction log Addresses stacklok#6549 review comments: - MEDIUM pkg/vmcp/server/sessionmanager/session_manager.go (3960349470): extract vmcpsession.ParseBackendIDs next to the MetadataKeyBackendIDs constant as the single decoder for that wire format, and use it from both filterBackendsByStoredIDs and referencesMissingBackend instead of re-implementing the split/trim/skip-empty parse in two packages. - MEDIUM pkg/vmcp/server/sessionmanager/session_manager.go (3960349474): EvictStaleSessions logged its aggregate eviction count at INFO, which contradicts this PR's adjacent WARN->DEBUG downgrade of the same event and the "INFO sparingly" convention; lower it to DEBUG. * Fix codespell: paniced -> panicked in cache test
* Add dial-control option to vMCP session factory Session-init backend connections opened by MultiSessionFactory used http.DefaultTransport with no net.Dialer.Control hook, and NewSessionFactory exposed no way to inject one -- unlike the per-call backend client (pkg/vmcp/client), which already offers WithDialControl. An embedder guarding backend-client dials against SSRF / DNS-rebinding therefore could not guard the session-init dials. Implements changes for issue stacklok#6545: - Add session.WithDialControl MultiSessionFactoryOption, wired into NewSessionFactory - Add backend.WithDialControl HTTPConnectorOption and a backendBaseTransport helper; thread the hook through createMCPClient for both streamable-http and sse transports - A nil control returns http.DefaultTransport unchanged, keeping the dial path byte-for-byte identical - Tests: a deny-all control yields zero backend requests at session init for both transports; a nil control leaves DefaultTransport untouched Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Centralize backend transport construction in networking Address code review: the dial-control base transport was duplicated between pkg/vmcp/client and the new session connector, kept in sync only by a comment (review M1), risking drift of the shared dial timeouts and clone logic. - Add networking.CloneDefaultTransportWithDialControl as the single construction point for the vMCP backend transport (clone-or-reconstruct plus the optional dial-control dialer) - Have both pkg/vmcp/client.newBackendTransport and the session connector's backendBaseTransport call it; delete the now-redundant backendDialer in the client - Document the pooled-connection safety argument in the session option doc for parity with the client option (review L1) - Cover the shared helper directly in pkg/networking Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Group connector params and restore dial-control docs Addresses stacklok#6547 review comments: - MEDIUM mcp_session.go (3960204428): fold createMCPClient's trailing option params (sink, dialControl, requestTimeout) into an mcpClientParams struct so the two adjacent nil-able func members cannot be silently transposed at call sites - MEDIUM mcp_session.go (3960204343): restore the "no per-request re-classification" sentence and the OWASP SSRF Cheat Sheet citation in WithDialControl's caveat docs, for parity with pkg/vmcp/client - MEDIUM http_client.go (3960204434): reword CloneDefaultTransportWithDialControl's doc generically instead of naming vMCP inside the dependency-free package Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Strengthen dial-control test coverage Addresses stacklok#6547 review comments: - MEDIUM mcp_session_dialcontrol_test.go (3960204415): record that the dial-control hook fired (atomic.Bool) so an unrelated earlier failure cannot pass the guarded test for the wrong reason - MEDIUM factory_dialcontrol_test.go (3960204421): add a RestoreSession dial-control test, covering its distinct filtering/identity-binding path - MEDIUM factory_dialcontrol_test.go (3960204451): add a two-backend test proving the control is applied per-backend (one blocked, one allowed) - MEDIUM backend_transport_test.go (3960204445): cover the reconstruction branch taken when http.DefaultTransport is not a *http.Transport, via a non-parallel test that saves/restores the global Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
) * Guard refresh-token writes with compare-and-swap Two Connector Gateway replicas sharing the same Redis-backed UpstreamTokenStorage can redeem and persist the same single-use, rotating refresh token concurrently. The in-process singleflight group only deduplicates refreshes within one process, and StoreUpstreamTokens is an unconditional overwrite, so the losing replica's write can silently clobber the winner's already-rotated token and dead-end the refresh chain. Add UpstreamTokenStorage.CompareAndSwapUpstreamTokens, conditioned on the refresh token currently stored matching the value the caller just redeemed with. The refresher now writes through it instead of StoreUpstreamTokens: a losing write fails with ErrConcurrentRefresh instead of overwriting, and the refresher re-reads the row to hand back the winning replica's tokens (or a clear error if no usable winner exists) rather than retrying an already-dead redemption. * Address review: dedupe CAS script, richer errors, more tests - Unify storeUpstreamTokensScript and casUpstreamTokensScript's write/index Lua body into one shared constant instead of a hand-duplicated copy, so the two scripts cannot silently drift. - Include the re-read error in resolveConcurrentRefreshConflict's log and returned error instead of discarding it. - Fix a stale comment still naming StoreUpstreamTokens on a path that now writes through CompareAndSwapUpstreamTokens. - Add a timeout guard to the concurrent Redis CAS test's WaitGroup, matching this file's existing pattern. - Add coverage: empty-expected-value CAS against an already-populated row (both backends), the "re-read succeeds but still expired" conflict-resolution branch, and session-index/TTL/user-reverse-index assertions on a successful Redis CAS write. - Update docs/arch/11-auth-server-storage.md's "Refresh Coordination Scope" section, which stated no cross-process CAS guarantee existed. * Address second review: soften CAS claims, split race/absence logs - Soften the "makes concurrent redemption safe across processes" claim to what CAS actually guarantees: a deterministic stored row, not provider-level safety against two redemptions of a strict single-use rotating refresh token. Both replicas still call the provider before either write lands, so a provider with no grace/leeway window can still see and revoke a genuine replay regardless of which write wins here; closing that gap needs a lock around the whole read-redeem- write sequence, tracked as a follow-up. Reworded the type-level doc comment, the expectedRefreshToken comment, the interface docs on CompareAndSwapUpstreamTokens/ErrConcurrentRefresh, and the architecture doc accordingly. - resolveConcurrentRefreshConflict now distinguishes, on re-read, a genuine lost race (an unexpired row) from a row that simply no longer exists (ErrNotFound - deleted by logout, evicted by TTL): the latter logs at Warn instead of Error, so on-call isn't paged for a legitimate deletion. Added a log-level test proving this. - Reduced the conflict re-read's timeout from refreshTimeout (30s, already the caller's own budget) to a new upstreamConflictReadTimeout (5s), so a stacked re-read no longer doubles the worst-case wait. - Added a security-positive test (both backends): CAS refuses to resurrect a row deleted between read and write, unlike the unconditional StoreUpstreamTokens. - Corrected test/interface-doc comments claiming an empty expected value "only matches a genuinely absent row" - it also matches a present row with an empty RefreshToken or a nil-tokens row. * Match casUpstreamTokensScript comment to the softened CAS claim The Lua script's doc comment still said CompareAndSwapUpstreamTokens is "safe for redeeming" a rotating refresh token across replicas - the exact overclaim already softened in the type-level comment, the interface doc, and the architecture doc. Reworded to match: CAS makes the stored row deterministic, which is a storage-ordering guarantee, not a guarantee that redemption itself is safe at the provider.
* Make proxy read timeout configurable Signed-off-by: Sanskarzz <sanskar.gur@gmail.com> * Preserve configurable proxy read timeout Signed-off-by: Sanskarzz <sanskar.gur@gmail.com> * Preserve proxy read timeout configuration Signed-off-by: Sanskarzz <sanskar.gur@gmail.com> --------- Signed-off-by: Sanskarzz <sanskar.gur@gmail.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Chris Burns <29541485+ChrisJBurns@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Update setup and language actions Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
* Add SPIFFE client authentication dispatch X.509-SVID (stacklok#6202) and JWT-SVID (stacklok#6203) client authentication both replace the same fosite ClientAuthenticationStrategy: one dispatches on an assertion type in the request form, the other on a SPIFFE ID placed in the request context by an mTLS listener. Introducing that hook once, before either lands, keeps both credential types resolving through a single path so they cannot grow divergent principals. Behaviour is unchanged. Both SPIFFE arms return invalid_client with a not-implemented hint, and everything else falls through to fosite's default strategy, so RFC 7523 jwt-bearer and secret-based client authentication are untouched. The strategy is installed after NewOAuth2Provider because the default strategy is a method on the provider and fosite reads the config field per request. Also restores the fail-closed token-endpoint coverage that was reduced to principal-equivalence assertions, and renames those assertions to match what they check. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * Break SPIFFE resolver import cycle Both client-authentication arms must resolve a verified SPIFFE ID through SPIFFEAssociationRegistry.Resolve, but the registry lives in package authserver and the strategy in package authserver/server, which authserver already imports. The strategy could not reach it. Left unresolved, stacklok#6202 and the divergence this dispatch exists to prevent. The two arms, built independently on the pre-resolver base, converged on the same shape: a function type in package server returning fosite.Client (what fosite.ClientAuthenticationStrategy needs), implemented as a closure built in server_impl.go where the association registry and storage are already in scope. A resolver interface returning a principal was a dead end here since the strategy still needs a fosite.Client. Adopt that shape as server.SPIFFEClientResolver, covering both X.509 and JWT with an explicit method discriminator so a single resolution path is structural, not just tested. spiffeID is passed as an explicit parameter rather than smuggled through context, so it can't be mistaken for one pulled from the wrong source. AuthorizationServerParams also gains X.509 and JWT bundle-source fields, unread for now, so both arms land on one shared field instead of each extending the struct on their own. Move the three types Resolve touches into the spiffeauth leaf package, which both sides can import, and leave type aliases behind so the existing references across the tree are unchanged. A nil registry is never boxed into a non-nil func value: that would defeat the guard below. When no resolver is configured the dispatch delegates to the default strategy, so a server without SPIFFE trust behaves exactly as it did before. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * Fix gci formatting flagged by Linux CI runner Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * Resolve SPIFFE client identity from association when unset Resolve() required a non-empty client ID to match byClientID, so the documented empty-client-ID case (derive the client purely from the SPIFFE identity) could never succeed, and the resolver closure loaded storage with the caller's original client ID instead of the one Resolve actually selected. Also reject overlapping association patterns at construction, since resolving an unset client ID no longer has an ownership check to catch an ambiguous match picked by random map iteration order. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * Detect SPIFFE assertion type regardless of form order form.Get only returns the first value for a repeated form key, so a client_assertion_type list with a non-SPIFFE value first and the SPIFFE JWT type second fell through to the default strategy instead of being rejected. This violates stacklok#6199's invariant that a SPIFFE- shaped credential must not silently downgrade to another authentication method. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* Refuse a remote caller's private key on push POST /api/v1beta/skills/push accepts a cosign private-key path that THIS process opens, so an arbitrary caller could have the server sign and publish an artifact with any key it can read — a signature indistinguishable from a legitimate release. The default API mode assigns every request a synthetic local identity with no credential check, and a non-loopback bind gets no Origin allowlist either, so an unauthenticated remote caller reaches the handler. Accept a key only from a caller on this machine: an IPC listener vouches for its peer, and a TCP peer must be loopback. Anything else fails closed and is pointed at keyless signing, whose credential is short-lived and scoped. The decision rests on the listener and on RemoteAddr, never on a header. A key was never reliably usable remotely anyway: the path has to exist on the server's filesystem. Signed-off-by: Samuele Verzi <samu@stacklok.com> * Require capability for private key signing Signed-off-by: Samuele Verzi <samu@stacklok.com> * Name the CLI flag in the key-signing refusal The 403 for a key-bearing push without the discovery capability told the caller to sign keylessly "with identity_token". That is the JSON request field, and the CLI relays the server body verbatim, so a user of thv skill push --key was pointed at an option that does not exist. Offer the two runnable paths first (drop --key, or --identity-token) and keep the request field for direct API callers. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Samuele Verzi <samu@stacklok.com> --------- Signed-off-by: Samuele Verzi <samu@stacklok.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
thv skill upgrade skipped the signer guard entirely whenever --allow-signer-change was passed, so the project-wide override dropped a still-valid key pin on every key-pinned skill, and a transient verifier fault during planning was enough to re-anchor an artifact that still carried a good signature by the pinned key. The keyed guard also called an unsigned candidate a signer change, sending the user to a flag that cannot help since upgrade has no unsigned-consent flag, and diagnosed a mid-migration artifact as a damaged signature without probing whether it had moved to keyless. Mirror the verdict design already reviewed for thv ai-plugin upgrade: measure the candidate against the pin once, treat only a conclusive mismatch plus a verifying keyless signature as a move, fail everything undecided in both modes, and narrow the override per entry so needing it for one skill does not unpin the rest. Remediation text now names a runnable project-scoped reinstall. Signed-off-by: Samuele Verzi <samu@stacklok.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
* Update module github.com/getsentry/sentry-go to v0.49.0 * Adapt to Sentry privacy configuration --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Radoslav Dimitrov <radoslav@stacklok.com>
Update release files Release-Triggered-By: JAORMX Co-authored-by: toolhive-release-app[bot] <280093410+toolhive-release-app[bot]@users.noreply.github.com>
…acklok#6567) * Generalize vMCP session dial-control into a per-workload resolver PR stacklok#6547 added session.WithDialControl / backend.WithDialControl: a single, address-blind net.Dialer.Control hook applied to every backend's session-init dials. Because the hook receives only (network, address, RawConn), an embedder cannot vary the dial policy per backend. Enterprise connector-gateway needs a per-backend dial policy at session init (some backends opt into private-IP dialing, most don't), which the single hook cannot express. stacklok#6547 is merged but not yet in any release tag, so this generalizes that option in place rather than adding a second one alongside — one option, not two. - Replace session.WithDialControl with WithDialControlResolver, a func(workloadID string) func(network, address string, c syscall.RawConn) error, mirroring the sibling WithRevisionLookup / WithRequestTimeoutResolver options. - Replace backend.WithDialControl (HTTPConnectorOption) likewise; the connector resolves the per-workload hook in NewHTTPConnector's closure (where the target is known) and threads the already-resolved hook through mcpClientParams, so createMCPClient and backendBaseTransport are unchanged. - Preserve the no-hook invariant exactly: a nil resolver, or a resolver that returns nil for a workload, leaves that backend's transport on http.DefaultTransport — byte-for-byte identical to the no-hook path. Required by enterprise connector-gateway (stacklok/stacklok-enterprise-platform#3313). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Clarify WithDialControlResolver docs and align param name Addresses stacklok#6567 review comments: - MEDIUM mcp_session.go (3970572745): document that the resolver only selects a hook; the returned hook must inspect the resolved address or it gives no SSRF/DNS-rebinding protection (mirrored in factory.go) - MEDIUM mcp_session.go (3970572769): scope the client.WithDialControl "twin"/"counterpart" framing to the returned hook's signature and note the client option is not yet per-backend (mirrored in factory.go) - LOW mcp_session.go / factory.go (3970572781): rename the option parameter resolve -> resolver to match the sibling WithRequestTimeoutResolver * Isolate a panicking dial-control resolver; cover restore + concurrency Addresses stacklok#6567 review comments: - MEDIUM mcp_session.go (3970572761): recover a panicking per-workload resolver via resolveDialControl so it is isolated to that backend (excluded like any init failure) instead of crashing the per-backend init goroutine and the process; covered by a factory test proving the surviving backend still connects - MEDIUM factory_dialcontrol_test.go (3970572752): add a RestoreSession per-backend-keying test (deny one of two workloads; assert the allowed one survives restore and the denied one is excluded) - LOW factory_dialcontrol_test.go (3970572776): add a -race barrier test proving the resolver is invoked concurrently across the per-backend init goroutines --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…tacklok#6551) * Support no-auth Redis for the embedded auth server Redis-backed storage could only connect to Redis/Valkey with a password: a nil ACLUserConfig was a hard error and the password was mandatory. This blocked legitimate no-auth deployments (local/dev, network-isolated, managed tiers provisioned without ACL users). Make no-auth a selectable mode while keeping a misconfigured credential a loud failure rather than a silent downgrade. The split is on presence of the config block: - convertRedisACLConfig: a nil ACLUserConfig now resolves to empty credentials with no error (no-auth). A populated block whose password resolves to empty is still rejected as a misconfiguration. - Emit exactly one startup WARN naming the store on a no-auth resolution, for both the embedded auth server storage and the vMCP Redis session storage (previously an unconditional INFO). - Update RedisRunConfig doc comments to state a nil ACLUserConfig is a valid no-auth configuration. Implements stacklok#6550. * Address review: WARN placement, comment, test asserts - Move the no-auth WARN to after the fallible timeout/TLS conversion steps so it only fires for a config that will actually connect. - Reword the WARN rationale comment to describe a reachable caller path rather than an operator scenario the CRD currently forbids. - Assert the distinctive WARN message substring instead of the generic level=WARN token, so an unrelated WARN cannot skew the count. * Harden auth-server Redis no-auth validation and tests Addresses stacklok#6551 review comments: - MEDIUM config.go (3960523215): reject auth_type "aclUser" with a nil ACLUserConfig in convertRedisRunConfig, restoring fail-loud for declared authenticated intent that carries no credential config - LOW embeddedauthserver.go (3960523247): return the actionable "omit acl_user_config" guidance for a populated ACL block with no password_env_var, instead of resolveEnvVar's generic message - MEDIUM embeddedauthserver_test.go (3960523224): add a miniredis no-auth connect test that builds storage via createStorage and proves a real round-trip against an unauthenticated Redis - MEDIUM embeddedauthserver.go (3960523239): add a Sentinel-mode subtest exercising redisStoreName's "sentinel:<master>" branch * Align vMCP session-storage log schema and add WARN test Addresses stacklok#6551 review comments: - MEDIUM server.go (3960523264): emit a "store" attribute on the vMCP session-storage WARN/INFO so a log-based alert can match one key across both Redis consumers (the embedded auth server already uses "store") - LOW serve_session_test.go (3960523253): add the "authenticated resolution emits no WARN" counterpart test, mirroring the auth-server package's symmetry * Regenerate Swagger docs for Redis config comments The AuthType / ACLUserConfig doc-comment updates in pkg/authserver/storage/config.go feed into the generated OpenAPI docs via the storage.ACLUserRunConfig schema. Run task docs so the committed docs/server/swagger.{json,yaml} and docs.go match, fixing the Verify Swagger Documentation CI check. * Correct AuthType doc comment and regenerate Swagger Addresses stacklok#6551 review comments: - LOW config.go (3961856029): the AuthType doc claimed the conversion code does not branch on the field, but convertRedisRunConfig now rejects auth_type "aclUser" with a nil ACLUserConfig. Update the comment to describe that and regenerate the OpenAPI docs it feeds. * Fail loud on set-but-empty vMCP session Redis password Addresses stacklok#6551 review comments: - MEDIUM server.go (3961856031): use os.LookupEnv so buildSessionDataStorage distinguishes an unset THV_SESSION_REDIS_PASSWORD (intended no-auth, WARN) from a set-but-empty one (mis-keyed/emptied secret, now a hard error), mirroring convertRedisACLConfig instead of silently downgrading the session store to no-auth - LOW serve_session_test.go (3961856039): capture at LevelInfo and assert the "using Redis session storage" INFO line so the authenticated-path test actually covers what it claims, not merely the absence of the WARN; add a set-but-empty error test and switch the no-auth test to an unset var
…ok#6377) * Skip no-op VirtualMCPServer Deployment updates statusReportingInterval requeues were treated as drift when a user PodTemplateSpec left extra labels on the live template. Compare pod-template metadata as a subset and use semantic env equality so generation stops bumping every interval. The extra full-template DeepEqual skip-write gate is omitted: API-server defaulting makes it unreachable, and the subset plus semantic-env checks already prevent the write. Fixes stacklok#6340 Co-authored-by: Ravi Tharuma <RaviTharuma@users.noreply.github.com> * Fix Update's typo in drift comment Copilot asked to drop the apostrophe so the comment reads "updates the Deployment" instead of "Update's". Co-authored-by: Ravi Tharuma <RaviTharuma@users.noreply.github.com> * Compare rendered vmcp labels and env Controller-only pod-template labels missed user PodTemplateSpec keys, so a deleted tenant label looked like steady state. Env comparison used pre-merge controller env and treated API defaults (Optional, FieldRef.APIVersion) as drift. Compare the fully rendered desired set after PodTemplateSpec merge, keep subset semantics for extra live keys, and normalize known API defaults. Co-authored-by: Ravi Tharuma <RaviTharuma@users.noreply.github.com> * Align env-sort comment with comparison helper The container env drift check no longer uses reflect.DeepEqual; keep the nearby comment accurate so future edits do not restore the wrong comparator. Co-authored-by: Ravi Tharuma <RaviTharuma@users.noreply.github.com> * fix(operator): look up vmcp by name and normalize FileKeyRef.Optional Chris MEDIUM on stacklok#6377: sidecars can precede Containers[0], and K8s 1.35 defaults FileKeyRef.Optional to false on the live Deployment. --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Ravi Tharuma <RaviTharuma@users.noreply.github.com>
TestCreateStorage_NoAuthRedisConnects calls miniredis.RunT without the import, so pkg/authserver/runner fails typecheck and the whole package's tests fail to build. Lint and Tests are red on main.
…k#6528) * Restore --key on thv ai-plugin push Plugin push was made keyless-only because a key-signed artifact could not be installed project-scoped: verification found the bundle, failed it as key-signed, and --allow-unsigned did not apply. The flag could only publish plugins nobody could consume, so it was removed rather than documented as a trap. Install-time key verification now exists. A key-signed plugin installs with --public-key, the key is pinned in the lock entry, sync re-verifies the stored bundle against it offline, and upgrade applies it to the candidate — so publishing one is no longer a dead end and the flag can come back. PushOptions is an alias of skills.PushOptions again; the distinct struct existed only to omit Key. The push DTO, the Go client, and validateSigningInputs carry the key arm the skills surface already has, and the endpoint keeps rejecting unknown fields with key now among the known ones. Fixes stacklok#6442. Signed-off-by: Samuele Verzi <samu@stacklok.com> * Say where thv ai-plugin push --key is resolved The path is opened by the thv serve process that signs, not by the CLI, so against a remote server the advertised command fails unless the key file and COSIGN_PASSWORD are both provisioned on that host. Signed-off-by: Samuele Verzi <samu@stacklok.com> * Guard plugin push against a remote caller's key Same guard as skills/push, which the commit below adds: a private-key path is resolved by the thv serve process, so a remote caller naming one would be asking the server to sign with a key it never supplied. Signed-off-by: Samuele Verzi <samu@stacklok.com> * Require capability for plugin key signing Carry the protected discovery capability through the plugin API client and require it before dispatching a key-bearing push. Keep the capability off non-key requests and protect it from plaintext remote transports and redirects. Update the CLI, OpenAPI, architecture docs, and regression coverage to reflect that server-side keys are available only through automatic local discovery. Signed-off-by: Samuele Verzi <samu@stacklok.com> * Validate plugin push signing choice at the API The push endpoint documents that exactly one of key, identity_token, or no_sign is required, but the handler only checked reference before dispatching. The contract was held by pluginsvc alone, so a request naming only a reference was a 204 against any other PluginService implementation, and the route test pinned that behavior. Lift the validator into pkg/plugins as ValidatePushSigning and run it in the handler before the capability guard and dispatch. The service keeps calling it for in-process callers. The reference-only route test now expects 400, and a conflicting-choice case is added alongside it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Samuele Verzi <samu@stacklok.com> --------- Signed-off-by: Samuele Verzi <samu@stacklok.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
The keyless signer guard reported an unsigned candidate as a signer change, so the CLI pointed at --allow-signer-change. That flag cannot resolve it: upgrade has no unsigned-consent flag, and the override re-verifies from scratch, which an unsigned artifact fails just the same. On plugins that was a dead end with a misleading remedy. On skills it was worse: the override cleared the lock expectation, and isAllowedUnsigned granted any lock-driven install with no expectation, so `thv skill upgrade --allow-signer-change` silently turned a signer-pinned skill into an unsigned entry with no --allow-unsigned ever given. Run the guard in both modes and waive only the identity-change arm under the override; unsigned and unverifiable candidates fail either way, naming the project-scoped reinstall that records the exception. Narrow the override to entries that record a signer, since an anchorless entry has nothing to change, and stop the skills install grant from applying when the override cleared the expectation. Signed-off-by: Samuele Verzi <samu@stacklok.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
* Upgrade project to Go 1.27 * Fix Go 1.27 compatibility * Fix remaining Go 1.27 vet warnings * Preserve Fosite errors under Go 1.27 * Fix Fosite error type assertion
* Add generated Go management API client * Refresh generated SDK contract * Harden generated Go SDK client safeguards * Avoid leaking invalid SDK URLs * Refresh SDK for signing contract
Fix POST-SSE progress ordering Signed-off-by: isaacgao4396 <gaoyuan4396@gmail.com> Co-authored-by: isaacgao4396 <gaoyuan4396@gmail.com> Co-authored-by: Jakub Hrozek <jakub.hrozek@posteo.se>
…on (stacklok#6306) * Normalize string role claims before claim-based role mapping evaluation * Preserve valid role mapping matches * Preserve valid role mapping matches --------- Co-authored-by: reyortiz3 <reynier@stacklok.com>
Two leftovers from stacklok#6639. The workflow installs Go from sdk/go/go.mod (1.26.0), but sdk-verify runs generator tooling out of the root module, which now needs 1.27. setup-go pins GOTOOLCHAIN=local, so that fails outright instead of upgrading: go: go.mod requires go >= 1.27 (running go 1.26.0; GOTOOLCHAIN=local) Point setup-go at the root go.mod. The SDK module keeps its own lower floor, so this doesn't raise the minimum for SDK consumers. The committed SDK artifacts were also left stale: the bump edited a BuilderImage doc comment ("golang:1.26-alpine" -> "golang:1.27-alpine") which flows through swagger.json into openapi.json/yaml and the generated client, so verify's diff fails even on a correct toolchain. Regenerated with task sdk-generate.
* Publish fallback keys in the authserver JWKS endpoint The documented signing-key rotation procedure relies on an overlap window where both the old and new keys are published, but KeyProvider.PublicKeys(ctx) was never called outside tests. The JWKS endpoint only ever served the single active signing key, so promoting a fallback key to primary invalidated every outstanding token instead of opening the intended overlap window. Wire PublicKeys(ctx) through newServer into NewAuthorizationServerConfig so SigningJWKS includes the primary signing key plus every configured fallback key, primary first. Fixes stacklok#6451 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * Fix struct literal alignment for gci/gofmt compliance CI's golangci-lint (v2.13.2, bundled gofmt fork) splits a struct literal's field-alignment into groups differently than the locally installed older golangci-lint, so the previous manual field alignment in these two struct literals passed locally but failed CI's gci check. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
PR stacklok#6543 added token_endpoint_auth_method to OAuth2UpstreamRunConfig but also made an unset field silently default to client_secret_basic whenever a secret was configured, flipping existing pre-registered upstream clients from POST-body credentials to HTTP Basic auth with no opt-in. Remove the implicit default so an unset field keeps the historical POST-body behavior; operators now opt in to client_secret_basic explicitly. Field, validation, and CRD exposure from stacklok#6543 are kept.
* Bump toolhive-core to v0.0.45 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * Bump toolhive-core to v0.0.47 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * Regenerate swagger docs and SDK for registry provenance toolhive-core v0.0.47 adds a plugin provenance field to registry/types, which flows into the generated skill schema. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * Migrate off deprecated toolhive-core/redis package v0.0.47 marks toolhive-core/redis as a deprecated compatibility facade for redisconn (staticcheck SA1019), so switch every call site to redisconn.Config/NewClient directly. No behavior change: redisconn is a straight field-for-field superset of the old Config, and none of these call sites use cloud IAM auth. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Update release files Release-Triggered-By: reyortiz3 Co-authored-by: toolhive-release-app[bot] <280093410+toolhive-release-app[bot]@users.noreply.github.com>
PAIINFRA-249. v0.48.0 is skipped; v0.49.0 contains it. Conflicts and how they were resolved: - pkg/authserver/storage/redis.go: v0.48.0 (stacklok#6548) adds CompareAndSwapUpstreamTokens with a Lua script that builds the user-set keys at run time (ARGV[4]..userID). Dragonfly rejects keys a script did not declare. Both upstream scripts are left out. StoreUpstreamTokens and CompareAndSwapUpstreamTokens share one WATCH/MULTI helper (writeUpstreamTokens, extends 907d704). The CAS compares the stored refresh token inside the watched transaction and returns ErrConcurrentRefresh on a mismatch, as the script does. No new Redis commands, so the toolhive-auth ACL needs no change. - pkg/cache/validating_cache.go: upstream (stacklok#6549) now buffers evictions and runs onEvict outside the lock. That replaces the fork's detached map. Remove, EvictIdle and the lastUsed record are kept on top of the upstream buffer and drain. - VirtualMCPServer controller: 8071da5 is dropped. Upstream stacklok#6377 compares env semantically and pod-template labels as a subset, and MutateAndPatchStatus skips an empty status patch, so the collector change is not needed either. The collector is upstream's again. - pkg/vmcp/server/server.go, pkg/runner/runner.go: toolhive-core/redis became redisconn. The ACL username (sessionStorage.usernameRef) is kept, next to upstream's set-but-empty password check (stacklok#6551). - security-scan.yml: upstream's govulncheck ignore list is used as is. - go.mod: upstream's file, with the fork's higher versions of x/crypto, x/net, x/sync, x/sys, x/term, x/text, x/tools, chi, go-jose v4, klauspost/compress and the zipkin exporter. - Tests: the fork's Redis ACL username test and cache Remove/EvictIdle tests are kept next to upstream's new ones. Go 1.27 (stacklok#6639): every fork workflow and toolhive-builder take the Go version from go.mod or 'stable', so no fork pin had to change. CRDs, deepcopy, RBAC, CLI and API docs, the Go SDK and the chart READMEs were regenerated. The fork's CRD delta against upstream is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fork writes upstream tokens with WATCH/MULTI because Dragonfly rejects Lua scripts that touch undeclared keys. Run StoreUpstreamTokens and CompareAndSwapUpstreamTokens against a Dragonfly container, and check that Dragonfly still rejects such a script, so the test shows when the fork patch can go. PAIINFRA-249. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PAIINFRA-249. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
zizmor found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
|
CRD compatibility check for the v0.49.0 merge (PAIINFRA-249). Result: PASS. How it was run: Objects checked: 576 from 34 sources.
All 576 objects are accepted on the current and on the candidate CRDs, and no fields are lost. The fork-only fields are kept. Limit of this run: the API server was kind v1.35.0. It was not matched to the EKS version. Full reportCRD check: PASS — current API server
Rendered and live objects
Blocking findingsNone. Rejected on the current CRDs only (not caused by the candidate)None. Fork-only fields
CRD versions
RollbackRe-applying the current CRDs over the candidate is accepted (server dry-run): reversible. |
Summary
This PR brings upstream v0.49.0 into the fork (Jira PAIINFRA-249, epic PAIINFRA-211, milestone M7). Version v0.48.0 is skipped because v0.49.0 contains it. This PR deploys nothing.
Main fork work:
CompareAndSwapUpstreamTokensas a Lua script that builds keys at run time. Dragonfly rejects this. Both upstream scripts are left out.StoreUpstreamTokensandCompareAndSwapUpstreamTokensnow share one WATCH/MULTI helper,writeUpstreamTokens. No new Redis commands are used, so thetoolhive-authDragonfly ACL needs no change. A new test,pkg/authserver/storage/redis_dragonfly_integration_test.go, runs both functions against a Dragonfly container (ghcr.io/dragonflydb/dragonfly:v1.38.1). It also checks that Dragonfly still rejects Lua scripts with undeclared keys.MutateAndPatchStatusnow skips empty patches (Introduce MutateAndPatchStatus helper for status writes stacklok/toolhive#4942).pkg/cache. Upstream Evict vMCP sessions when a backend is dropped stacklok/toolhive#6549 now runsonEvictoutside the lock. The fork's detached map is dropped. The fork keeps onlyRemoveandEvictIdle.go.modorstable.upstreamProvidersandoauth2Config.clientIdare no longer required). The fork's CRD delta against upstream is byte-identical to before.go.modkeeps the fork's higher module versions. The govulncheck ignore list is upstream's. Fork-only ignores are dropped.Type of change
Test plan
task test):go test -raceon all packages excepttest/e2eandcmd/thv-operator/test-integration(the same set astask test). Result: 201 packages ok, 0 failures.task test-e2e): not rungolangci-lint run --new-from-rev=v0.49.0(v2.15.0). Result: 0 issues.Manual testing:
go build ./...andgo vet ./...pass. They also pass with-tags integrationforpkg/authserver/storage.TestIntegration_DragonflyUpstreamTokens(4 subtests),TestIntegration_UpstreamTokensandTestIntegration_ConcurrentAccess.Not run: e2e tests, the CRD compatibility check against live clusters (this is PAIINFRA-250) and the ECR build.
API Compatibility
v1beta1API, OR theapi-break-allowedlabel is applied and the migration guidance is described above.Does this introduce a user-facing change?
No. The CRD changes from upstream are additive.
Special notes for reviewers
94089223d(merge and conflict resolution),01e061cf4(Dragonfly test) and409a5e9d5(FORK.md).dp-stable(seen on PR Merge upstream v0.47.1 into dp-stable (PAIINFRA-244) #30): E2E Core proxy and mcp-protocol specs, the flaky Lifecycle e2e, CRD Schema Compatibility (the fork has no GitHub releases) and zizmorreleaser.yml.🤖 Generated with Claude Code