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 20:52:33 UTC

(tooling-agents) branch main updated: ASVS audit: 10.3.4.md (redacted) [source: apache/steve/v3 @ d0aa7e9]

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 5f6e4c1  ASVS audit: 10.3.4.md (redacted) [source: apache/steve/v3 @ d0aa7e9]
5f6e4c1 is described below

commit 5f6e4c15c65e4211413c0d83155fc3bd7e86f7c8
Author: ASF Tooling Team <ro...@apache.org>
AuthorDate: Tue May 5 22:50:57 2026 +0200

    ASVS audit: 10.3.4.md (redacted) [source: apache/steve/v3 @ d0aa7e9]
---
 ASVS/reports/steve/v3/d0aa7e9/all/10.3.4.md | 138 ++++++++++++++++++++++++++++
 1 file changed, 138 insertions(+)

diff --git a/ASVS/reports/steve/v3/d0aa7e9/all/10.3.4.md b/ASVS/reports/steve/v3/d0aa7e9/all/10.3.4.md
new file mode 100644
index 0000000..11efbf7
--- /dev/null
+++ b/ASVS/reports/steve/v3/d0aa7e9/all/10.3.4.md
@@ -0,0 +1,138 @@
+# Security Audit Report: ASVS 10.3.4
+
+## Executive Summary
+
+| Field | Value |
+|-------|-------|
+| **Repository** | apache/steve/v3 |
+| **Audit Date** | May 05, 2026 |
+| **Auditor** | Tooling Agents (bundled-pass mode) |
+| **ASVS Requirement** | ASVS 10.3.4 |
+| **Files Analyzed** | 4 relevant / 49 total |
+| **Files Skipped** | 12 |
+
+**Requirement description:** Verify that, if the resource server requires specific authentication strength, methods, or recentness, it verifies that the presented access token satisfies these constraints. For example, if present, using the OIDC 'acr', 'amr' and 'auth_time' claims respectively.
+
+### Findings Overview
+
+| Severity | Count |
+|----------|-------|
+| 🔴 Critical | 0 |
+| 🟠 High | 0 |
+| 🟡 Medium | 1 |
+| 🟢 Low | 0 |
+
+---
+
+## ASVS-10.3.4: OAuth Resource Server - Authentication Strength Verification
+
+### Findings for 10.3.4
+
+#### [MEDIUM] ASVS-1034-MED-001: No Authentication Strength, Method, or Recentness Verification
+
+**File:** `v3/server/pages.py` (all state-changing endpoints)
+
+**Description:** The application does not verify authentication strength (`acr`), authentication methods (`amr`), or authentication recentness (`auth_time`) before performing sensitive operations. Operations like opening/closing elections, casting votes, and creating elections proceed with any valid session regardless of how recently or strongly the user authenticated.
+
+**Vulnerable Code:**
+```python
+# v3/server/pages.py, line 372-408 (voting endpoint)
+@APP.post('/do-vote/<eid>')
+@asfquart.auth.require({R.committer})
+@load_election
+async def do_vote_endpoint(election):
+    result = await basic_info()
+    # No check for:
+    # - How recently the user authenticated (auth_time)
+    # - What authentication method was used (amr: e.g., MFA vs password-only)
+    # - What assurance level was achieved (acr)
+    
+    for iid, votestring in votes.items():
+        election.add_vote(result.uid, iid, votestring)  # Proceeds regardless
+```
+
+**Impact:** A session that was established hours ago (potentially via a compromised long-lived session cookie) can be used to cast votes or modify elections without requiring re-authentication. For a voting system, this is significant as vote integrity depends on authentication freshness.
+
+**Remediation:**
+```python
+async def require_recent_auth(max_age_seconds=300):
+    """Require authentication within the last N seconds for sensitive ops."""
+    s = await asfquart.session.read()
+    if not s or 'auth_time' not in s:
+        quart.abort(401, 'Re-authentication required')
+    
+    age = time.time() - s['auth_time']
+    if age > max_age_seconds:
+        quart.abort(401, 'Session too old. Please re-authenticate.')
+
+@APP.post('/do-vote/<eid>')
+@asfquart.auth.require({R.committer})
+@load_election
+async def do_vote_endpoint(election):
+    await require_recent_auth(max_age_seconds=600)  # 10 min
+    # proceed...
+```
+
+### Security Controls Inventory for 10.3.4
+
+| Control | Location | Status |
+|---------|----------|--------|
+| Authentication strength check | N/A | **NOT IMPLEMENTED** |
+| Authentication method verification | N/A | **NOT IMPLEMENTED** |
+| Authentication recentness check | N/A | **NOT IMPLEMENTED** |
+| Session-based auth | `@asfquart.auth.require` | APPLIED (binary check only) |
+
+### Positive Patterns for 10.3.4
+
+- The `@asfquart.auth.require` decorator does enforce that a valid session exists before any protected operation.
+- Election creation requires `R.pmc_member` (higher privilege than `R.committer`), showing differentiated access levels exist in the framework.
+
+---
+
+
+
+## Cross-cutting Architecture Observations
+
+1. **No OAuth Implementation Present:** The entire codebase uses traditional session-cookie-based authentication via `asfquart.session.read()` and role-based decorators. There is no OAuth 2.0 resource server or authorization server functionality. The ASVS 10.3.x and 10.4.x requirements are architecturally not addressed because the application doesn't implement the OAuth protocol at all.
+
+2. **Authorization Model Gap (Type B — Critical Pattern):** The most significant security concern across requirements is the repeated `### check authz` placeholder pattern. The code has **identified** where authorization checks should exist but has **not implemented** them. This creates a false sense of security. Any authenticated committer can manage any election (open, close, add issues, set dates), which represents a horizontal privilege escalation vulnerability.
+
+3. **Single Authentication Context:** The user identity (`result.uid`) flows from a single session source through all operations. There is no federation, no multi-issuer support, and no delegation model. This simplifies the security model but means the application cannot enforce OAuth-style delegated authorization if it needs to be accessed by third-party clients.
+
+4. **Election-Level Access Control Done Right in Some Places:** The `vote_on_page()` handler and `serve_doc()` handler properly check voter eligibility via `q_find_issues` and `q_get_mayvote` respectively. However, administrative operations (open, close, add/edit/delete issues) lack equivalent ownership checks.
+
+5. **Cryptographic Voter Anonymity vs. Authentication:** The voting system employs strong cryptographic measures (vote tokens, encryption, salts) to ensure ballot secrecy. However, the authentication layer protecting these operations is comparatively weaker (session cookies without binding, no MFA requirement, no freshness checks).
+
+---
+
+## Cross-cutting Recommendations
+
+### Immediate (Critical)
+
+1. **Implement Authorization Ownership Checks:** Replace all `### check authz` placeholders with actual ownership verification:
+   - Verify `election.get_metadata().owner_pid == result.uid` OR user is in the election's `authz` group
+   - Apply to: `/do-open/`, `/do-close/`, `/do-add-issue/`, `/do-edit-issue/`, `/do-delete-issue/`, `/do-set-open_at/`, `/do-set-close_at/`
+   - **Priority:** This is exploitable today by any authenticated committer
+
+2. **Implement CSRF Protection:** Replace `basic.csrf_token = 'placeholder'` with actual CSRF token generation and validation. All POST endpoints and state-changing GET endpoints (`/do-open/`, `/do-close/`) are vulnerable.
+
+### Short-term (High)
+
+3. **Add Authentication Freshness for Sensitive Operations:** For vote casting and election state changes, require that the authentication occurred within a recent time window (e.g., 10–30 minutes).
+
+4. **Convert State-Changing GETs to POSTs:** `/do-open/<eid>` and `/do-close/<eid>` use GET method for state-changing operations, making them susceptible to CSRF via image tags or link prefetching. Convert to POST with CSRF tokens.
+
+5. **If OAuth API Access Is Planned:** Design and implement an OAuth resource server layer with:
+   - JWT validation (signature, expiration, audience, issuer)
+   - Scope-based access control for API operations
+   - `sub` + `iss` based user identification
+
+### Long-term (Strategic)
+
+6. **Evaluate OAuth/OIDC Integration:** If this voting system needs to support API clients or federated access, implement:
+   - An OAuth resource server with token introspection or JWT validation
+   - Sender-constrained tokens (DPoP) for Level 3 compliance
+   - Step-up authentication for high-sensitivity operations (vote casting)
+
+7. **Implement Audit Logging with Authentication Context:** Log authentication method and strength alongside actions to support forensic analysis and compliance verification.
+        
\ 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