Add typed security and authorization contracts #38
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
primatekuntech/rag-rust!38
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/7-security-contracts"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Replace raw security attributes and the incomplete policy skeleton with typed, default-deny contracts for future identity/storage/retrieval adapters. Refs #7.
Missing organization now denies instead of behaving as unrestricted scope. Classification has no lexical ordering; policy ranks are authoritative. Subject and policy must both grant the action. Source markings, policy versions and lifecycle status are checked before content permission. Scopes expire at the earliest identity/policy/request deadline and reject another request, cancellation or stale context.
Only trusted authorization code can construct subjects/scopes; compile-fail checks guard private promotion, JSON deserialization and typed identifiers. SQL/Qdrant adapters must apply every filter and still reauthorize current canonical metadata before loading text. Organization/tenant scope is one mandatory exact partition; broader access needs an approved extension.
Evidence
After: 17 behavioral test functions (including shared permit/deny matrices) and six compile-fail checks pass.
cargo fmt --all -- --check— pass.cargo clippy --workspace --all-targets --locked -- -D warnings— pass.cargo test --workspace --locked— pass, including shared adapter contracts for ranks, all required grants, lifecycle, policy/freshness, scope constraints, expiry and ownership.npm run typecheckandnpm run build— pass.&dyn PolicyDeciderhelpers used by the shared suite.1ec1176ad5114d169cc152d4df41e8bc00232581: push run #4 and PR run #5. Both Rust and web jobs succeeded.Merge Danger
Door: two-way
Blast Radius: authorization
Changes domain/policy interfaces before their storage/identity consumers are built. API/UI behavior is unchanged. Production identity, authoritative revocation and real database/vector filters remain subsequent issues. Adds only an existing workspace dependency as a dev dependency for JSON compile-fail guards; no new runtime dependency. Issue #7 remains open pending review/merge.
WIP: Add typed security and authorization contractsto Add typed security and authorization contracts