-
Notifications
You must be signed in to change notification settings - Fork 0
fix(authz): protect purpose-bound runtime integrity #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
seonghobae
wants to merge
243
commits into
develop
Choose a base branch
from
fix/purpose-bound-authorization-runtime-integrity
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 2 commits
Commits
Show all changes
243 commits
Select commit
Hold shift + click to select a range
7d48354
test(authz): reject runtime type-confusion inputs
seonghobae c8cb0b0
fix(authz): protect purpose-bound runtime types
seonghobae 3d3c81c
test(authz): reject hostile text and set subclasses
seonghobae 7bb7bda
fix(authz): require exact text and set runtime types
seonghobae c8b7f30
docs(authz): record runtime integrity hardening
seonghobae 9d0074c
chore(authz): adopt protected develop without rewriting runtime harde…
seonghobae b568b40
test(authz): reject malformed authorization decision evidence
seonghobae c35d434
fix(authz): validate authorization decision runtime evidence
seonghobae 57e938e
test(authz): reject contradictory decision evidence
seonghobae fc89394
fix(authz): bind decision reasons to recovery evidence
seonghobae 1693abd
test(authz): preserve non-authoritative recovery guidance
seonghobae e46314c
fix(authz): keep recovery guidance non-authoritative
seonghobae 64a6a56
test(authz): keep denial vocabulary extensible
seonghobae edbd073
fix(authz): bind verdict polarity without closing denial codes
seonghobae bed6809
test(authz): reject decision subclass validator bypass
seonghobae 7239eac
fix(authz): seal authorization decision validation
seonghobae 1ccada3
test(authz): prove decision evidence resists low-level mutation
seonghobae 0d22689
test(authz): prove issued decision detaches caller UUID state
seonghobae 5a2bde8
test(authz): reject corrupted exact UUID decision evidence
seonghobae a10468f
fix(authz): make issued decisions structurally immutable
seonghobae 23e2c6e
test(authz): cover immutable decision issuance lifecycle
seonghobae 1a90211
test(authz): reproduce post-construction policy/request rewrite
seonghobae 250c852
fix(authz): bind evaluation to issued policy and request snapshots
seonghobae 7982463
test(authz): require side-effect-free issued input reinitialization
seonghobae 2318ff8
fix(authz): guard issued policy and request reinitialization
seonghobae e92d2ac
test(authz): align invalid reinitialization lifecycle expectations
seonghobae 0fef3f8
test(authz): reject direct post-init issuance
seonghobae dc94588
fix(authz): bind snapshot issuance to constructor lifecycle
seonghobae 269b521
test(authz): require evaluator-issued decisions
seonghobae ffdf141
fix(authz): bind decisions to evaluator issuance
seonghobae 01b55d0
test(authz): align decision integrity with evaluator issuance
seonghobae 99459d8
test(people): issue authorization fixtures through evaluator
seonghobae 83870fc
test(people): derive reason-binding authorization
seonghobae b43931a
test(people): derive evidence-binding authorization
seonghobae bc2cf64
test(people): use evaluated postgres authorization
seonghobae cdf21f0
test(people): derive mutation digest authorization
seonghobae c59359e
test(people): use evaluated hire authorization
seonghobae 2351bd0
docs(authz): trace evaluator-issued decision authority
seonghobae b75fb41
chore(manifest): record authorization traceability
seonghobae 7aebe4e
test(authz): reject fabricated decision helper issuance
seonghobae 2b52217
fix(authz): keep decision issuance evaluator-local
seonghobae 1e0c124
test(authz): seal evaluator-local issuance lifecycle
seonghobae 98ad797
test(authz): reject direct decision registry forgery
seonghobae fc4fb5c
test(authz): model read-only registry repair
seonghobae 3ea988e
fix(authz): hide decision registry mutation capability
seonghobae 05d54af
test(authz): hide decision registry from module consumers
seonghobae a5d5983
fix(authz): remove module-visible decision registry
seonghobae b190b79
test(authz): reject module-level input issuance capability forgery
seonghobae 52e3940
fix(authz): privatize input issuance capabilities
seonghobae 611ebe8
refactor(authz): make input issuance closure-native
seonghobae b08d1e4
test(authz): reproduce closure-cell issuance forgery
seonghobae df99052
fix(authz): anchor authority at service trust boundary
seonghobae c2105d2
test(authz): bind provenance assertions to service TCB
seonghobae eed5c96
test(authz): revalidate live values without fake issuance state
seonghobae 0ad7b91
test(authz): stop treating Python object provenance as authority
seonghobae 5f809a1
test(authz): validate decision data at consumer boundary
seonghobae a3a943c
feat(authz): expose decision revalidation contract
seonghobae 6ed5ec1
test(authz): cover durable decision revalidation boundary
seonghobae 427a31f
docs(authz): anchor policy authority at trusted composition
seonghobae b141870
chore(manifest): reseal authorization traceability
seonghobae acf54ef
fix(manifest): restore full inventory after reseal error
seonghobae bf66cf4
chore(manifest): reseal authorization traceability
seonghobae f1abd66
fix(manifest): restore criterion ADR inventory path
seonghobae 9e9a16a
test(people): require durable authorization revalidation
seonghobae b3cec0c
fix(people): revalidate decisions before durable digests
seonghobae 79e0669
fix(people): revalidate hire authorization before persistence
seonghobae 7d2d319
fix(people): revalidate mutation authorization before SQL
seonghobae e2db55a
test(people): require authorization revalidation before DB acquisition
seonghobae 311b421
test(people): align digest validation error contract
seonghobae 9d22d2e
test(authz): reproduce job-analysis audit authority drift
seonghobae 307725f
fix(authz): bind job-analysis audit authority before persistence
seonghobae 1149960
test(authz): reject executable Job Analysis audit subtypes
seonghobae 33e1463
fix(authz): reject executable Job Analysis audit subtypes
seonghobae c4c96ae
test(authz): prove audit exact-type check precedes subtype access
seonghobae 92d87c8
test(job-analysis): reproduce executable snapshot subtype trust breach
seonghobae d886623
fix(job-analysis): reject snapshot subtypes before command digest
seonghobae fc986dd
fix(job-analysis): reject snapshot subtype at PostgreSQL authority
seonghobae 43c6e61
test(job-analysis): reproduce executable snapshot result subtype breach
seonghobae c5b39ad
fix(job-analysis): reject executable snapshot port results
seonghobae 1c0fa1e
test(job-analysis): reproduce write-port snapshot alias mutation
seonghobae 39f57fd
fix(job-analysis): detach authorized snapshot before persistence
seonghobae 1d44c71
test(authz): bind decision reason and next action semantics
seonghobae 8113609
fix(authz): bind decision recovery evidence to verdict
seonghobae 0a54a06
test(authz): align runtime oracle with governed recovery evidence
seonghobae 6127146
test(auth): reject People principal runtime subtypes
seonghobae 92d481f
test(auth): reject Job Analysis principal runtime subtypes
seonghobae bf62ebb
fix(auth): reject People principal runtime subtypes
seonghobae 9d9ebd3
fix(auth): reject Job Analysis principal runtime subtypes
seonghobae f764104
test(auth): reject executable People principal subclasses
seonghobae c671c12
test(auth): reject executable Job Analysis principal subclasses
seonghobae 88312c4
fix(auth): seal People authenticated principal runtime class
seonghobae 2b6b617
fix(auth): seal Job Analysis authenticated principal runtime class
seonghobae d1fba05
test(auth): detach People principal tenant UUID evidence
seonghobae b6fa64c
test(auth): detach Job Analysis principal tenant UUID evidence
seonghobae d3fbc97
fix(auth): detach People principal tenant UUID evidence
seonghobae b5f4a1d
fix(auth): detach Job Analysis principal tenant UUID evidence
seonghobae 73e5b5c
test(auth): reproduce principal evidence rewrite
seonghobae 59c37bc
test(auth): reproduce job-analysis principal rewrite
seonghobae 2225c3d
fix(auth): make People principal structurally immutable
seonghobae a4e84c4
fix(auth): make Job Analysis principal structurally immutable
seonghobae eb4a177
test(auth): preserve principal value semantics
seonghobae 1ceca38
test(auth): preserve job-analysis principal value semantics
seonghobae f35ee42
fix(auth): preserve strict People principal equality
seonghobae e588c91
fix(auth): preserve strict Job Analysis principal equality
seonghobae 5e1eb4a
fix(auth): keep principal inequality strict
seonghobae 92f7eb4
test(auth): protect returned tenant UUID evidence
seonghobae 64deb92
fix(auth): detach returned People tenant UUID
seonghobae b468acc
fix(auth): detach returned Job Analysis tenant UUID
seonghobae 1d13d6d
test(people): expose tuple principal validation bypass
seonghobae 1d2eec5
test(job-analysis): expose tuple principal validation bypass
seonghobae 3fcbe76
fix(people): revalidate tuple-backed principal storage
seonghobae 7e5fc43
fix(job-analysis): revalidate tuple-backed principal storage
seonghobae e505b92
test(people): reject malformed principal sequence access
seonghobae 8780c1a
test(job-analysis): reject malformed principal sequence access
seonghobae 6d61dbe
fix(people): validate principal sequence views
seonghobae 02568d0
fix(job-analysis): validate principal sequence views
seonghobae 93c0f16
test(people): preserve validated principal sequence semantics
seonghobae 934bb4d
test(job-analysis): preserve validated principal sequence semantics
seonghobae 5755c4d
test(people): cover remaining principal tuple operations
seonghobae 39208df
test(job-analysis): cover remaining principal tuple operations
seonghobae e7aff6a
fix(people): revalidate all ordinary tuple operations
seonghobae 43821d8
fix(job-analysis): revalidate all ordinary tuple operations
seonghobae 58e4447
test(job-analysis): reject malformed durable command scalars before DB
seonghobae 2c8a114
fix(job-analysis): validate durable command scalars before DB
seonghobae d8b2260
test(authz): reject mutable or spoofed operational UUID evidence
seonghobae 51a4fa5
fix(authz): detach exact operational UUID evidence
seonghobae ae0c8c8
test(authz): detach validated UUIDs at PostgreSQL boundary
seonghobae 9058e0c
fix(authz): retain detached UUIDs at PostgreSQL boundary
seonghobae 2d174f6
test(authz): reject durable authority text subtypes before PostgreSQL
seonghobae cf14ca8
fix(authz): exact-gate durable actor and purpose text
seonghobae f6b0d2c
test(security): reject forged durable audit authority text
seonghobae bd32e25
fix(security): snapshot durable audit authority before PostgreSQL
seonghobae abb9286
test(security): detect audit authority drift during canonicalization
seonghobae 4cfa2bf
fix(security): verify frozen audit bytes match detached authority
seonghobae c788710
test(security): bind durable job-analysis audit semantics
seonghobae 0ae7890
fix(security): bind durable job-analysis audit semantics
seonghobae 1665f74
test(job-analysis): reproduce snapshot mutation across DB acquisition
seonghobae f8543a7
fix(job-analysis): detach snapshot before database hooks
seonghobae 522559b
test(job-analysis): cover noncanonical snapshot rejection
seonghobae abb0916
refactor(job-analysis): keep snapshot detachment coverage exact
seonghobae 8005a44
test(job-analysis): reproduce unbound durable request digest
seonghobae 2780bca
fix(job-analysis): bind durable request digest to detached command
seonghobae f7e42ab
test(job-analysis): reject replay bound to another snapshot
seonghobae 14c2b81
fix(job-analysis): bind idempotent replay to snapshot identity
seonghobae 85beec4
test(job-analysis): cover malformed durable replay identity
seonghobae 6ae246b
test(job-analysis): bind replayed snapshot to command digest
seonghobae 462953a
fix(job-analysis): verify replay content against command digest
seonghobae def403c
test(job-analysis): reject malformed durable replay command rows
seonghobae cf5c9a6
fix(job-analysis): revalidate durable replay command evidence
seonghobae d355bbe
test(job-analysis): align replay fixtures with durable SQL row
seonghobae 84e9c75
test(job-analysis): align concurrency replay sentinel
seonghobae a16b46f
test(job-analysis): reject partial-null replay command evidence
seonghobae 1bb57bd
fix(job-analysis): fail closed on partial-null replay evidence
seonghobae 3598b46
test(job-analysis): fail closed on missing idempotency projection
seonghobae 521011f
fix(job-analysis): require idempotency lookup projection
seonghobae 5b95eb4
test(job-analysis): model idempotency LEFT JOIN absence projection
seonghobae 59e9a46
test(job-analysis): preserve missing-projection regression
seonghobae 7002ff3
test(job-analysis): bind scope projections to requested identities
seonghobae 013664c
fix(job-analysis): verify scope projection identities
seonghobae aed5eda
test(job-analysis): reject forged scope projection UUIDs
seonghobae 94d9cf7
fix(job-analysis): validate scope projection UUID evidence
seonghobae 9a97294
repair(job-analysis): keep scope fix causally minimal
seonghobae 8d324b8
test(job-analysis): reject forged scope relationship UUIDs
seonghobae 47074ca
fix(job-analysis): validate scope relationship UUID evidence
seonghobae a6ef26a
test(job-analysis): reject malformed scope projection shapes
seonghobae 2a14b10
test(job-analysis): cover non-sequence scope projection rows
seonghobae 0220e5a
fix(job-analysis): validate scope projection cardinality
seonghobae e022fe5
test(job-analysis): reject iterable non-row projections
seonghobae 278a032
fix(job-analysis): require sequence scope projections
seonghobae f31f198
test(job-analysis): reject malformed durable read projections
seonghobae df92a02
fix(job-analysis): validate durable read projections
seonghobae 84df3b7
test(job-analysis): cover failing sequence materialization
seonghobae bf447c7
test(auth): reject executable bearer header subtype
seonghobae 9ff282d
test(auth): mirror executable bearer-header regression
seonghobae dfc0efe
fix(auth): reject executable bearer header values
seonghobae 964391c
fix(auth): mirror bearer header exact-type gate
seonghobae f526259
test(job-analysis): reject iterable idempotency projection rows
seonghobae 64d1a4c
fix(job-analysis): validate idempotency projection row kind
seonghobae 1119741
test(job-analysis): reject executable idempotency-key text
seonghobae 6c8c944
fix(job-analysis): gate idempotency key before sequence hooks
seonghobae 84312a2
test(job-analysis): reject executable fixed projection rows
seonghobae 995e61b
fix(job-analysis): reject executable fixed projection rows
seonghobae b192bbc
docs(job-analysis): narrow fixed-row driver contract
seonghobae 410db05
fix(job-analysis): restore runtime after driver-contract doctoring
seonghobae b61bda6
test(job-analysis): reject executable DB row collections
seonghobae 97232d8
test(job-analysis): repair row-collection RED fixture
seonghobae 0567b4f
fix(job-analysis): seal DB row collections before projection reads
seonghobae 912e52d
test(job-analysis): reject executable durable audit time
seonghobae 8fa3db6
fix(job-analysis): seal durable audit time runtime type
seonghobae 6773a04
fix(job-analysis): repair audit-time successor transcription
seonghobae 348c6e5
fix(job-analysis): restore canonical postgres source after failed edit
seonghobae cec9eb8
fix(job-analysis): seal durable audit time before canonicalization
seonghobae a57d584
fix(job-analysis): restore canonical postgres source after rejected edit
seonghobae 2c8ab24
chore(job-analysis): defer audit time type gate to canonical kernel o…
seonghobae 854444f
test(job-analysis): reject executable driver error metadata
seonghobae 9a5f1de
fix(job-analysis): normalize inert driver error metadata
seonghobae b0055c4
test(job-analysis): reject polymorphic error metadata lookup
seonghobae c71fc77
fix(job-analysis): statically read driver error metadata
seonghobae b60793a
test(job-analysis): decouple conflicts from driver diagnostics
seonghobae 3a403a5
test(job-analysis): narrow driver contract to SQLSTATE evidence
seonghobae b051272
fix(job-analysis): decouple conflicts from driver diagnostics
seonghobae d47c962
test(job-analysis): reject executable snapshot document inputs
seonghobae 106cff6
test(job-analysis): reject executable snapshot field names
seonghobae 48cb282
test(job-analysis): reject executable timezone providers
seonghobae aa72ca1
fix(job-analysis): exact-gate posted snapshot runtime types
seonghobae 8b8ee60
test(job-analysis): reject executable snapshot scalar leaves
seonghobae e0814b8
fix(job-analysis): exact-gate snapshot scalar evidence
seonghobae e2cb31e
test(job-analysis): cover exact boolean snapshot flag
seonghobae 4973243
test(job-analysis): reject executable read target identities
seonghobae e1f483c
fix(job-analysis): validate returned snapshot target identities
seonghobae 554ed9d
test(job-analysis): reject executable returned snapshot graph
seonghobae 3d8cca2
fix(job-analysis): validate returned snapshot graph before export
seonghobae 9cf0ff3
test(job-analysis): reject executable write-port result graph
seonghobae d378a93
fix(job-analysis): validate persisted snapshot graph before export
seonghobae 9109f19
test(job-analysis): reproduce returned graph validation export gap
seonghobae ea0ec9e
fix(job-analysis): emit captured returned snapshot evidence
seonghobae 6aab0c9
test(job-analysis): reproduce post-port input target alias execution
seonghobae 5497a9b
fix(job-analysis): detach posted target before write port
seonghobae f8fdc39
test(job-analysis): reproduce nested returned owner drift
seonghobae b2541fd
fix(job-analysis): reject returned ownership drift
seonghobae 09b321e
test(job-analysis): reject executable stored snapshot digest
seonghobae 5e6b631
fix(job-analysis): exact-validate stored snapshot digest
seonghobae 9aee97d
test(job-analysis): reject executable stored job identity
seonghobae 58e0c6b
test(job-analysis): reject executable durable snapshot scalars
seonghobae 4267092
fix(job-analysis): detach durable snapshot scalars
seonghobae 201c675
test(job-analysis): preserve psycopg3 ZoneInfo timestamptz
seonghobae 79ad46b
fix(job-analysis): preserve standard timestamptz adapters
seonghobae 5b49fb1
test(job-analysis): reject executable timezone evidence
seonghobae f953dda
test(job-analysis): preserve ZoneInfo through governed read
seonghobae b1e6017
fix(job-analysis): preserve ZoneInfo through read export
seonghobae a0260ae
test(auth): bound job-analysis authorization header before parsing
seonghobae cb0b999
test(auth): mirror People authorization header budget
seonghobae 5660fc6
fix(auth): bound job-analysis header before bearer parsing
seonghobae 39b6a3f
fix(auth): mirror People header budget before parsing
seonghobae 9102e9a
merge(authz): adopt protected workflow consolidation
seonghobae 375b91f
merge(authz): preserve #161 changelog delta after restack
seonghobae 50fd315
fix(ci): reseal foundation manifest after protected restack
seonghobae 200cc2a
test(job-analysis): reject executable durable audit scalar evidence
seonghobae 47059d8
test(job-analysis): align durable audit acceptance with shared-kernel…
seonghobae fee1989
test(job-analysis): satisfy runtime tripwire protocols
seonghobae e1471be
test(job-analysis): avoid unused subclass binding
seonghobae 8f6a5fe
test(people): avoid unused subclass binding
seonghobae 1caf8f7
test(authz): avoid unused subclass binding
seonghobae File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
121 changes: 121 additions & 0 deletions
121
packages/keyverse-adapter/tests/test_authorization_runtime_integrity.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| """Runtime-type integrity regressions for purpose-bound authorization.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from uuid import UUID | ||
|
|
||
| import pytest | ||
|
|
||
| from orgmetra_keyverse_adapter.authorization import ( | ||
| PurposeBoundAccessPolicy, | ||
| PurposeBoundAccessRequest, | ||
| evaluate_purpose_bound_access, | ||
| ) | ||
|
|
||
| TENANT = UUID("10000000-0000-7000-8000-000000000501") | ||
|
|
||
|
|
||
| class _ForgedUUID(UUID): | ||
| """Attempt to render a tenant identity different from its underlying UUID.""" | ||
|
|
||
| def __str__(self) -> str: | ||
| """Return caller-controlled identity text.""" | ||
| return "10000000-0000-7000-8000-ffffffffffff" | ||
|
|
||
|
|
||
| class _UnvalidatedPolicy(PurposeBoundAccessPolicy): | ||
| """Attempt to bypass immutable policy validation through subclass dispatch.""" | ||
|
|
||
| def __post_init__(self) -> None: | ||
| """Intentionally skip the governed base validation.""" | ||
|
|
||
|
|
||
| class _UnvalidatedRequest(PurposeBoundAccessRequest): | ||
| """Attempt to bypass immutable request validation through subclass dispatch.""" | ||
|
|
||
| def __post_init__(self) -> None: | ||
| """Intentionally skip the governed base validation.""" | ||
|
|
||
|
|
||
| def _policy(**overrides: object) -> PurposeBoundAccessPolicy: | ||
| """Build one exact governed People PII access policy.""" | ||
| values: dict[str, object] = { | ||
| "tenant_record_id": TENANT, | ||
| "policy_version_code": "people_pii_v1", | ||
| "resource_kind": "person_record", | ||
| "purpose_code": "hr_operations", | ||
| "operation_code": "read_person_pii", | ||
| "required_scope_code": "orgmetra.people.read", | ||
| "permitted_fields": frozenset({"legal_name", "work_email"}), | ||
| } | ||
| values.update(overrides) | ||
| return PurposeBoundAccessPolicy(**values) # type: ignore[arg-type] | ||
|
|
||
|
|
||
| def _request(**overrides: object) -> PurposeBoundAccessRequest: | ||
| """Build one exact governed People PII access request.""" | ||
| values: dict[str, object] = { | ||
| "tenant_record_id": TENANT, | ||
| "actor_tenant_record_id": TENANT, | ||
| "resource_tenant_record_id": TENANT, | ||
| "actor_reference": "keyverse_subject:sub_jordan_hale", | ||
| "resource_reference": "person_record:per_01J5EXACTTARGET", | ||
| "purpose_code": "hr_operations", | ||
| "operation_code": "read_person_pii", | ||
| "resource_kind": "person_record", | ||
| "requested_fields": frozenset({"work_email"}), | ||
| "granted_scope_codes": frozenset({"orgmetra.people.read"}), | ||
| } | ||
| values.update(overrides) | ||
| return PurposeBoundAccessRequest(**values) # type: ignore[arg-type] | ||
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
| "field_name", | ||
| ["tenant_record_id", "actor_tenant_record_id", "resource_tenant_record_id"], | ||
| ) | ||
| def test_access_request_rejects_uuid_subclasses(field_name: str) -> None: | ||
| """Tenant isolation cannot depend on a UUID object with caller-controlled rendering.""" | ||
| forged = _ForgedUUID("10000000-0000-7000-8000-000000000501") | ||
| with pytest.raises(ValueError, match=f"{field_name} must be a UUID"): | ||
| _request(**{field_name: forged}) | ||
|
|
||
|
|
||
| def test_access_policy_rejects_uuid_subclasses() -> None: | ||
| """Persisted policy identity must use the exact built-in UUID contract.""" | ||
| forged = _ForgedUUID("10000000-0000-7000-8000-000000000501") | ||
| with pytest.raises(ValueError, match="tenant_record_id must be a UUID"): | ||
| _policy(tenant_record_id=forged) | ||
|
|
||
|
|
||
| def test_evaluator_rejects_policy_subclass_that_skipped_validation() -> None: | ||
| """A subclass cannot widen immutable policy attributes by skipping post-init checks.""" | ||
| forged = _UnvalidatedPolicy( | ||
| tenant_record_id=TENANT, | ||
| policy_version_code="people_pii_v1", | ||
| resource_kind="person_record", | ||
| purpose_code="hr_operations", | ||
| operation_code="read_person_pii", | ||
| required_scope_code="orgmetra.people.read", | ||
| permitted_fields={"work_email"}, # type: ignore[arg-type] | ||
| ) | ||
| with pytest.raises(TypeError, match="policy must be a PurposeBoundAccessPolicy"): | ||
| evaluate_purpose_bound_access(request=_request(), policy=forged) | ||
|
|
||
|
|
||
| def test_evaluator_rejects_request_subclass_that_skipped_validation() -> None: | ||
| """A subclass cannot present mutable token scopes as validated authorization input.""" | ||
| forged = _UnvalidatedRequest( | ||
| tenant_record_id=TENANT, | ||
| actor_tenant_record_id=TENANT, | ||
| resource_tenant_record_id=TENANT, | ||
| actor_reference="keyverse_subject:sub_jordan_hale", | ||
| resource_reference="person_record:per_01J5EXACTTARGET", | ||
| purpose_code="hr_operations", | ||
| operation_code="read_person_pii", | ||
| resource_kind="person_record", | ||
| requested_fields=frozenset({"work_email"}), | ||
| granted_scope_codes={"orgmetra.people.read"}, # type: ignore[arg-type] | ||
| ) | ||
| with pytest.raises(TypeError, match="request must be a PurposeBoundAccessRequest"): | ||
| evaluate_purpose_bound_access(request=forged, policy=_policy()) |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.