Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 92 additions & 1 deletion pkgs/mcpx/docs/spec/conformance-matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Generated by `internal/conformance` (`MCPX_UPDATE_MATRIX=1 go test ./internal/conformance -run TestMatrix`); do not edit.

Generated from inputs `08efb95e7bca982c` (sha256 of docs/spec/requirements.md, internal/conformance/overrides/*.json, internal/conformance/coverage*.go). `TestMatrix` regenerates this file and fails when it differs, so it describes the tree it is committed in.
Generated from inputs `5791ee9656dda1e2` (sha256 of docs/spec/requirements.md, internal/conformance/overrides/*.json, internal/conformance/coverage*.go, internal/conformance/authsplit.json). `TestMatrix` regenerates this file and fails when it differs, so it describes the tree it is committed in.

Every normative requirement of every revision (catalogue: `docs/spec/requirements.md`), for mcpx as a server and as a client. A requirement is *tested* when a named test verifies it in that revision, *n/a* when it does not bind mcpx in that role, and a *gap* when it binds mcpx and mcpx does not meet it yet, with the issue that tracks it. Run exactly the covering tests with `go run ./internal/conformance/cmd/covering`.

Expand Down Expand Up @@ -2573,3 +2573,94 @@ Every normative requirement of every revision (catalogue: `docs/spec/requirement
| [versioning-dual-era-server-selects-by-opening](https://modelcontextprotocol.io/specification/2026-07-28/basic/versioning#compatibility-matrix) | (normative description) | server | tested: `conformance.TestLifecycleServer/2026-07-28/versioning/versioning-dual-era-server-selects-by-opening` | n/a: addresses the other side |
| [versioning-dual-era-both-concurrently](https://modelcontextprotocol.io/specification/2026-07-28/basic/versioning#compatibility-matrix) | MAY | server | tested: `conformance.TestLifecycleServer/2026-07-28/versioning/versioning-dual-era-both-concurrently` | n/a: addresses the other side |
| [deprecated-should-not-adopt](https://modelcontextprotocol.io/specification/2026-07-28/deprecated#deprecated) | SHOULD NOT / SHOULD | both | tested: `conformance.TestLifecycleServer/2026-07-28/versioning/deprecated-should-not-adopt` | tested: `conformance.TestLifecycleClient/2026-07-28/versioning/deprecated-should-not-adopt` |

## Authorization rows: accepts, or requires refusal (#1972)

61 authorization rows are split per side of the wire into 82 bound row-sides: **69 permissive** and **13 validation**. A *permissive* row-side is satisfied by an interface that accepts every credential (#1950) — endpoint shape, discovery documents, registration, flows. A *validation* row-side cannot pass against such an interface: it needs a real check, named below, to refuse or challenge a credential (#1972).

Validation row-sides per check: invalid 6, expired 5, wrong-resource 3, scope 5. Input: `internal/conformance/authsplit.json`; edits belong there, never in this file.

| requirement | side | verdict |
|---|---|---|
| authorization-http-should-conform-stdio-should-not | server | permissive |
| authorization-http-should-conform-stdio-should-not | client | permissive |
| authorization-custom-auth-may | server | permissive |
| authorization-custom-auth-may | client | permissive |
| streamable-http-auth-discovery-version-header | client | permissive |
| authz-optional | server | permissive |
| authz-optional | client | permissive |
| authz-http-should-conform | server | permissive |
| authz-http-should-conform | client | permissive |
| authz-stdio-use-environment | server | permissive |
| authz-stdio-use-environment | client | permissive |
| authz-alt-transport-best-practice | server | permissive |
| authz-alt-transport-best-practice | client | permissive |
| authz-implement-oauth21 | server | permissive |
| authz-implement-oauth21 | client | permissive |
| authz-dcr-should | server | permissive |
| authz-dcr-should | client | permissive |
| authz-dcr-may-deprecated | client | permissive |
| authz-rfc8414-server-should-client-must | server | permissive |
| authz-rfc8414-server-should-client-must | client | permissive |
| authz-grant-types | server | permissive |
| authz-401-when-unauthorized | server | validation: invalid — an unproven or invalid credential must be refused with 401 |
| authz-base-url-discards-path | client | permissive |
| authz-default-endpoints-fallback | client | permissive |
| authz-bearer-header | client | permissive |
| authz-token-every-request | client | permissive |
| authz-no-token-in-query | client | permissive |
| authz-server-validates-token | server | validation: invalid, expired — tokens are validated; invalid or expired ones must get 401 |
| authz-server-validates-audience | server | validation: wrong-resource — the token must be issued for this server as audience |
| authz-client-sends-only-own-as-tokens | client | permissive |
| authz-accept-only-own-tokens | server | validation: wrong-resource — only tokens valid for this server's resources may be accepted |
| authz-no-token-passthrough | server | permissive |
| authz-error-status-codes | server | validation: invalid, expired, wrong-resource, scope — the refusal status code (401/403/400) for every authorization error |
| authz-2025-03-26-security-list | server | validation: invalid, expired — servers enforce token expiration and validate redirect URIs |
| authz-2025-03-26-security-list | client | permissive |
| authz-2025-03-26-implementation-reqs | server | validation: expired — token rotation and limited lifetimes are enforced server-side |
| authz-2025-03-26-implementation-reqs | client | permissive |
| authz-third-party-session-binding | server | validation: invalid, expired — third-party token status validated and expiration handled |
| authz-server-prm-rfc9728 | server | permissive |
| authz-server-prm-rfc9728 | client | permissive |
| authz-prm-lists-authorization-servers | server | permissive |
| authz-as-metadata-rfc8414 | server | permissive |
| authz-as-metadata-rfc8414 | client | permissive |
| authz-as-metadata-rfc8414-or-oidc | server | permissive |
| authz-as-metadata-rfc8414-or-oidc | client | permissive |
| authz-401-www-authenticate | server | validation: invalid — the 401 refusal must carry the WWW-Authenticate metadata pointer |
| authz-prm-discovery-header-or-well-known | server | permissive |
| authz-prm-discovery-header-or-well-known | client | permissive |
| authz-client-parses-www-authenticate | client | permissive |
| authz-client-rfc8414-discovery | client | permissive |
| authz-client-as-discovery-order | client | permissive |
| authz-client-validates-issuer-in-metadata | client | permissive — metadata is checked deterministically; no credential is inspected |
| authz-client-per-as-registration-state | client | permissive |
| authz-resource-indicator | client | permissive |
| authz-canonical-uri-guidance | server | permissive |
| authz-canonical-uri-guidance | client | permissive |
| authz-secure-token-storage | server | permissive |
| authz-secure-token-storage | client | permissive |
| authz-https-and-redirect-uris | server | permissive |
| authz-https-and-redirect-uris | client | permissive |
| authz-pkce | client | permissive |
| authz-pkce-verify-s256 | client | permissive — the client refuses to proceed on AS capability, not on a presented credential |
| authz-open-redirection | client | permissive |
| authz-proxy-consent-per-client | server | permissive — user consent is a flow gate, not a credential check; no credential is inspected |
| authz-client-registration-required | client | permissive |
| authz-registration-priority | client | permissive |
| authz-cimd | client | permissive |
| authz-preregistration | client | permissive |
| authz-dcr-application-type | client | permissive |
| authz-credentials-bound-to-issuer | client | permissive |
| authz-scope-in-challenge | server | validation: scope — the refusal challenge must name the scope required |
| authz-scope-in-challenge | client | permissive |
| authz-scope-selection-order | client | permissive |
| authz-insufficient-scope-403 | server | validation: scope — insufficient scope must be refused with 403 insufficient_scope |
| authz-all-scopes-single-challenge | server | validation: scope — one refusal challenge listing every scope the operation needs |
| authz-step-up | client | permissive — the client reacts to a refusal it is given; it validates nothing itself |
| authz-server-scope-hierarchy | server | validation: scope — scope hierarchies must be accounted for when enforcing scope |
| authz-iss-validation | client | permissive — discovery/issuer metadata is checked deterministically; no credential is inspected |
| authz-refresh-tokens | server | permissive |
| authz-refresh-tokens | client | permissive |
| authz-follow-security-considerations | server | permissive |
| authz-follow-security-considerations | client | permissive |
203 changes: 203 additions & 0 deletions pkgs/mcpx/internal/conformance/authsplit.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
package conformance

import (
"encoding/json"
"fmt"
"os"
"sort"
"strings"
)

// AuthSplitPath is the split of the authorization rows along accepts-vs-
// refuses, one verdict per requirement side. Like overrides/, it is data:
// the matrix renders it, and it never decides a cell's status.
const AuthSplitPath = "internal/conformance/authsplit.json"

// The two verdicts for an authorization row-side.
const (
// Permissive is satisfied by an interface that accepts every credential
// (#1950): endpoint shape, discovery documents, registration, flows.
Permissive = "permissive"
// Validation is not satisfiable by a permissive interface: it requires
// inspecting a presented credential and refusing it (#1972).
Validation = "validation"
)

// AuthChecks are the validation checks a refusal-requiring row can need,
// matching #1972's split table.
var AuthChecks = []string{"invalid", "expired", "wrong-resource", "scope"}

// AuthSide is the split verdict for one side of one requirement.
type AuthSide struct {
Verdict string `json:"verdict"`
Checks []string `json:"checks,omitempty"`
Why string `json:"why,omitempty"`
}

// AuthCell keys the split by requirement and side: a row is split per side
// of the wire, since a permissive server and a permissive client answer
// different rows.
type AuthCell struct{ ID, Side string }

type authSplitFile struct {
About string `json:"about"`
Checks []string `json:"checks"`
Rows map[string]map[string]AuthSide `json:"rows"`
}

// IsAuthorization reports whether a requirement is an authorization row.
func IsAuthorization(r Requirement) bool {
return strings.Contains(strings.ToLower(r.Area), "authorization")
}

// LoadAuthSplit reads the split and refuses one that does not cover exactly
// the bound sides of the authorization rows.
func LoadAuthSplit(path string, reqs []Requirement) (map[AuthCell]AuthSide, error) {
b, err := os.ReadFile(path)
if err != nil {
return nil, err
}
var f authSplitFile
if err := json.Unmarshal(b, &f); err != nil {
return nil, fmt.Errorf("%s: %w", path, err)
}
if strings.Join(f.Checks, ",") != strings.Join(AuthChecks, ",") {
return nil, fmt.Errorf("%s: checks are %v, want %v", path, f.Checks, AuthChecks)
}

byID := map[string]Requirement{}
for _, r := range reqs {
byID[r.ID] = r
}
out := map[AuthCell]AuthSide{}
for id, sides := range f.Rows {
r, ok := byID[id]
if !ok {
return nil, fmt.Errorf("%s: unknown requirement %s", path, id)
}
if !IsAuthorization(r) {
return nil, fmt.Errorf("%s: %s is not an authorization row (%s)", path, id, r.Area)
}
for side, s := range sides {
k := AuthCell{id, side}
if side != Server && side != Client {
return nil, fmt.Errorf("%s: %s: side %q", path, id, side)
}
if strings.HasPrefix(r.Applicability[side], NAPrefix) {
return nil, fmt.Errorf("%s: %s/%s does not bind mcpx", path, id, side)
}
switch s.Verdict {
case Permissive:
if len(s.Checks) > 0 {
return nil, fmt.Errorf("%s: %s/%s is permissive but names checks %v", path, id, side, s.Checks)
}
case Validation:
if len(s.Checks) == 0 {
return nil, fmt.Errorf("%s: %s/%s requires validation but names no check", path, id, side)
}
for _, c := range s.Checks {
if !isAuthCheck(c) {
return nil, fmt.Errorf("%s: %s/%s: unknown check %q", path, id, side, c)
}
}
default:
return nil, fmt.Errorf("%s: %s/%s: verdict %q", path, id, side, s.Verdict)
}
out[k] = s
}
}

var missing []string
for _, r := range reqs {
if !IsAuthorization(r) {
continue
}
for _, side := range []string{Server, Client} {
if strings.HasPrefix(r.Applicability[side], NAPrefix) {
continue
}
if _, ok := out[AuthCell{r.ID, side}]; !ok {
missing = append(missing, r.ID+"/"+side)
}
}
}
if len(missing) > 0 {
sort.Strings(missing)
return nil, fmt.Errorf("%s: %d bound authorization sides have no verdict:\n%s",
path, len(missing), strings.Join(missing, "\n"))
}
return out, nil
}

func isAuthCheck(c string) bool {
for _, x := range AuthChecks {
if x == c {
return true
}
}
return false
}

// AuthCounts is the size of the split.
type AuthCounts struct {
Rows int // authorization rows bound on at least one side
Sides int // bound row-sides
Permissive int // row-sides a permissive interface satisfies
Validation int // row-sides that need a real check
PerCheck map[string]int // validation row-sides per check
}

// CountAuthSplit counts the split.
func CountAuthSplit(reqs []Requirement, sp map[AuthCell]AuthSide) AuthCounts {
c := AuthCounts{PerCheck: map[string]int{}}
bound := map[string]bool{}
for id, s := range sp {
c.Sides++
bound[id.ID] = true
if s.Verdict == Permissive {
c.Permissive++
} else {
c.Validation++
for _, x := range s.Checks {
c.PerCheck[x]++
}
}
}
c.Rows = len(bound)
return c
}

// renderAuthSplit writes the split into the matrix, so the permissive
// interface's target and the validation work's target are both exact.
func renderAuthSplit(b *strings.Builder, reqs []Requirement, sp map[AuthCell]AuthSide) {
c := CountAuthSplit(reqs, sp)
fmt.Fprintf(b, "\n## Authorization rows: accepts, or requires refusal (#1972)\n\n")
fmt.Fprintf(b, "%d authorization rows are split per side of the wire into %d bound row-sides: **%d permissive** and **%d validation**. ",
c.Rows, c.Sides, c.Permissive, c.Validation)
b.WriteString("A *permissive* row-side is satisfied by an interface that accepts every credential (#1950) — endpoint shape, discovery documents, registration, flows. ")
b.WriteString("A *validation* row-side cannot pass against such an interface: it needs a real check, named below, to refuse or challenge a credential (#1972).\n\n")
fmt.Fprintf(b, "Validation row-sides per check: invalid %d, expired %d, wrong-resource %d, scope %d. ",
c.PerCheck["invalid"], c.PerCheck["expired"], c.PerCheck["wrong-resource"], c.PerCheck["scope"])
fmt.Fprintf(b, "Input: `%s`; edits belong there, never in this file.\n\n", AuthSplitPath)

b.WriteString("| requirement | side | verdict |\n|---|---|---|\n")
for _, r := range reqs {
if !IsAuthorization(r) {
continue
}
for _, side := range []string{Server, Client} {
s, ok := sp[AuthCell{r.ID, side}]
if !ok {
continue
}
v := "permissive"
if s.Verdict == Validation {
v = "validation: " + strings.Join(s.Checks, ", ")
}
if s.Why != "" {
v += " — " + mdEscape(s.Why)
}
fmt.Fprintf(b, "| %s | %s | %s |\n", r.ID, side, v)
}
}
}
Loading