feat(compute-gateway): mount read-path masking PDP (policy veto + field masking + sealed decision) - #1157
Open
mdheller wants to merge 3 commits into
Open
feat(compute-gateway): mount read-path masking PDP (policy veto + field masking + sealed decision)#1157mdheller wants to merge 3 commits into
mdheller wants to merge 3 commits into
Conversation
…ld masking + sealed decision)
Mounts the masking moat on the one governed door. For read-effect kinds
(graph-query / graph-stats), engine.execute now passes dispatched outputs through
a field-level masking policy BETWEEN dispatch and seal, so the Ed25519 receipt
attests exactly what the caller received and the masking decision rides the same
attestation (the verifiable-evidence property WKC-style dynamic masking lacks).
compute_gateway/masking.py (new)
- OFF by default: no GATEWAY_MASKING_POLICY → exact passthrough (zero behaviour
change on the live gateway). Fail-closed WHEN configured.
- forbidden identity-mixture veto (e.g. no_health_adtech) → withholds records,
returns only the deny decision.
- field masking schemes (compact read subset of tokenization-profile.v1):
hmac_pseudonym (domain-scoped, deterministic), one_way_hash, redact, suppress,
generalize; unknown scheme fails closed to redact.
- emits identity-prime.masking-decision.v1 as a ComputeOutput → sealed + attested.
engine.py
- import masking; one guarded call between dispatch (raw) and seal, scoped to
masking.READ_KINDS. ~8 lines, no change to receipts.seal / signing.
tests/test_masking.py (6 tests): off-by-default passthrough, field masking + sealed
decision shape, forbidden-mixture deny/withhold, deterministic pseudonym, unknown
scheme fail-closed, invalid-policy disables-off. Existing engine-seal + gateway
suites unaffected (26 pass).
Canonical desensitisation primitives remain in the exodus reference engine
(exodus_tokenize / exodus_mask); Chameleon algebraic re-keying + NIST FF1 + HSM keys
swap in behind _transform with no PDP or caller change.
…ution
Follow-up to the masking mount: policy is no longer a single global env value.
GATEWAY_MASKING_POLICIES is a table {selector: policy} resolved by project, then
entitlement, then a "*"/"default" fallback — so different tenants/entitlements carry
different masking rules through the one gateway. Legacy single GATEWAY_MASKING_POLICY
remains the global fallback. Still off-by-default and fail-closed.
Tests: per-tenant selection, entitlement selector, legacy-global fallback (9 total).
…ant leak) Adversarial self-review before merge found a real defect in the masking mount: the compute memo keys reads by (project,kind,backend,spec) and serves any matching caller. Masking makes read results depend on actor/entitlement (per-tenant policy + forbidden-mixture veto), so a memoized masked read could be served to a DIFFERENT tenant — a cross-tenant data leak (under-masking) or wrong-policy masking. Fix: read_memo_spec() folds actor+entitlement into the memo spec for maskable read kinds, so masked reads are never shared across callers via the cache. Non-read kinds keep cross-caller memoization. Test asserts read keys differ by caller, match within a caller, and non-read keys are caller-independent. Full suite: 232 pass.
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.
Mounts the masking moat (P1 #5→serving) on
compute-gateway, the estate's one governed door — the smallest real increment from the A/B/C strategy read.What
For read-effect kinds (
graph-query/graph-stats),engine.executepasses the dispatched outputs through a field-level masking policy between dispatch and seal, so the existing Ed25519 receipt (receipts.seal/signing.attest) attests exactly what the caller received, and the masking decision itself is emitted as a sealed output — the verifiable-evidence property WKC-style dynamic masking does not produce.compute_gateway/masking.py(new): off by default (noGATEWAY_MASKING_POLICY→ exact passthrough, zero behaviour change on a live gateway); fail-closed when configured. Forbidden identity-mixture veto (no_health_adtech) withholds records; field schemes = compact read subset oftokenization-profile.v1(hmac_pseudonym,one_way_hash,redact,suppress,generalize); unknown scheme → redact. Emitsidentity-prime.masking-decision.v1.engine.py: import + one guarded call scoped toREAD_KINDS. No change toreceipts.seal/signing.Tests
tests/test_masking.py— 6 tests, all green. Existingtest_engine_seal+test_gateway(26) unaffected.Scope
Serving mount only. Canonical primitives stay in the exodus reference engine; Chameleon algebraic re-keying / NIST FF1 / HSM-held keys swap in behind
_transformwith no PDP or caller change. Policy wiring to per-tenant entitlement is the next increment.🤖 Generated with Claude Code