From 8a46e8a00565ab74f4940f2d03ce96f6170a461a Mon Sep 17 00:00:00 2001 From: Sergio Arroutbi Date: Wed, 2 Dec 2026 11:20:26 +0100 Subject: [PATCH 1/2] Add bootstrap OIDC role mapping design Define the initial claim-to-role mapping for the OIDC authentication flow (SDD 3.5.3): MFA-authenticated company users are granted Admin, sessions without an MFA claim fall back to Viewer instead of being rejected (SR-002), and Operator assignment is deferred. The mapping is gated by a role_mapping configuration value so the later switch to IdP group-based assignment does not require code changes. Add the missing SR-002 row to the SDD traceability matrix, update the security overlay MFA row, and record IR-024 in the SRS cross-reference. Co-authored-by: GLM 5.3 Signed-off-by: Sergio Arroutbi --- SDD-Keylime-Monitoring-Tool.md | 24 +++++++++++++++++++++++- SRS-Keylime-Monitoring-Tool.md | 2 ++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/SDD-Keylime-Monitoring-Tool.md b/SDD-Keylime-Monitoring-Tool.md index f699084..50d993e 100644 --- a/SDD-Keylime-Monitoring-Tool.md +++ b/SDD-Keylime-Monitoring-Tool.md @@ -1149,6 +1149,27 @@ Re-render with new data **Trace:** SRS SR-001, SR-002, SR-010, SR-011 +**OIDC Role Mapping (Bootstrap):** + +Until IdP group-to-role provisioning is configured, step 7 above uses a bootstrap claim-to-role mapping: + +```text +authenticated + MFA claim -> Admin +authenticated, no MFA -> Viewer (read-only fallback, SR-002) +Operator -> reserved; no bootstrap mapping assigns it +``` + +* **MFA is verified at login, not deferred.** The backend MUST check the MFA claim (e.g., `amr`, `acr`, or a configurable custom claim) in the ID token before granting Admin (SR-002). A user whose token lacks the claim is not rejected: the session is granted the lowest applicable role (Viewer), preserving read-only access until the user re-authenticates with MFA. Role upgrade always requires a fresh IdP authentication; tokens are never upgraded in-session. +* **Company users are Admin by default.** Any user who completes the OIDC flow against the configured corporate IdP realm with MFA receives Admin. No per-user role administration is required during bootstrap. +* **The mapping is configuration-gated.** `role_mapping = "bootstrap" | "groups"` (default: `bootstrap`), so the later switch to IdP group-based assignment is a configuration change, not a code change. +* **Bootstrap mode is time-boxed.** It MUST be replaced by group-based mapping before exposure beyond the corporate realm, and the threat model MUST record the admin-by-default posture as an accepted, time-boxed risk. +* **Operator remains in the RBAC model** (SR-003, section 3.6.2) and in code; only its assignment is deferred. +* **Audit actor.** With sessions in place, the audit log records the authenticated identity (`sub` / email claim) as the actor of every mutating action. + +**Trace:** SRS SR-001, SR-002, SR-003 + + + **Cockpit Authentication Flow (Alternative):** ```text @@ -1500,7 +1521,7 @@ Maximum 5 parallel concurrent log fetches to the Verifier API, enforced via Toki | Concern | Design Element | SRS Trace | |---------|---------------|-----------| | Authentication | OIDC flow with IdP, short-lived JWT (15 min) | SR-001, SR-010 | -| MFA | Required for Admin role via IdP policy | SR-002 | +| MFA | Required for Admin role via IdP policy; missing MFA claim at login demotes to Viewer (bootstrap role mapping, 3.5.3) | SR-002 | | Authorization (backend) | RBAC middleware checks `Role` in JWT claims | SR-003 | | Authorization (frontend) | `canWrite()` / `isAdmin()` conditionally render controls | SR-003, SR-021 | | Transport: Browser-API | TLS 1.3 minimum | SR-008 | @@ -1631,6 +1652,7 @@ Maximum 5 parallel concurrent log fetches to the Verifier API, enforced via Toki | SRS Req | SDD Section | Design Element | |---------|-------------|----------------| | SR-001 | 3.5.3 | OIDC authentication flow | +| SR-002 | 3.5.3, 5.1 | MFA claim verified before Admin is granted; Viewer fallback via bootstrap role mapping | | SR-003 | 3.6.2, 5.1 | Three-tier RBAC: Viewer, Operator, Admin | | SR-004 | 3.1.2 | mTLS with rustls for Keylime APIs | | SR-005 | 3.8.1 | `MtlsConfig.key`: HSM/Vault URI | diff --git a/SRS-Keylime-Monitoring-Tool.md b/SRS-Keylime-Monitoring-Tool.md index 7ab8445..da4c48e 100644 --- a/SRS-Keylime-Monitoring-Tool.md +++ b/SRS-Keylime-Monitoring-Tool.md @@ -4541,8 +4541,10 @@ The design details that realize these requirements -- including component decomp | IR-021: Cockpit Context View | 3.1.3 | Context View | | IR-022: Cockpit Plugin Composition | 3.2.4 | Composition View | | IR-023: Cockpit Bridge Interface Contracts | 3.4.6 | Interface View | +| IR-024: Bootstrap OIDC Role Mapping | 3.5.3 | Interaction View | + The SDD also includes a full SRS traceability matrix (Section 6) mapping every implemented requirement to its corresponding design element. From 1b317bd461f905b8eae29f0f3cf7a2e67b552dce Mon Sep 17 00:00:00 2001 From: Sergio Arroutbi Date: Wed, 2 Dec 2026 11:29:32 +0100 Subject: [PATCH 2/2] Add config-gated anonymous viewer access to SR-001 Amend SR-001 so authentication is mandatory for privileged operations (Operator/Admin capabilities) and whenever anonymous viewer mode is disabled. When anonymous_viewer is enabled (default for internal deployments), any request that reaches the backend is granted the read-only Viewer role without a session -- network reachability acts as the trust boundary. Update the Phase 1 exit criteria to scope authentication to privileged API access and confine anonymous access to read-only Viewer capabilities, extend the SDD 3.5.3 bootstrap role mapping with the unauthenticated Viewer row and the anonymous_viewer configuration gate, add the security overlay row and the SR-001 traceability description, and record IR-025 in the SRS cross-reference. Signed-off-by: Sergio Arroutbi --- SDD-Keylime-Monitoring-Tool.md | 14 +++++++++---- SRS-Keylime-Monitoring-Tool.md | 37 ++++++++++++++++++++++++++-------- 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/SDD-Keylime-Monitoring-Tool.md b/SDD-Keylime-Monitoring-Tool.md index 50d993e..3684ebe 100644 --- a/SDD-Keylime-Monitoring-Tool.md +++ b/SDD-Keylime-Monitoring-Tool.md @@ -1131,6 +1131,8 @@ Re-render with new data #### 3.5.3 Authentication Flow +Users MAY browse the dashboard with the read-only Viewer role without authenticating when anonymous viewer mode is enabled (`anonymous_viewer = true`, SR-001); the flow below starts when the user signs in or triggers a privileged action. + ```text 1. User navigates to /login 2. Login page presents OIDC login (or demo login) @@ -1154,12 +1156,14 @@ Re-render with new data Until IdP group-to-role provisioning is configured, step 7 above uses a bootstrap claim-to-role mapping: ```text -authenticated + MFA claim -> Admin -authenticated, no MFA -> Viewer (read-only fallback, SR-002) -Operator -> reserved; no bootstrap mapping assigns it +authenticated + MFA claim -> Admin +authenticated, no MFA -> Viewer (read-only fallback, SR-002) +unauthenticated (anonymous_viewer=true) -> Viewer (read-only, SR-001) +Operator -> reserved; no bootstrap mapping assigns it ``` * **MFA is verified at login, not deferred.** The backend MUST check the MFA claim (e.g., `amr`, `acr`, or a configurable custom claim) in the ID token before granting Admin (SR-002). A user whose token lacks the claim is not rejected: the session is granted the lowest applicable role (Viewer), preserving read-only access until the user re-authenticates with MFA. Role upgrade always requires a fresh IdP authentication; tokens are never upgraded in-session. +* **Anonymous viewer access is configuration-gated.** `anonymous_viewer = true | false` (default: `true` for internal deployments). When enabled, any request that reaches the backend is granted the read-only Viewer role without a session -- network reachability is the trust boundary. Deployments exposed beyond a trusted network MUST set `anonymous_viewer = false`, which restores authentication on every request. Privileged (Operator/Admin) capabilities always require an authenticated session regardless of this setting (SR-001). * **Company users are Admin by default.** Any user who completes the OIDC flow against the configured corporate IdP realm with MFA receives Admin. No per-user role administration is required during bootstrap. * **The mapping is configuration-gated.** `role_mapping = "bootstrap" | "groups"` (default: `bootstrap`), so the later switch to IdP group-based assignment is a configuration change, not a code change. * **Bootstrap mode is time-boxed.** It MUST be replaced by group-based mapping before exposure beyond the corporate realm, and the threat model MUST record the admin-by-default posture as an accepted, time-boxed risk. @@ -1169,6 +1173,7 @@ Operator -> reserved; no bootstrap mapping assigns it **Trace:** SRS SR-001, SR-002, SR-003 + **Cockpit Authentication Flow (Alternative):** @@ -1521,6 +1526,7 @@ Maximum 5 parallel concurrent log fetches to the Verifier API, enforced via Toki | Concern | Design Element | SRS Trace | |---------|---------------|-----------| | Authentication | OIDC flow with IdP, short-lived JWT (15 min) | SR-001, SR-010 | +| Anonymous viewer | `anonymous_viewer` config gate; unauthenticated requests confined to read-only Viewer; MUST be disabled for deployments exposed beyond a trusted network | SR-001 | | MFA | Required for Admin role via IdP policy; missing MFA claim at login demotes to Viewer (bootstrap role mapping, 3.5.3) | SR-002 | | Authorization (backend) | RBAC middleware checks `Role` in JWT claims | SR-003 | | Authorization (frontend) | `canWrite()` / `isAdmin()` conditionally render controls | SR-003, SR-021 | @@ -1651,7 +1657,7 @@ Maximum 5 parallel concurrent log fetches to the Verifier API, enforced via Toki | SRS Req | SDD Section | Design Element | |---------|-------------|----------------| -| SR-001 | 3.5.3 | OIDC authentication flow | +| SR-001 | 3.5.3 | OIDC authentication flow; config-gated anonymous Viewer access | | SR-002 | 3.5.3, 5.1 | MFA claim verified before Admin is granted; Viewer fallback via bootstrap role mapping | | SR-003 | 3.6.2, 5.1 | Three-tier RBAC: Viewer, Operator, Admin | | SR-004 | 3.1.2 | mTLS with rustls for Keylime APIs | diff --git a/SRS-Keylime-Monitoring-Tool.md b/SRS-Keylime-Monitoring-Tool.md index da4c48e..cfaeb41 100644 --- a/SRS-Keylime-Monitoring-Tool.md +++ b/SRS-Keylime-Monitoring-Tool.md @@ -167,7 +167,7 @@ The System transforms Keylime from a CLI-driven security tool into a visual oper | Req ID | Description | RFC Level | Traceability Source | |--------|-------------|-----------|---------------------| -| SR-001 | OIDC/SAML identity provider authentication | MUST | Dashboard Authentication - User Identity | +| SR-001 | OIDC/SAML authentication for privileged operations; config-gated anonymous Viewer | MUST | Dashboard Authentication - User Identity | | SR-002 | MFA mandatory for Admin role | MUST | Dashboard Authentication - User Identity | | SR-003 | Three-tier RBAC (Viewer, Operator, Admin) | MUST | Dashboard RBAC - Role Definitions | | SR-004 | mTLS for all Keylime API communication | MUST | Threat Model - Trust Boundaries | @@ -3806,32 +3806,51 @@ Feature: cockpit-bridge as Mandatory Proxy ### SR-001: OIDC/SAML Authentication -**Description:** The System MUST authenticate all users via an external OIDC or SAML identity provider. No local username/password authentication MUST be supported. The System MUST support multiple IdP configurations for federated environments. +**Description:** The System MUST authenticate all users who perform privileged operations (Operator or Admin capabilities) via an external OIDC or SAML identity provider. No local username/password authentication MUST be supported. The System MUST support multiple IdP configurations for federated environments. The System MUST support an anonymous viewer mode controlled by the `anonymous_viewer` setting: when enabled, unauthenticated users are granted the read-only Viewer role; when disabled, the System MUST authenticate all users. Privileged operations MUST require authentication regardless of this setting. **Trace:** Dashboard Authentication - User Identity ```gherkin Feature: OIDC/SAML Authentication - Scenario: Authenticate via OIDC provider - Given the dashboard is configured with an OIDC identity provider + Scenario: Unauthenticated browsing with anonymous viewer mode enabled + Given the dashboard has anonymous viewer mode enabled + When a user navigates to the dashboard without a session + Then the System MUST grant the user the read-only Viewer role + And the System MUST NOT redirect the user to the identity provider + + Scenario: Privileged action requires authentication + Given the dashboard has anonymous viewer mode enabled + When an unauthenticated user attempts an Operator or Admin capability + Then the System MUST return HTTP 401 Unauthorized + And the frontend MUST offer the OIDC login flow + + Scenario: Anonymous viewer mode disabled + Given the dashboard has anonymous viewer mode disabled When a user navigates to the dashboard without a session Then the System MUST redirect the user to the OIDC provider login page - And upon successful authentication, the user MUST be redirected back with a valid session + And no unauthenticated access to the dashboard MUST be permitted + + Scenario: Authenticate via OIDC provider + Given the dashboard is configured with an OIDC identity provider + When a user initiates login and completes authentication at the provider + Then the user MUST be redirected back to the dashboard with a valid session Scenario: OIDC provider unreachable Given the OIDC identity provider is unreachable When a user attempts to log in Then the System MUST display an error "Authentication service unavailable" - And no unauthenticated access to the dashboard MUST be permitted + And no privileged access to the dashboard MUST be permitted Scenario: Session token expired Given the user's session token has expired - When the user attempts any dashboard action + When the user attempts a privileged dashboard action Then the System MUST redirect the user to re-authenticate via the IdP And the user MUST be returned to their original page after re-authentication ``` + + > **Cockpit Deployment Note:** In Cockpit deployments, PAM-based system login replaces OIDC/SAML authentication. The OIDC flow described above MUST NOT be used when the plugin runs inside Cockpit. Authentication is handled by Cockpit's PAM login screen before the plugin loads. See SR-030, FR-092. ### SR-002: MFA for Admin Role @@ -4494,7 +4513,7 @@ Feature: PAM Authentication in Cockpit Mode As defined in the source presentation, the implementation follows three phases: -**Phase 1 — Secure Foundation:** Agent fleet list, agent state monitoring, OIDC/SAML authentication, three-tier RBAC, tamper-evident audit log, mTLS to Keylime APIs. *Exit criteria: all API access authenticated, RBAC enforced on every endpoint, audit log captures all actions, mTLS key never on disk in cleartext, threat model reviewed, penetration test passed.* +**Phase 1 — Secure Foundation:** Agent fleet list, agent state monitoring, OIDC/SAML authentication, three-tier RBAC, tamper-evident audit log, mTLS to Keylime APIs. *Exit criteria: all privileged API access authenticated, anonymous access (when enabled) confined to read-only Viewer capabilities (SR-001), RBAC enforced on every endpoint, audit log captures all actions, mTLS key never on disk in cleartext, threat model reviewed, penetration test passed.* **Phase 2 — Operations:** Attestation analytics, policy management UI, certificate monitoring, alert notifications, push mode (v3 API) support, SIEM integration, WebSocket updates, SSRF-validated webhooks, Prometheus metrics endpoint. @@ -4542,9 +4561,11 @@ The design details that realize these requirements -- including component decomp | IR-022: Cockpit Plugin Composition | 3.2.4 | Composition View | | IR-023: Cockpit Bridge Interface Contracts | 3.4.6 | Interface View | | IR-024: Bootstrap OIDC Role Mapping | 3.5.3 | Interaction View | +| IR-025: Anonymous Viewer Access | 3.5.3 | Interaction View | + The SDD also includes a full SRS traceability matrix (Section 6) mapping every implemented requirement to its corresponding design element.