@kya-os/checkpoint-shared 1.5.2 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/CHANGELOG.md +98 -1
  2. package/dist/beacon-types/index.d.mts +12 -1
  3. package/dist/beacon-types/index.d.mts.map +1 -1
  4. package/dist/beacon-types/index.d.ts +12 -1
  5. package/dist/beacon-types/index.d.ts.map +1 -1
  6. package/dist/beacon-types/index.js +18 -1
  7. package/dist/beacon-types/index.mjs +18 -2
  8. package/dist/beacon-types/index.mjs.map +1 -1
  9. package/dist/{browser-posture-DVoHMHjY.d.mts → browser-posture-BuChqmH5.d.mts} +2 -2
  10. package/dist/{browser-posture-DVoHMHjY.d.mts.map → browser-posture-BuChqmH5.d.mts.map} +1 -1
  11. package/dist/{browser-posture-D4j2a5gi.d.ts → browser-posture-DIaVLuW3.d.ts} +2 -2
  12. package/dist/{browser-posture-D4j2a5gi.d.ts.map → browser-posture-DIaVLuW3.d.ts.map} +1 -1
  13. package/dist/browser-posture-proof.d.mts +2 -2
  14. package/dist/browser-posture-proof.d.ts +2 -2
  15. package/dist/browser-posture-proof.js +1 -1
  16. package/dist/browser-posture-proof.mjs +1 -1
  17. package/dist/browser-posture.d.mts +1 -1
  18. package/dist/browser-posture.d.ts +1 -1
  19. package/dist/browser-posture.js +3 -3
  20. package/dist/browser-posture.mjs +3 -3
  21. package/dist/browser-posture.mjs.map +1 -1
  22. package/dist/clearance.d.mts +1 -1
  23. package/dist/clearance.d.ts +1 -1
  24. package/dist/clearance.js +2 -2
  25. package/dist/clearance.mjs +2 -2
  26. package/dist/errors/index.d.mts +17 -0
  27. package/dist/errors/index.d.mts.map +1 -1
  28. package/dist/errors/index.d.ts +17 -0
  29. package/dist/errors/index.d.ts.map +1 -1
  30. package/dist/errors/index.js +75 -3
  31. package/dist/errors/index.mjs +75 -3
  32. package/dist/errors/index.mjs.map +1 -1
  33. package/dist/{external-Ct8j_hto.d.ts → external-B7WI9FyQ.d.mts} +2 -2
  34. package/dist/{external-Ct8j_hto.d.mts.map → external-B7WI9FyQ.d.mts.map} +1 -1
  35. package/dist/{external-Ct8j_hto.d.mts → external-B7WI9FyQ.d.ts} +2 -2
  36. package/dist/{external-Ct8j_hto.d.ts.map → external-B7WI9FyQ.d.ts.map} +1 -1
  37. package/dist/gateway-client-ip.d.mts +1 -1
  38. package/dist/gateway-client-ip.d.ts +1 -1
  39. package/dist/gateway-client-ip.js +1 -1
  40. package/dist/gateway-client-ip.mjs +1 -1
  41. package/dist/index.d.mts +811 -132
  42. package/dist/index.d.mts.map +1 -1
  43. package/dist/index.d.ts +811 -132
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +1945 -145
  46. package/dist/index.mjs +1891 -145
  47. package/dist/index.mjs.map +1 -1
  48. package/dist/mcpi/approval-grant/index.d.mts.map +1 -1
  49. package/dist/mcpi/approval-grant/index.d.ts.map +1 -1
  50. package/dist/mcpi/approval-grant/index.js +10 -1
  51. package/dist/mcpi/approval-grant/index.mjs +10 -1
  52. package/dist/mcpi/approval-grant/index.mjs.map +1 -1
  53. package/dist/mcpi/dashboard-config/index.d.mts +3 -2
  54. package/dist/mcpi/dashboard-config/index.d.mts.map +1 -1
  55. package/dist/mcpi/dashboard-config/index.d.ts +3 -2
  56. package/dist/mcpi/dashboard-config/index.d.ts.map +1 -1
  57. package/dist/{posture-origins-CEm83u4D.js → posture-origins-LFkX80oF.js} +6 -0
  58. package/dist/{posture-origins-Dl7i8j93.mjs → posture-origins-Pn-ii-Pp.mjs} +2 -2
  59. package/dist/{posture-origins-Dl7i8j93.mjs.map → posture-origins-Pn-ii-Pp.mjs.map} +1 -1
  60. package/dist/{project-verification-key-CgSVX9_m.mjs → project-verification-key-66N4edKn.mjs} +2 -2
  61. package/dist/{project-verification-key-CgSVX9_m.mjs.map → project-verification-key-66N4edKn.mjs.map} +1 -1
  62. package/dist/{project-verification-key-C3L5rd8a.js → project-verification-key-BccT12tQ.js} +1 -1
  63. package/dist/{schemas-DxY-dk9y.mjs → schemas-7qodsG-Z.mjs} +49 -2
  64. package/dist/schemas-7qodsG-Z.mjs.map +1 -0
  65. package/dist/{schemas-BmjNLAE7.js → schemas-YhagYDx_.js} +59 -0
  66. package/fixtures/cli-registration.v2.json +115 -0
  67. package/fixtures/detection/reason-codes.json +1 -1
  68. package/fixtures/kya-http/README.md +34 -26
  69. package/fixtures/kya-http/protected-resource-metadata.full.json +14 -5
  70. package/fixtures/kya-http/protected-resource-metadata.invalid-issuer.json +51 -0
  71. package/fixtures/kya-http/protected-resource-metadata.no-issuer.json +32 -0
  72. package/fixtures/reviewer-grant-revocation.v1.json +285 -0
  73. package/package.json +4 -4
  74. package/dist/schemas-DxY-dk9y.mjs.map +0 -1
  75. package/fixtures/kya-http/protected-resource-metadata.global.json +0 -28
@@ -924,6 +924,7 @@ const string$1 = (params) => {
924
924
  const integer = /^-?\d+$/;
925
925
  const number$1 = /^-?\d+(?:\.\d+)?$/;
926
926
  const boolean$1 = /^(?:true|false)$/i;
927
+ const _null$2 = /^null$/i;
927
928
  const lowercase = /^[^A-Z]*$/;
928
929
  const uppercase = /^[^a-z]*$/;
929
930
 
@@ -1796,6 +1797,22 @@ const $ZodBoolean = /*@__PURE__*/ $constructor("$ZodBoolean", (inst, def) => {
1796
1797
  return payload;
1797
1798
  };
1798
1799
  });
1800
+ const $ZodNull = /*@__PURE__*/ $constructor("$ZodNull", (inst, def) => {
1801
+ $ZodType.init(inst, def);
1802
+ inst._zod.pattern = _null$2;
1803
+ inst._zod.values = /* @__PURE__ */ new Set([null]);
1804
+ inst._zod.parse = (payload, _ctx) => {
1805
+ const input = payload.value;
1806
+ if (input === null) return payload;
1807
+ payload.issues.push({
1808
+ expected: "null",
1809
+ code: "invalid_type",
1810
+ input,
1811
+ inst
1812
+ });
1813
+ return payload;
1814
+ };
1815
+ });
1799
1816
  const $ZodAny = /*@__PURE__*/ $constructor("$ZodAny", (inst, def) => {
1800
1817
  $ZodType.init(inst, def);
1801
1818
  inst._zod.parse = (payload) => payload;
@@ -3434,6 +3451,13 @@ function _coercedBoolean(Class, params) {
3434
3451
  });
3435
3452
  }
3436
3453
  // @__NO_SIDE_EFFECTS__
3454
+ function _null$1(Class, params) {
3455
+ return new Class({
3456
+ type: "null",
3457
+ ...normalizeParams(params)
3458
+ });
3459
+ }
3460
+ // @__NO_SIDE_EFFECTS__
3437
3461
  function _any(Class) {
3438
3462
  return new Class({ type: "any" });
3439
3463
  }
@@ -4174,6 +4198,13 @@ const numberProcessor = (schema, ctx, _json, params) => {
4174
4198
  const booleanProcessor = (_schema, _ctx, json, _params) => {
4175
4199
  json.type = "boolean";
4176
4200
  };
4201
+ const nullProcessor = (_schema, ctx, json, _params) => {
4202
+ if (ctx.target === "openapi-3.0") {
4203
+ json.type = "string";
4204
+ json.nullable = true;
4205
+ json.enum = [null];
4206
+ } else json.type = "null";
4207
+ };
4177
4208
  const neverProcessor = (_schema, _ctx, json, _params) => {
4178
4209
  json.not = {};
4179
4210
  };
@@ -5059,6 +5090,14 @@ const ZodBoolean = /*@__PURE__*/ $constructor("ZodBoolean", (inst, def) => {
5059
5090
  function boolean(params) {
5060
5091
  return _boolean(ZodBoolean, params);
5061
5092
  }
5093
+ const ZodNull = /*@__PURE__*/ $constructor("ZodNull", (inst, def) => {
5094
+ $ZodNull.init(inst, def);
5095
+ ZodType.init(inst, def);
5096
+ inst._zod.processJSONSchema = (ctx, json, params) => nullProcessor(inst, ctx, json, params);
5097
+ });
5098
+ function _null(params) {
5099
+ return _null$1(ZodNull, params);
5100
+ }
5062
5101
  const ZodAny = /*@__PURE__*/ $constructor("ZodAny", (inst, def) => {
5063
5102
  $ZodAny.init(inst, def);
5064
5103
  ZodType.init(inst, def);
@@ -5195,6 +5234,14 @@ function object(shape, params) {
5195
5234
  };
5196
5235
  return new ZodObject(def);
5197
5236
  }
5237
+ function strictObject(shape, params) {
5238
+ return new ZodObject({
5239
+ type: "object",
5240
+ shape,
5241
+ catchall: never(),
5242
+ ...normalizeParams(params)
5243
+ });
5244
+ }
5198
5245
  const ZodUnion = /*@__PURE__*/ $constructor("ZodUnion", (inst, def) => {
5199
5246
  $ZodUnion.init(inst, def);
5200
5247
  ZodType.init(inst, def);
@@ -5567,6 +5614,12 @@ Object.defineProperty(exports, '_instanceof', {
5567
5614
  return _instanceof;
5568
5615
  }
5569
5616
  });
5617
+ Object.defineProperty(exports, '_null', {
5618
+ enumerable: true,
5619
+ get: function () {
5620
+ return _null;
5621
+ }
5622
+ });
5570
5623
  Object.defineProperty(exports, 'any', {
5571
5624
  enumerable: true,
5572
5625
  get: function () {
@@ -5657,6 +5710,12 @@ Object.defineProperty(exports, 'record', {
5657
5710
  return record;
5658
5711
  }
5659
5712
  });
5713
+ Object.defineProperty(exports, 'strictObject', {
5714
+ enumerable: true,
5715
+ get: function () {
5716
+ return strictObject;
5717
+ }
5718
+ });
5660
5719
  Object.defineProperty(exports, 'string', {
5661
5720
  enumerable: true,
5662
5721
  get: function () {
@@ -0,0 +1,115 @@
1
+ {
2
+ "protocolVersion": 2,
3
+ "proof": {
4
+ "verifier": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
5
+ "challenge": "DwBzhbb51LfusnSGBa_hqYSgo7-j8BTQnip4TOnlzRo",
6
+ "wrongVerifier": "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBA"
7
+ },
8
+ "registerRequest": {
9
+ "protocolVersion": 2,
10
+ "exchangeChallenge": "DwBzhbb51LfusnSGBa_hqYSgo7-j8BTQnip4TOnlzRo",
11
+ "repoName": "Pairing project",
12
+ "framework": "static"
13
+ },
14
+ "registerResponse": {
15
+ "success": true,
16
+ "data": {
17
+ "protocolVersion": 2,
18
+ "registrationId": "66666666-6666-4666-8666-666666666666",
19
+ "claimToken": "cliclaim_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
20
+ "claimUrl": "https://app.example.test/cli/claim?token=cliclaim_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
21
+ "confirmationCode": "BCDF-GHJK",
22
+ "expiresAt": "2099-01-01T00:00:00.000Z"
23
+ }
24
+ },
25
+ "privatePendingResponse": {
26
+ "success": true,
27
+ "data": {
28
+ "protocolVersion": 2,
29
+ "status": "pending",
30
+ "claimed": null
31
+ }
32
+ },
33
+ "privateClaimedResponse": {
34
+ "success": true,
35
+ "data": {
36
+ "protocolVersion": 2,
37
+ "status": "claimed",
38
+ "claimed": {
39
+ "userId": "11111111-1111-4111-8111-111111111111",
40
+ "userEmail": "terminal@example.test",
41
+ "userName": "Terminal operator",
42
+ "organizationId": "22222222-2222-4222-8222-222222222222",
43
+ "organizationName": "Approved organization",
44
+ "organizationSlug": "approved-org",
45
+ "projectId": "55555555-5555-4555-8555-555555555555",
46
+ "projectName": "Pairing project",
47
+ "projectDomain": "pairing.example.test"
48
+ }
49
+ }
50
+ },
51
+ "exchangeRequest": {
52
+ "protocolVersion": 2,
53
+ "registrationId": "66666666-6666-4666-8666-666666666666",
54
+ "exchangeVerifier": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
55
+ "approvedClaim": {
56
+ "userId": "11111111-1111-4111-8111-111111111111",
57
+ "organizationId": "22222222-2222-4222-8222-222222222222",
58
+ "projectId": "55555555-5555-4555-8555-555555555555"
59
+ }
60
+ },
61
+ "exchangeResponse": {
62
+ "success": true,
63
+ "data": {
64
+ "protocolVersion": 2,
65
+ "userId": "11111111-1111-4111-8111-111111111111",
66
+ "organizationId": "22222222-2222-4222-8222-222222222222",
67
+ "projectId": "55555555-5555-4555-8555-555555555555",
68
+ "friendlyId": "pairing-project",
69
+ "apiKey": "sk_bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
70
+ "dashboardUrl": "https://app.example.test/dashboard/approved-org/pairing-project/installations"
71
+ }
72
+ },
73
+ "errors": [
74
+ {
75
+ "status": 426,
76
+ "body": {
77
+ "success": false,
78
+ "error": {
79
+ "code": "PAIRING_UPGRADE_REQUIRED",
80
+ "message": "Upgrade the KYA-OS CLI and run checkpoint init again. This pairing requires independent terminal proof."
81
+ }
82
+ }
83
+ },
84
+ {
85
+ "status": 401,
86
+ "body": {
87
+ "success": false,
88
+ "error": {
89
+ "code": "PROOF_INVALID",
90
+ "message": "Invalid terminal pairing proof"
91
+ }
92
+ }
93
+ },
94
+ {
95
+ "status": 409,
96
+ "body": {
97
+ "success": false,
98
+ "error": {
99
+ "code": "CLAIM_CHANGED",
100
+ "message": "Claim ownership changed. Inspect and approve the pairing again."
101
+ }
102
+ }
103
+ },
104
+ {
105
+ "status": 403,
106
+ "body": {
107
+ "success": false,
108
+ "error": {
109
+ "code": "CLAIM_UNAVAILABLE",
110
+ "message": "The claimed account or project is no longer available"
111
+ }
112
+ }
113
+ }
114
+ ]
115
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$fixture": "detection/reason-codes",
3
- "$spec": "GODPROMPTS/detection-reason-codes — detection reason codes on the wire",
3
+ "$spec": "Detection reason codes on the wire (#4874)",
4
4
  "description": "The detection/* reason-code registry: a worker-side machine-readable projection of the engine's structured detection evidence (signals[], verificationMethod, detectionClass, isAiCrawler) onto the KYA-Reason-Codes wire header and persisted detection metadata. Emitters MUST use these exact strings.",
5
5
  "verified": {
6
6
  "detection/signature-verified": "verificationMethod === 'kya-http'",
@@ -32,38 +32,46 @@ min_assurance, interval, kind`. Omitted optional params leave the order of the r
32
32
 
33
33
  ## Files
34
34
 
35
- | File | Contents |
36
- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
37
- | `challenge.delegation.minimal.json` | Required params only |
38
- | `challenge.delegation.full.json` | All recommended params — the primary parity fixture |
39
- | `challenge.delegation.fetcher-200.json` | Body-readable **HTTP 200** envelope of the full challenge for 4xx-body-dropping AI fetchers — body byte-identical to `full`; a cooperative-UX bridge, **not** an access control |
40
- | `challenge.approval-quorum.json` | `kind="approval_quorum"` variant (grant format pending #3248; **not parity-frozen**) |
41
- | `pickup.transcript.json` | Poll sequences: pending→ready→re-delivery, pinning race, 403/404/410/429 |
42
- | `negative.challenges.json` | Malformed challenges (reject) + tolerance cases (accept) |
43
- | `error-codes.json` | The `kyaos/*` registry (spec §9) with HTTP status mapping |
44
- | `consent-handoff.codes.json` | Outcome and failure-reason codes a PEP reports in the log-detection `consentHandoff` block after trying to register a challenge anchor |
45
- | `protected-resource-metadata.full.json` | RFC 9728 PRM document served at the URL the §8.1 Bearer challenge advertises — **per-org** (org-slug issuer + `scopes_supported`) |
46
- | `protected-resource-metadata.global.json` | Same PRM, **global** variant — no `resource_org_did` (global issuer) and no scopes (`scopes_supported` omitted) |
35
+ | File | Contents |
36
+ | ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
37
+ | `challenge.delegation.minimal.json` | Required params only |
38
+ | `challenge.delegation.full.json` | All recommended params — the primary parity fixture |
39
+ | `challenge.delegation.fetcher-200.json` | Body-readable **HTTP 200** envelope of the full challenge for 4xx-body-dropping AI fetchers — body byte-identical to `full`; a cooperative-UX bridge, **not** an access control |
40
+ | `challenge.approval-quorum.json` | `kind="approval_quorum"` variant (grant format pending #3248; **not parity-frozen**) |
41
+ | `pickup.transcript.json` | Poll sequences: pending→ready→re-delivery, pinning race, 403/404/410/429 |
42
+ | `negative.challenges.json` | Malformed challenges (reject) + tolerance cases (accept) |
43
+ | `error-codes.json` | The `kyaos/*` registry (spec §9) with HTTP status mapping |
44
+ | `consent-handoff.codes.json` | Outcome and failure-reason codes a PEP reports in the log-detection `consentHandoff` block after trying to register a challenge anchor |
45
+ | `protected-resource-metadata.full.json` | RFC 9728 PRM document served at the URL the §8.1 Bearer challenge advertises — the issuer from the policy response, echoed (a branded issuer domain) + `scopes_supported` |
46
+ | `protected-resource-metadata.no-issuer.json` | Same URL when the policy response carries no issuer — `404 {"error":"not_found"}`, no document |
47
+ | `protected-resource-metadata.invalid-issuer.json` | Same 404 for each issuer in `input.cases` that is not an absolute https URI (http, relative, not a URI, whitespace, no host, backslashes) |
47
48
 
48
49
  ## Protected-resource metadata (RFC 9728)
49
50
 
50
- `protected-resource-metadata.{full,global}.json` pin the OAuth Protected Resource Metadata
51
- document served at `/.well-known/oauth-protected-resource` — the URL the §8.1 Delegation
52
- challenge already advertises via `WWW-Authenticate: Bearer resource_metadata="…"`. Without a
53
- served document that URL 404s. Each fixture has an `input` block
54
- (`resource_host`, `resource_org_did`, `base_url`, `scopes`) and an `expected.document` block.
55
- Parity is **structural body parity** (parse + compare values; member order non-normative, but
56
- emitters SHOULD use the `conformance.key_order` for diffability), with byte-exactness on the
57
- `resource` string and the `authorization_servers` issuer. Rules:
51
+ `protected-resource-metadata.{full,no-issuer,invalid-issuer}.json` pin the OAuth Protected Resource Metadata
52
+ served at `/.well-known/oauth-protected-resource` — the URL the §8.1 Delegation challenge
53
+ already advertises via `WWW-Authenticate: Bearer resource_metadata="…"`. Each fixture has an
54
+ `input` block (`resource_host`, `policy_response`, `scopes`) and either an `expected.document`
55
+ block or, when no document is served, an `expected.response` block. `policy_response` is the
56
+ project's policy response (`GET /api/internal/policies/{projectId}`); its
57
+ `authorizationServerIssuer` is the issuer the platform computes for the org. The .NET PEPs read
58
+ it from that response, and the gateway worker reads the same value from its routing entry, so
59
+ the .NET tests and the worker's well-known tests both read these files. Parity is **structural
60
+ body parity** (parse + compare values; member order non-normative, but emitters SHOULD use the
61
+ `conformance.key_order` for diffability), with byte-exactness on the `resource` string and the
62
+ `authorization_servers` issuer. Rules:
58
63
 
59
64
  13. **`resource` = `https://<resource_host>`**, byte-matching the host in the §8.1 Bearer URL
60
65
  (the request `Host`, port-preserving).
61
- 14. **`authorization_servers` is ALWAYS a single-element array.** With an `:orgs:` slug in
62
- `resource_org_did` it is the PER-ORG gateway issuer (`{origin}/oauth/gateway/{slug}`, byte-
63
- identical to the gateway-worker `perOrgIssuer`); otherwise the global issuer (the `base_url`
64
- origin).
66
+ 14. **`authorization_servers` is ALWAYS a single-element array holding
67
+ `policy_response.authorizationServerIssuer` unchanged.** A PEP never builds an issuer URL
68
+ (no `base_url` origin, no slug from a DID). Without that issuer it serves no document: `404`
69
+ with `{"error":"not_found"}` and `Cache-Control: no-store` (the `no-issuer` fixture). An
70
+ issuer that is not an absolute https URI counts as none: it must be `https://` directly
71
+ followed by a host, with no whitespace, control character or backslash (the
72
+ `invalid-issuer` fixture, whose `input.cases` each replace the issuer).
65
73
  15. **`scopes_supported` is emitted ONLY when `scopes` is non-empty** — never defaulted to a
66
- scope (the `global` fixture omits it).
74
+ scope.
67
75
  16. The .NET v1 document does **not** emit the `kyaos_needs_authorization` extension the
68
76
  gateway-worker adds (out of scope).
69
77
 
@@ -109,5 +117,5 @@ fetcher-200 parity tests; the 401 fixtures' rules 1–8 above are unchanged):
109
117
  `AuthorizationHost`, never the request `Host`.
110
118
 
111
119
  Coverage: `packages/checkpoint-shared/src/__tests__/kya-http-fetcher-200-fixture.test.ts` (body
112
- byte-parity + envelope shape) and `apps/web/tests/unit/lib/gateway/oauth/needs-authorization-challenge.test.ts`
120
+ byte-parity + envelope shape) and `apps/web/tests/unit/lib/authz/needs-authorization-challenge.test.ts`
113
121
  (the proof verifies transport-agnostically; a divergent 200 body fails CONTENT_BINDING_MISMATCH).
@@ -1,17 +1,26 @@
1
1
  {
2
2
  "$fixture": "kya-http/protected-resource-metadata.full",
3
3
  "$spec": "RFC 9728 OAuth Protected Resource Metadata (advertised by draft-kya-http-02 §8.1)",
4
- "description": "Per-org PRM document served at /.well-known/oauth-protected-resource — the URL the §8.1 Bearer challenge advertises. With a resource_org_did carrying an :orgs: slug, authorization_servers advertises the PER-ORG gateway issuer; with scopes present, scopes_supported is emitted. Every PEP that serves this URL (.NET net462 + net8, gateway-worker) must produce this document for the same input.",
4
+ "description": "PRM document served at /.well-known/oauth-protected-resource — the URL the §8.1 Bearer challenge advertises. authorization_servers is the issuer the platform computes for the org (IssuerContext) and sends as authorizationServerIssuer: in the project's policy response (GET /api/internal/policies/{projectId}, input.policy_response) for the .NET PEPs, and in the routing entry for the gateway worker. A PEP echoes it unchanged and never builds an issuer URL. This org's issuer is on its own issuer domain, not the platform origin. With scopes present, scopes_supported is emitted. Every PEP that serves this URL (.NET net462 + net8, gateway worker) must produce this authorization_servers for the same input.",
5
5
  "input": {
6
6
  "resource_host": "api.merchant.com",
7
- "resource_org_did": "did:web:kya.vouched.id:orgs:acme",
8
- "base_url": "https://kya.vouched.id",
7
+ "policy_response": {
8
+ "projectId": "proj-merchant",
9
+ "enabled": true,
10
+ "blockThreshold": 80,
11
+ "defaultAction": "allow",
12
+ "denyList": [],
13
+ "allowList": [],
14
+ "pathRules": [],
15
+ "authorizationHost": "auth.merchant.com",
16
+ "authorizationServerIssuer": "https://auth.merchant.com/oauth/acme"
17
+ },
9
18
  "scopes": ["commerce.checkout"]
10
19
  },
11
20
  "expected": {
12
21
  "document": {
13
22
  "resource": "https://api.merchant.com",
14
- "authorization_servers": ["https://kya.vouched.id/oauth/gateway/acme"],
23
+ "authorization_servers": ["https://auth.merchant.com/oauth/acme"],
15
24
  "bearer_methods_supported": ["header"],
16
25
  "scopes_supported": ["commerce.checkout"],
17
26
  "resource_documentation": "https://kya.vouched.id/docs/enforce/kya-os-enforcement"
@@ -25,6 +34,6 @@
25
34
  "scopes_supported",
26
35
  "resource_documentation"
27
36
  ],
28
- "notes": "resource byte-matches the §8.1 Bearer resource_metadata URL host; authorization_servers is ALWAYS a single-element array; the .NET v1 document does NOT emit the kyaos_needs_authorization extension the gateway-worker adds."
37
+ "notes": "resource byte-matches the §8.1 Bearer resource_metadata URL host; authorization_servers is ALWAYS a single-element array holding policy_response.authorizationServerIssuer byte-for-byte; the .NET v1 document does NOT emit the kyaos_needs_authorization extension the gateway-worker adds."
29
38
  }
30
39
  }
@@ -0,0 +1,51 @@
1
+ {
2
+ "$fixture": "kya-http/protected-resource-metadata.invalid-issuer",
3
+ "$spec": "RFC 9728 OAuth Protected Resource Metadata (advertised by draft-kya-http-02 §8.1)",
4
+ "description": "No PRM document for an issuer that is not an absolute https URI. Each case sets policy_response.authorizationServerIssuer to the case's value; a PEP treats that issuer as absent and answers /.well-known/oauth-protected-resource with the same 404 as protected-resource-metadata.no-issuer.json. An issuer a PEP may advertise is https:// directly followed by a host, with no whitespace, control character or backslash.",
5
+ "input": {
6
+ "resource_host": "api.merchant.com",
7
+ "policy_response": {
8
+ "projectId": "proj-merchant",
9
+ "enabled": true,
10
+ "blockThreshold": 80,
11
+ "defaultAction": "allow",
12
+ "denyList": [],
13
+ "allowList": [],
14
+ "pathRules": [],
15
+ "authorizationHost": "auth.merchant.com"
16
+ },
17
+ "scopes": ["commerce.checkout"],
18
+ "cases": [
19
+ {
20
+ "label": "an http issuer",
21
+ "authorizationServerIssuer": "http://auth.merchant.com/oauth/acme"
22
+ },
23
+ { "label": "a relative path", "authorizationServerIssuer": "/oauth/acme" },
24
+ { "label": "not a URI", "authorizationServerIssuer": "auth.merchant.com oauth acme" },
25
+ { "label": "a bare word", "authorizationServerIssuer": "acme" },
26
+ { "label": "whitespace only", "authorizationServerIssuer": " " },
27
+ {
28
+ "label": "an https issuer padded with whitespace",
29
+ "authorizationServerIssuer": " https://auth.merchant.com/oauth/acme "
30
+ },
31
+ { "label": "https with no host", "authorizationServerIssuer": "https:///oauth/acme" },
32
+ {
33
+ "label": "an https issuer with backslashes",
34
+ "authorizationServerIssuer": "https://auth.merchant.com\\oauth\\acme"
35
+ }
36
+ ]
37
+ },
38
+ "expected": {
39
+ "response": {
40
+ "status": 404,
41
+ "headers": {
42
+ "Content-Type": "application/json",
43
+ "Cache-Control": "no-store"
44
+ },
45
+ "body": { "error": "not_found" }
46
+ }
47
+ },
48
+ "conformance": {
49
+ "notes": "Every case gets the 404 and names no authorization server. Every PEP that serves the metadata URL (.NET net462 + net8, gateway worker) answers each case the same way; protected-resource-metadata.full.json is the https case that is served."
50
+ }
51
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "$fixture": "kya-http/protected-resource-metadata.no-issuer",
3
+ "$spec": "RFC 9728 OAuth Protected Resource Metadata (advertised by draft-kya-http-02 §8.1)",
4
+ "description": "No PRM document: the policy response carries no authorizationServerIssuer, so the platform names no authorization server for this project. A PEP answers /.well-known/oauth-protected-resource with 404 {\"error\":\"not_found\"} and never falls back to an issuer of its own (no BaseUrl origin, no slug from a DID). The counterpart of protected-resource-metadata.full.json.",
5
+ "input": {
6
+ "resource_host": "api.merchant.com",
7
+ "policy_response": {
8
+ "projectId": "proj-merchant",
9
+ "enabled": true,
10
+ "blockThreshold": 80,
11
+ "defaultAction": "allow",
12
+ "denyList": [],
13
+ "allowList": [],
14
+ "pathRules": [],
15
+ "authorizationHost": "auth.merchant.com"
16
+ },
17
+ "scopes": ["commerce.checkout"]
18
+ },
19
+ "expected": {
20
+ "response": {
21
+ "status": 404,
22
+ "headers": {
23
+ "Content-Type": "application/json",
24
+ "Cache-Control": "no-store"
25
+ },
26
+ "body": { "error": "not_found" }
27
+ }
28
+ },
29
+ "conformance": {
30
+ "notes": "The 404 names no authorization server. Every PEP that serves the metadata URL (.NET net462 + net8, gateway worker) answers this input the same way."
31
+ }
32
+ }