feat(m7.1): wire tenant claims, status enforcement, and db scoping helper #82
Closed
sharang
wants to merge 2 commits from
feat/m7.1-tenant-claims into main
pull from: feat/m7.1-tenant-claims
merge into: :main
:main
:migrate/ci-breakpilot-tld
:fix/plc-refresh-control-refs
:fix/plc-control-mapping
:fix/refresh-control-refs
:docs/mcp-loop
:fix/mcp-tenant-context
:feat/promote-grounded-controls
:docs/control-mapping
:feat/tune-semantic-retrieval
:fix/embed-batch-chunking
:feat/b3-architectural-controls
:feat/b2-grounded-surface-checks
:feat/b1-cra-semgrep-rules
:feat/semantic-index-cache-autowire
:feat/semantic-control-mapping
:feat/oscal-emit-unmapped-mcp
:feat/grounded-control-check
:feat/oscal-assess-live
:feat/oscal-assessment
:feat/oscal-controls-provider
:feat/werkbank-runnable-loop
:feat/werkbank-exec-crate
:feat/werkbank-runner-endpoints
:feat/werkbank-job-queue
:feat/werkbank-job-contract
:feat/plc-provision-and-test
:docs/plc-runtimes
:docs/plc-soft-plc-architecture
:feat/dast-http-scheme
:feat/enable-optin-scans
:feat/plc-control-logic-scanner
:refactor/rip-out-legacy-repository
:feat/onboarding-validation-edit
:feat/real-nix-firmware-sbom
:fix/bump-tramiton-0.4.1
:feat/firmware-sbom-repro-build
:feat/firmware-sbom-tramiton
:feat/dashboard-targets-dropdowns
:fix/targets-visibility-unified-default
:feat/onboarding-scan-trigger
:fix/ci-concurrency-no-cancel-main
:fix/ci-docker-tramiton-dashboard-mcp
:feat/onboarding-scan-detection
:feat/onboarding-pipeline
:feat/onboarding-wizard
:fix/ci-docker-tramiton-fetch
:feat/onboarding-api
:feat/onboarding-migration
:feat/ci-kellnr-sccache
:feat/onboarding-ingest-classify
:feat/onboarding-foundation
:feat/dashboard-token-refresh
:fix/dashboard-bearer-token
:feat/m7.1-agent-wire
:fix/m7.1-jwks-refresh
:feat/m7.1-smoke-harness
:feat/m7.1-tenant-claims
:feat/light-mode-theme-toggle
:fix/embedding-build-progress
:fix/cve-scan-http-timeout
:fix/scan-resource-limits-and-script-error
:fix/multiple-issues
:feat/cve-alerts
:feat/e2e-tests
:feat/help-chat-widget
:fix/cascade-delete-repo
:feat/refine-llm-prompts
:fix/gitea-pr-review-error-handling
:test/dummy-bad-code
:fix/remove-code-review-from-findings
:feat/pentest-onboarding
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Lays the platform-wide M7.1 multi-tenancy infrastructure on top of the existing Keycloak JWT signature validation.
Claimsstruct now decodestenant_id,tenant_slug,org_roles,products,plan,tenant_status, plussub/name/preferred_username.require_jwt_authbuilds acompliance_core::TenantContextfrom them and attaches it to request extensions. Missingtenant_id-> 401; missingtenant_status-> defaults to Trial with a warn-log.TenantContexttype in compliance-core. Single source of truth, re-exported alongsideOrgRoleandTenantStatus. TheOrgRoleenum is forward-compatible (#[serde(other)] Unknownvariant) so a new realm role doesn't 401 the world.TenantCtxAxum extractor. Handlers consume the context viaTenantCtx(ctx): TenantCtx. Returns 401 if the upstream middleware didn't insert one.require_tenant_statusmiddleware. Enforces §5c of PLATFORM_ARCHITECTURE.md: Active/Trial/Demo pass, Frozen returns 402 on non-GET/HEAD/OPTIONS, Archived returns 410 on every method.compliance_core::db::tenant_filterhelper. Returnsdoc! { "tenant_id": ... }.tenant_filter_mergecombines with extra conditions and refuses to let the caller override the tenant key.Per-collection wiring (adding
tenant_idto each model + threading the filter through everyfind/update_*/delete_*call across the 38 query call-sites) lands in a follow-up PR.Test plan
cargo fmt --all -- --checkcleancargo clippy --workspace --exclude compliance-dashboard -- -D warningsclean (matches baseline)cargo test -p compliance-core --lib— 7 tests pass (4 tenant, 3 db)cargo test -p compliance-agent --lib api::— 32 tests pass, including 6 new auth_middleware tests and 2 tenant_ctx testscargo test -p compliance-agent --test tenant_status_middleware— 6 integration tests pass (active / trial / demo / frozen / archived / no-context paths)tenant_statusclaim (separate ticket)Superseded by #85 (squash-merged 2026-06-17). #85 ships the same M7.1 contract on top of the lifted compliance-core auth stack (post-#83 + #84), with the live-KC smoke harness green (15/15).
Pull request closed