You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by as...@apache.org on 2026/05/05 12:20:15 UTC

(tooling-agents) branch main updated: ASVS audit: 10.5.5.md (redacted)

This is an automated email from the ASF dual-hosted git repository.

asf-tooling pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-agents.git


The following commit(s) were added to refs/heads/main by this push:
     new 35f1b7d  ASVS audit: 10.5.5.md (redacted)
35f1b7d is described below

commit 35f1b7d7a308714a9090aae00abbc946fa353daa
Author: ASF Tooling Team <ro...@apache.org>
AuthorDate: Tue May 5 14:01:51 2026 +0200

    ASVS audit: 10.5.5.md (redacted)
---
 ASVS/reports/steve/v3/d0aa7e9/all/10.5.5.md | 180 ++++++++++++++++++++++++++++
 1 file changed, 180 insertions(+)

diff --git a/ASVS/reports/steve/v3/d0aa7e9/all/10.5.5.md b/ASVS/reports/steve/v3/d0aa7e9/all/10.5.5.md
new file mode 100644
index 0000000..3b451ae
--- /dev/null
+++ b/ASVS/reports/steve/v3/d0aa7e9/all/10.5.5.md
@@ -0,0 +1,180 @@
+# Security Audit Report: ASVS 10.5.5
+
+## Executive Summary
+
+| Field | Value |
+|-------|-------|
+| **Repository** | apache/steve/v3 |
+| **Audit Date** | May 05, 2026 |
+| **Auditor** | Tooling Agents (bundled-pass mode) |
+| **ASVS Requirement** | ASVS 10.5.5 |
+| **Files Analyzed** | 8 relevant / 49 total |
+| **Files Skipped** | 12 |
+
+**Requirement description:** Verify that, when using OIDC back-channel logout, the relying party mitigates denial of service through forced logout and cross-JWT confusion in the logout flow. The client must verify that the logout token is correctly typed with a value of 'logout+jwt', contains the 'event' claim with the correct…
+
+### Findings Overview
+
+| Severity | Count |
+|----------|-------|
+| πŸ”΄ Critical | 0 |
+| 🟠 High | 0 |
+| 🟑 Medium | 1 |
+| 🟒 Low | 0 |
+
+---
+
+## ASVS-10.5.5: OIDC Back-Channel Logout
+
+### Findings for 10.5.5
+
+The application uses `asfquart.session` and `asfquart.auth` for authentication, operating as an OIDC Relying Party (consuming authentication from ASF's identity infrastructure). However, there is **no back-channel logout endpoint** or logout token processing visible in the codebase.
+
+#### [MEDIUM] Finding ASVS-1055-MED-001: No OIDC Back-Channel Logout Implementation
+
+**Location:** `v3/server/pages.py` (entire file scope β€” no logout endpoint present)
+
+**Vulnerable code (absence):**
+```python
+# No logout endpoint exists in pages.py
+# No back-channel logout token validation is implemented
+# The only session-related code is reading sessions:
+s = await asfquart.session.read()
+```
+
+**Data flow:** External IdP β†’ (no endpoint) β†’ Application sessions remain active
+
+**Analysis:**
+- The application has no route matching `/backchannel-logout`, `/logout`, or similar patterns
+- No JWT parsing of logout tokens (checking `typ` header for `logout+jwt`)
+- No verification of the `event` claim with member `http://schemas.openid.net/event/backchannel-logout`
+- No check for absence of `nonce` claim
+- No expiration validation on logout tokens
+- Sessions authenticated via `asfquart.session.read()` would persist indefinitely after an IdP-initiated logout
+
+**Impact:** If the upstream identity provider (ASF's OIDC system) terminates a user's session, the voting application would continue to honor the stale session. This creates a denial-of-service vector through forced logout attacks, and sessions cannot be revoked remotely. A compromised account cannot be quickly invalidated across all relying parties.
+
+**Remediation:**
+```python
+import jwt
+import time
+
+@APP.post('/backchannel-logout')
+async def backchannel_logout():
+    """Handle OIDC back-channel logout notifications."""
+    form = await quart.request.form
+    logout_token_raw = form.get('logout_token')
+    if not logout_token_raw:
+        quart.abort(400)
+
+    # Decode and validate the logout token
+    try:
+        # Verify signature with IdP's public key
+        header = jwt.get_unverified_header(logout_token_raw)
+        
+        # 1. Verify typ is 'logout+jwt'
+        if header.get('typ') != 'logout+jwt':
+            quart.abort(400, 'Invalid token type')
+        
+        token = jwt.decode(
+            logout_token_raw,
+            key=IDP_PUBLIC_KEY,
+            algorithms=['RS256'],
+            audience=CLIENT_ID,
+            issuer=IDP_ISSUER,
+        )
+        
+        # 2. Verify 'events' claim with correct member name
+        events = token.get('events', {})
+        if 'http://schemas.openid.net/event/backchannel-logout' not in events:
+            quart.abort(400, 'Missing logout event claim')
+        
+        # 3. Verify no 'nonce' claim is present
+        if 'nonce' in token:
+            quart.abort(400, 'Nonce must not be present in logout token')
+        
+        # 4. Verify short expiration (≀ 2 minutes from iat)
+        iat = token.get('iat', 0)
+        exp = token.get('exp', 0)
+        if exp - iat > 120:  # 2 minutes max
+            quart.abort(400, 'Token expiration too long')
+        
+        # 5. Invalidate sessions for the subject
+        sub = token.get('sub')
+        sid = token.get('sid')
+        await invalidate_sessions(sub=sub, sid=sid)
+        
+        return '', 200
+        
+    except jwt.InvalidTokenError as e:
+        quart.abort(400, f'Invalid logout token: {e}')
+```
+
+### Security Controls Inventory for 10.5.5
+
+| Control | Location | Status |
+|---------|----------|--------|
+| Back-channel logout endpoint | Not present | **MISSING** |
+| Logout token type validation (`logout+jwt`) | Not present | **MISSING** |
+| Event claim validation | Not present | **MISSING** |
+| Nonce absence check | Not present | **MISSING** |
+| Token expiration validation | Not present | **MISSING** |
+| Session invalidation on IdP logout | Not present | **MISSING** |
+| Session reading | `pages.py:68` (`asfquart.session.read()`) | Present but no revocation mechanism visible |
+
+### Positive Patterns for 10.5.5
+
+- The application uses a structured session framework (`asfquart.session`) which could potentially support session invalidation if extended.
+- Authentication is centralized through `asfquart.auth.require` decorators, meaning a session invalidation mechanism would effectively protect all endpoints.
+
+---
+
+
+
+## Cross-cutting Architecture Observations
+
+1. **Application Role**: This is an OIDC Relying Party (client/consumer) β€” not an OpenID Provider or OAuth Authorization Server. Requirements 10.6.1, 10.6.2, 10.7.1, 10.7.2, and 10.7.3 are not applicable to this codebase. Only ASVS 10.5.5 (back-channel logout for relying parties) is relevant.
+
+2. **Authentication Architecture**: The application delegates all authentication to an external identity provider (ASF's OIDC system) via the `asfquart` framework. Sessions are read using `asfquart.session.read()` and authorization is enforced via `asfquart.auth.require()` decorators. The external IdP handles:
+   - User authentication
+   - Token issuance
+   - Identity assertions
+
+3. **Session Management Gap**: While authentication is properly externalized, there is no visible mechanism for the external IdP to communicate session termination back to this application. This is the primary security gap relevant to ASVS 10.5.5.
+
+4. **Missing Logout Functionality**: The application has no logout endpoint at all β€” neither:
+   - RP-initiated logout (user clicking "logout" to terminate their session)
+   - Back-channel logout handling (IdP-initiated session revocation)
+   
+   This means once a session is established, there appears to be no way to terminate it other than session expiration (if configured in the framework).
+
+5. **Authorization Gaps (Orthogonal Concern)**: While not directly OIDC-related, the numerous `### check authz` placeholder comments indicate that fine-grained authorization (e.g., ensuring only election owners can manage elections) is not yet implemented. Any committer can potentially manage any election.
+
+## Cross-cutting Recommendations
+
+### Immediate (Critical)
+
+1. **Implement OIDC Back-Channel Logout Endpoint** β€” Add a `/backchannel-logout` endpoint that:
+   - Validates `typ: logout+jwt` in the JWT header
+   - Verifies the `events` claim contains `http://schemas.openid.net/event/backchannel-logout`
+   - Rejects tokens containing a `nonce` claim
+   - Enforces a maximum 2-minute token lifetime (exp - iat ≀ 120s)
+   - Invalidates all sessions for the identified subject (`sub`) or session (`sid`)
+
+2. **Implement Session Revocation Infrastructure** β€” Add a session store or blacklist mechanism that supports remote invalidation. The current `asfquart.session` usage does not appear to support this.
+
+### Short-term (High)
+
+3. **Implement RP-Initiated Logout** β€” Add a user-facing logout endpoint that:
+   - Destroys the local session
+   - Optionally redirects to the IdP's `end_session_endpoint` with `id_token_hint`
+   - Prevents the application from being left with orphaned sessions
+
+4. **Register Back-Channel Logout URI with IdP** β€” Ensure the back-channel logout URI is registered in the OIDC client configuration at the ASF identity provider.
+
+### Long-term (Maintenance)
+
+5. **Session Timeout Configuration** β€” Implement explicit session timeout aligned with IdP token lifetimes to limit exposure window even without back-channel logout.
+
+6. **Monitor for Logout Token Replay** β€” Implement a `jti`-based replay detection cache for logout tokens to prevent replay attacks on the back-channel logout endpoint.
+        
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org