feat(hub)!: pin discovery to the credential's origin via @corbits/credential-http - #15
Merged
TheGreatAxios merged 1 commit intoSep 27, 2026
Conversation
TheGreatAxios
added this pull request to stack #12
September 26, 2026 14:47
TheGreatAxios
force-pushed
the
cl-9051-mcp-import-pinned-fetch-from-corbitscredential-http
branch
2 times, most recently
from
September 27, 2026 18:35
7ed522a to
4f19763
Compare
…dential-http
Replace @corbits/credential-mcp with @corbits/credential-http. Discovery that
sends a secret now pins to the credential's provider apiBaseUrl origin, and a
host allows extra origins per pinned origin with `extraOrigins`. No origin is
allowed by default, which drops the built-in vendor allowance credential-mcp
carried. A keyless credential pins to the URL's origin. OAuth discovery's
fallback now requires the resource-served metadata to name the resource's own
issuer (RFC 8414 §3.3).
BREAKING CHANGE: readCredentialSecret is now readCredential and returns
{ secret, origin? }; discoverMcpServer takes `credential` instead of `secret`;
a credential with a secret whose provider has no apiBaseUrl, or a URL off its
origin without `extraOrigins`, is refused.
TheGreatAxios
force-pushed
the
cl-9051-mcp-import-pinned-fetch-from-corbitscredential-http
branch
from
September 27, 2026 18:49
4f19763 to
873f4f6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces
@corbits/credential-mcpwith@corbits/credential-httpand removes the last provider-specific origin from this package's dependency path.@corbits/mcpnever named a vendor itself;@corbits/credential-mcp'smcpOriginPinnedFetchcarried a built-in allowance from one vendor's origin to another.@corbits/credential-httphas no built-ins, so nothing is allowed off the pinned origin unless the host says so.Changes
src/hub/discover.tsimportscreateOriginPinnedFetchandMCP_NO_TOKEN_SENTINELfrom@corbits/credential-http.apiBaseUrl, as@corbits/credential-httphandles do. Before, it pinned to whatever URL the request named, so any origin could receive the secret.extraOrigins?: Readonly<Record<string, readonly string[]>>onMountMcpDiscoveryOptsanddiscoverMcpServer, keyed by pinned origin (normalized withnew URL(key).origin, as credential-http does) and passed through to@corbits/credential-http. Default{}. Interchange has no analogue, so the name matches@corbits/credential-http.MCP_NO_TOKEN_SENTINEL) credential sends nothing, so it pins to the URL's origin, not its provider'sapiBaseUrl, as the README says.extraOriginsis host-wide: an entry applies to every tenant's credential pinned to that origin. The README and the option's doc comment say so.discoverMcpLoginEntry's fallback (authorization-server metadata served at the resource) now requiresmetadata.issuerto equal the issuer the resource URL identifies (RFC 8414 §3.3), with the same trailing-slash normalization as the well-known URL.@corbits/oauth-core0.2.0 does not export such a helper, so it stays local.readCredentialSecretis nowreadCredentialand returns{ secret, origin? }.discoverMcpServertakescredentialinstead ofsecret.apiBaseUrlis refused; a keyless credential needs none. A redirect is refused even to an allowed origin. A keyless credential with a mismatchedapiBaseUrlpins to the URL's origin. Fallback metadata naming another issuer is refused; a trailing-slash difference is accepted.@corbits/oauth-coredependency moves to^0.2.0.extraOriginswith example hosts.Breaking
Yes, marked
!. It is part of the pending 0.2.0 release, so there is no extra version bump.Review
An independent gaas:critique review found key normalization, keyless credentials and an id in an error message; all three are fixed.
Checks
bun run check(typecheck, oxlint, oxfmt --check, tests),bun run build, and the Node pack smoke all pass locally.Closes CL-9051