From 0e60e4970acd04d8ef03154d79a16e079625a087 Mon Sep 17 00:00:00 2001 From: Nimrod Busany Date: Fri, 27 Nov 2026 07:54:15 +0200 Subject: [PATCH] docs(content-identity): describe the custody, rotation and public-benchmark rules by name Replace internal ruling letters in content-identity descriptions, docs and a test docstring with plain names for each rule (key custody, rotation only on suspected compromise, public-benchmark opt-in), and drop backend file, symbol, branch and commit references from the content-identity endpoint descriptions. No schema semantics change; the parity stamp is refreshed. Spine-Trail: st_1804d64b88c6 Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 4 ++-- docs/identity/content-identity-v1.md | 20 +++++++++---------- parity/python-js-sdk.json | 2 +- tests/test_content_identity_endpoints.py | 2 +- .../datasets/content_identity_endpoints.json | 14 ++++++------- ...taset_public_benchmark_request_schema.json | 2 +- ...sion_content_identity_response_schema.json | 2 +- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 28acdcab..ccd56733 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -765,7 +765,7 @@ Unreleased changes are kept as fragments in changelog.d/; see changelog.d/README /api/v1/datasets/{dataset_id}/versions/{version_id}/content-identity` (new `HostedDatasetVersionContentIdentityV1`: available root + per-example map, or unavailable with a closed reason, incl. the creation-recorded `content_not_identifiable` / `keys_unavailable`), `GET /api/v1/datasets/versions/by-root/{dataset_root}` (DatasetVersionV1 list) - and `PUT /api/v1/datasets/{dataset_id}/public-benchmark` (ruling D3 opt-in). Request/response + and `PUT /api/v1/datasets/{dataset_id}/public-benchmark` (public-benchmark opt-in). Request/response schemas in `datasets/`; `purpose_key_grant_v1_schema.json` and `content_identity_v1_schema.json` are now reachable from the catalog graph. Additive; nothing existing changes. - **Content identity wire envelopes (M3 PR-S1).** `execution/content_identity_wire_v1_schema.json` @@ -786,7 +786,7 @@ Unreleased changes are kept as fragments in changelog.d/; see changelog.d/README `traigent_schema/data/content_identity_v1_vectors.json` (generator + freshness check: `scripts/generate_content_identity_v1_vectors.py --check`). `example_id` = HMAC-SHA-256 over jcs_v1 of the INPUT (+ context) under a per-tenant HKDF-derived key (tenant_id bound into every HKDF info; - key custody, rotation and the public-digest opt-in follow owner rulings D1-D3 = A, + key custody, rotation and the public-digest opt-in follow the settled rules, 2026-09-23); `example_version` = HMAC over example_id + expected output + version-relevant metadata; `dataset_root` / `evaluated_root` = RFC 9162 Merkle tree hash over sorted `[example_id, example_version, count]` diff --git a/docs/identity/content-identity-v1.md b/docs/identity/content-identity-v1.md index a0fbfd97..79e38fa2 100644 --- a/docs/identity/content-identity-v1.md +++ b/docs/identity/content-identity-v1.md @@ -122,7 +122,7 @@ kid = "k" + hex(HKDF-Expand(PRK, info("traigent.content_identity.key_ with high probability. Key lookups are therefore always **tenant-scoped** (`(tenant_id, kid)`, never `kid` alone). A `kid` collision among one tenant's key versions is a **hard error at key creation**: the Backend discards the new master and generates another. -- The master must be exactly 32 bytes and SHOULD be unique per tenant (ruling D1). +- The master must be exactly 32 bytes and SHOULD be unique per tenant (key custody rule). - The tenant id is bound into every HKDF `info` (review item F2, adopted 2026-09-23). If a master is ever reused by mistake across two tenants, their keys, `kid`s and ids are still unrelated. The `reused_master_other_tenant` vector pins this. @@ -543,7 +543,7 @@ What the spec fixes: - The SDK receives **derived purpose keys**, never the master. Custody, rotation and the public-digest opt-in are settled by the owner rulings in section 16 -(D1 = A, D2 = A, D3 = A, 2026-09-23). +(2026-09-23). ## 13. Statistical use @@ -571,7 +571,7 @@ Custody, rotation and the public-digest opt-in are settled by the owner rulings |---|---|---| | Equality leak inside a tenant | Anyone who sees ids | Equal inputs have equal ids. This is intended, because it is what makes overlap checks work | | Dictionary attack on low-entropy inputs ("yes", a 4-digit PIN) | Only holders of `K_example_id`, meaning the tenant's own SDK users and the Backend | Keyed ids stop outsiders, including other tenants and certificate readers, from confirming guesses. They do **not** hide low-entropy inputs from the tenant's own key holders. Ids are not encryption | -| Key compromise | Whoever holds the key | Every id under that `kid` becomes open to dictionary attack. Rotate (D2), which changes every id | +| Key compromise | Whoever holds the key | Every id under that `kid` becomes open to dictionary attack. Rotate (rotation rule), which changes every id | | Cross-tenant linkage | Nobody | Different masters, and a different `tenant_id` in the HKDF `info` even if a master were reused, make the ids unlinkable. `kid` links ids within one tenant only | | Unkeyed `exu1` digest | Anyone | Confirms guessed inputs. Opt-in, public benchmarks only (4.5) | | Member lists and counts | Readers of the record | Disclose dataset size, duplicate structure and conflict count. No content | @@ -616,7 +616,7 @@ Custody, rotation and the public-digest opt-in are settled by the owner rulings The three decisions this spec left open were ruled by the owner on 2026-09-23. The recommended option was taken in each case. -**D1 = A: custody.** Each tenant has one random 32-byte master per key version. +**Key custody.** Each tenant has one random 32-byte master per key version. - The Backend holds it in KMS/Vault (envelope-encrypted). It never leaves the Backend. - Authenticated SDK sessions receive only the two derived purpose keys plus `kid`. The SDK keeps them in memory and never on disk. @@ -624,16 +624,16 @@ recommended option was taken in each case. can hash locally without content leaving the machine. - Not chosen: B (every tenant key derived from one platform root) and C (customer-held keys). -**D2 = A: rotation.** Keys are rotated only on suspected compromise, not on a schedule. +**Rotation.** Keys are rotated only on suspected compromise, not on a schedule. - On rotation, the Backend recomputes ids for stored content under the new `kid` and keeps an `old id → new id` map. SDK-local datasets are re-hashed by the SDK. - Certificates are never rewritten. They stay verifiable under the `kid` they carry. -**D3 = A: public-benchmark opt-in.** A per-dataset flag, `public_benchmark: true`, settable by +**Public-benchmark opt-in.** A per-dataset flag, `public_benchmark: true`, settable by a tenant admin. It gates the unkeyed `exu1` digest. - The flag is off by default. It never becomes tenant-wide. -**F2 (review item), adopted with D1:** `tenant_id` is bound into every HKDF `info` (section 3). +**Adopted with the key custody rule:** `tenant_id` is bound into every HKDF `info` (section 3). - This is defence in depth against a master reused by mistake. - It changed every derived key, id and vector. That was done before any adoption, still under `traigent.content_identity.v1`, because nothing had shipped. @@ -732,8 +732,8 @@ is `tests/test_example_identity.py` ("Conformance vectors"). **Backend** -1. Implement key custody per ruling D1 (KMS/Vault, one master per tenant per key version), - rotation per D2, and the per-dataset `public_benchmark` flag per D3. Add a purpose-key +1. Implement key custody (KMS/Vault, one master per tenant per key version), + rotation only on suspected compromise, and the per-dataset `public_benchmark` flag (public-benchmark opt-in). Add a purpose-key issuance endpoint that returns `{tenant_id, kid, example_id_key, example_version_key}` (`PurposeKeyGrantV1`, section 18) and a key registry @@ -769,7 +769,7 @@ Backend's response to an authenticated session: - `encoding` is always `"hex"`. A consumer rejects any other value rather than guessing. - The two keys are **secrets**. They are never logged, written to disk, echoed in an error, exported or forwarded. SDKs hold them in memory only and redact them from every rendering. -- The grant never contains the tenant master (ruling D1). +- The grant never contains the tenant master (key custody rule). **Two envelopes.** Both carry `scheme` and `provenance: "declared"`. Everything in them is a client declaration: the Backend stores it, recomputes it and labels it (section 11). A declared diff --git a/parity/python-js-sdk.json b/parity/python-js-sdk.json index 4c6a1b16..5a4b4858 100644 --- a/parity/python-js-sdk.json +++ b/parity/python-js-sdk.json @@ -399,7 +399,7 @@ "sdk032Surface": "Manifest Python pin advanced from d56e4353 to 6e8e4a54 (origin/develop, the SDK 0.32.0 release candidate) to cover two root exports the js-public-parity gate flagged unclassified on Traigent/Traigent#2861. requirement (traigent.runtime.decorator) is the runtime latency requirement decorator; traigent-js origin/main and origin/develop both export requirement from src/runtime/index.ts and list it in tests/integration/fixtures/api-surface.snapshot.json, so it is classified matched and added to requiredRootExports next to require. SnapshotBindingError (traigent.utils.exceptions) is the typed error of the Python opt-in snapshot store (S0 before dispatch, S1 from the terminal result, online G1); traigent-js has no snapshot store and no export of it (zero occurrences in src or its api-surface snapshot), so it is classified deferred-backlog, Python-only for now with no open JS design and no ticket. Owner may re-bucket." }, "schemaRefresh": { - "lastSchemaFileSha": "ddec1043f75ac9746794c230d65ed33462fd996d6d8bbcc13efd85f56967ae62", + "lastSchemaFileSha": "39c897193c3c90b92dea16db9f9862cc70ae7bc92c9e80231c1750febb1041fa", "schemaFileCount": 692, "note": "Auto-stamped by scripts/refresh_parity.py. Do not hand-edit this block." } diff --git a/tests/test_content_identity_endpoints.py b/tests/test_content_identity_endpoints.py index 9f5efe42..774c822e 100644 --- a/tests/test_content_identity_endpoints.py +++ b/tests/test_content_identity_endpoints.py @@ -5,7 +5,7 @@ * POST /api/v1/content-identity/purpose-keys -> bare PurposeKeyGrantV1, no-store; * GET /api/v1/datasets/{dataset_id}/versions/{version_id}/content-identity; * GET /api/v1/datasets/versions/by-root/{dataset_root}; -* PUT /api/v1/datasets/{dataset_id}/public-benchmark (ruling D3). +* PUT /api/v1/datasets/{dataset_id}/public-benchmark (public-benchmark opt-in). The valid bodies below mirror the Backend's own serializers (HostedDatasetIdentityView.to_wire / unavailable_wire, DatasetVersion.to_dict, diff --git a/traigent_schema/schemas/datasets/content_identity_endpoints.json b/traigent_schema/schemas/datasets/content_identity_endpoints.json index 3f4c2826..8acaa9b9 100644 --- a/traigent_schema/schemas/datasets/content_identity_endpoints.json +++ b/traigent_schema/schemas/datasets/content_identity_endpoints.json @@ -3,13 +3,13 @@ "info": { "title": "Traigent Backend Content Identity Routes", "version": "1.0.0", - "description": "Content identity v1 routes (docs/identity/content-identity-v1.md; Backend milestone M3): the tenant purpose-key grant the SDKs need to mint example ids, the server-computed identity of a hosted dataset version, root-to-version resolution, and the per-dataset public-benchmark opt-in (ruling D3). Declared ahead of the Backend merge: each operation is x-asserted-against-backend false until the Backend branches (feat/content-identity-key-custody, feat/content-identity-dataset-root) land on develop with parity tests." + "description": "Content identity v1 routes (docs/identity/content-identity-v1.md): the tenant purpose-key grant the SDKs need to mint example ids, the server-computed identity of a hosted dataset version, root-to-version resolution, and the per-dataset public-benchmark opt-in. Each operation is x-asserted-against-backend false until the backend implementation lands with parity tests." }, "paths": { "/api/v1/content-identity/purpose-keys": { "post": { "summary": "Issue the caller tenant's content-identity purpose keys", - "description": "TraigentBackend src/routes/content_identity_routes.py issue_purpose_keys. The tenant is the auth stack's binding (get_current_tenant_id), never a header or the body. Same permission as creating an optimization session (experiment.write); an API key stating a foreign X-Tenant-Id frame is answered 404. Every grant is audited (CONTENT_IDENTITY_PURPOSE_KEYS_ISSUED, kid only); a grant that cannot be audited is not issued (503). Rate limited per route (defaults 2/s, 30/min, 600/h, 5000/day). Excluded from the idempotency replay cache so key material is never persisted.", + "description": "The tenant is the authenticated binding, never a header or the body. Same permission as creating an optimization session (experiment.write); an API key stating a foreign X-Tenant-Id frame is answered 404. Every grant is audited (key id only); a grant that cannot be audited is not issued (503). Rate limited per route (defaults 2/s, 30/min, 600/h, 5000/day). Excluded from the idempotency replay cache so key material is never persisted.", "operationId": "issueContentIdentityPurposeKeys", "x-asserted-against-backend": false, "x-wrap-status": "bare", @@ -39,7 +39,7 @@ "content": {"application/json": {"schema": {"$ref": "../error_envelope_schema.json"}}} }, "403": { - "description": "Missing experiment.write (the auth stack's envelope), or no tenant context: the standard error envelope with error = error_code = tenant_context_required, sent with Cache-Control: no-store (TraigentBackend cc019c7a0).", + "description": "Missing experiment.write (the auth stack's envelope), or no tenant context: the standard error envelope with error = error_code = tenant_context_required, sent with Cache-Control: no-store.", "content": {"application/json": {"schema": {"$ref": "../error_envelope_schema.json"}}} }, "404": { @@ -57,7 +57,7 @@ "content": {"application/json": {"schema": {"$ref": "../error_envelope_schema.json"}}} }, "503": { - "description": "Keys unavailable: custody not configured, a stored master that fails a custody check, or the grant's audit record could not be written. The standard error envelope with error = error_code = content_identity_keys_unavailable, sent with Cache-Control: no-store (TraigentBackend cc019c7a0); SDKs degrade to key_status unavailable. The internal custody reason (e.g. wrap_scheme_mismatch, wrapping_key_ref_mismatch, tenant_id_not_derivable) is logged and never sent: no other code and no details object is allowed. A rate limiter that cannot evaluate answers the masked 5xx envelope (error Internal server error, error_code RATE_LIMIT_UNAVAILABLE).", + "description": "Keys unavailable: custody not configured, a stored master that fails a custody check, or the grant's audit record could not be written. The standard error envelope with error = error_code = content_identity_keys_unavailable, sent with Cache-Control: no-store; SDKs degrade to key_status unavailable. The internal custody reason is logged and never sent: no other code and no details object is allowed. A rate limiter that cannot evaluate answers the masked 5xx envelope (error Internal server error, error_code RATE_LIMIT_UNAVAILABLE).", "content": { "application/json": { "schema": { @@ -97,7 +97,7 @@ "summary": "Get a hosted dataset version's server-computed content identity", "deprecated": true, "x-deprecated": "Use GET /api/v1/projects/{project_id}/datasets/{dataset_id}/versions/{version_id}/content-identity. Removal is unscheduled.", - "description": "TraigentBackend src/routes/dataset_version_routes.py get_dataset_version_content_identity. Read access to the dataset (project viewer) through the owner-scoped parent load. Returns the identity under the tenant's ACTIVE key (root, counts, members_ref and the per-example map), re-verified on every read; or status unavailable with a reason. The version object (DatasetVersionV1) is unchanged.", + "description": "Read access to the dataset (project viewer) through the owner-scoped parent load. Returns the identity under the tenant's ACTIVE key (root, counts, members_ref and the per-example map), re-verified on every read; or status unavailable with a reason. The version object (DatasetVersionV1) is unchanged.", "operationId": "getDatasetVersionContentIdentity", "x-asserted-against-backend": false, "x-wrap-status": "wrapped", @@ -119,7 +119,7 @@ "/api/v1/datasets/versions/by-root/{dataset_root}": { "get": { "summary": "Resolve a dataset_root to the caller's dataset versions", - "description": "TraigentBackend src/routes/dataset_version_routes.py get_dataset_versions_by_root. Tenant from the canonical context; each match filtered through the owner-scoped parent dataset load.", + "description": "Tenant from the canonical context; each match filtered through the owner-scoped parent dataset load.", "operationId": "getDatasetVersionsByRoot", "x-asserted-against-backend": false, "x-wrap-status": "wrapped", @@ -149,7 +149,7 @@ "summary": "Set or clear the dataset's public-benchmark opt-in", "deprecated": true, "x-deprecated": "Use PUT /api/v1/projects/{project_id}/datasets/{dataset_id}/public-benchmark. Removal is unscheduled.", - "description": "TraigentBackend src/routes/dataset_version_routes.py set_dataset_public_benchmark. Requires dataset write access and project editor role, THEN tenant owner/admin (or platform admin) membership; API-key principals are refused even when the key's owner is a tenant admin. A refusal is audited (ACCESS_DENIED, reason tenant_admin_required); a change is audited (DATASET_PUBLIC_BENCHMARK_CHANGED) and not applied if the audit write fails. The Backend also emits the flag as public_benchmark on the dataset read (Benchmark.to_dict); dataset_schema.json is closed and does not declare it yet -- adding it is a separately acknowledged contract change (breaking_schema_check classifies it property_added on a closed schema).", + "description": "Requires dataset write access and project editor role, THEN tenant owner/admin (or platform admin) membership; API-key principals are refused even when the key's owner is a tenant admin. Refusals and changes are audited; a change is not applied if its audit write fails. The flag is also returned as public_benchmark on the dataset read; dataset_schema.json is closed and does not declare it yet, so adding it is a separate, acknowledged contract change.", "operationId": "setDatasetPublicBenchmark", "x-asserted-against-backend": false, "x-wrap-status": "wrapped", diff --git a/traigent_schema/schemas/datasets/dataset_public_benchmark_request_schema.json b/traigent_schema/schemas/datasets/dataset_public_benchmark_request_schema.json index ecec14e9..3f4f18ae 100644 --- a/traigent_schema/schemas/datasets/dataset_public_benchmark_request_schema.json +++ b/traigent_schema/schemas/datasets/dataset_public_benchmark_request_schema.json @@ -2,7 +2,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://schemas.traigent.ai/datasets/dataset_public_benchmark_request_schema.json", "title": "Dataset Public Benchmark Request", - "description": "PUT /api/v1/datasets/{dataset_id}/public-benchmark request body: set or clear the dataset's public-benchmark opt-in (content identity ruling D3, docs/identity/content-identity-v1.md). While set, hosted version content-identity reads also carry each example's UNKEYED public_input_digest (exu1:) for cross-tenant contamination checks. Only a tenant owner/admin (or platform admin) may change it, and never through an API key; the generic dataset create/update bodies cannot set it.", + "description": "PUT /api/v1/datasets/{dataset_id}/public-benchmark request body: set or clear the dataset's public-benchmark opt-in (content identity public-benchmark opt-in, docs/identity/content-identity-v1.md). While set, hosted version content-identity reads also carry each example's UNKEYED public_input_digest (exu1:) for cross-tenant contamination checks. Only a tenant owner/admin (or platform admin) may change it, and never through an API key; the generic dataset create/update bodies cannot set it.", "version": "1.0.0", "type": "object", "additionalProperties": false, diff --git a/traigent_schema/schemas/datasets/dataset_version_content_identity_response_schema.json b/traigent_schema/schemas/datasets/dataset_version_content_identity_response_schema.json index 67b2d4ec..a2254161 100644 --- a/traigent_schema/schemas/datasets/dataset_version_content_identity_response_schema.json +++ b/traigent_schema/schemas/datasets/dataset_version_content_identity_response_schema.json @@ -37,7 +37,7 @@ }, "public_input_digest": { "$ref": "content_identity_v1_schema.json#/definitions/PublicInputDigestV1", - "description": "OPT-IN, UNKEYED exu1 digest of the example's input. Present ONLY while the parent dataset's public_benchmark flag is set (ruling D3; PUT /api/v1/datasets/{dataset_id}/public-benchmark); never stored, computed per read from the snapshot. Absent in every other case, including on every other dataset read surface." + "description": "OPT-IN, UNKEYED exu1 digest of the example's input. Present ONLY while the parent dataset's public_benchmark flag is set (public-benchmark opt-in; PUT /api/v1/datasets/{dataset_id}/public-benchmark); never stored, computed per read from the snapshot. Absent in every other case, including on every other dataset read surface." } } },