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:51:06 UTC

(tooling-agents) branch main updated: ASVS audit: 10.3.5.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 ec0a2fb  ASVS audit: 10.3.5.md (redacted) [source: apache/steve/v3 @ d0aa7e9]
ec0a2fb is described below

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

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

diff --git a/ASVS/reports/steve/v3/d0aa7e9/all/10.3.5.md b/ASVS/reports/steve/v3/d0aa7e9/all/10.3.5.md
new file mode 100644
index 0000000..329e7f8
--- /dev/null
+++ b/ASVS/reports/steve/v3/d0aa7e9/all/10.3.5.md
@@ -0,0 +1,118 @@
+# Security Audit Report: ASVS 10.3.5
+
+## Executive Summary
+
+| Field | Value |
+|-------|-------|
+| **Repository** | apache/steve/v3 |
+| **Audit Date** | May 05, 2026 |
+| **Auditor** | Tooling Agents (bundled-pass mode) |
+| **ASVS Requirement** | ASVS 10.3.5 |
+| **Files Analyzed** | 4 relevant / 49 total |
+| **Files Skipped** | 12 |
+
+**Requirement description:** Verify that the resource server prevents the use of stolen access tokens or replay of access tokens (from unauthorized parties) by requiring sender-constrained access tokens, either Mutual TLS for OAuth 2 or OAuth 2 Demonstration of Proof of Possession (DPoP).
+
+### Findings Overview
+
+| Severity | Count |
+|----------|-------|
+| 🔴 Critical | 0 |
+| 🟠 High | 0 |
+| 🟡 Medium | 1 |
+| 🟢 Low | 0 |
+
+---
+
+## ASVS-10.3.5: OAuth Resource Server - Sender-Constrained Access Tokens
+
+### Findings for 10.3.5
+
+#### [MEDIUM] ASVS-1035-MED-001: No Token Binding or Proof-of-Possession Mechanism
+
+**File:** `v3/server/pages.py` (entire authentication layer)
+
+**Description:** The application uses session cookies without any sender-constraining mechanism (no mTLS client certificate binding, no DPoP proof). Session cookies are bearer credentials that can be replayed by any party that obtains them (e.g., via XSS, network interception, or session fixation).
+
+**Relevant Code:**
+```python
+# v3/server/pages.py, line 68
+async def basic_info():
+    s = await asfquart.session.read()  # Cookie-based, no sender binding
+```
+
+**Impact:** If an attacker obtains a valid session cookie (e.g., through the placeholder CSRF token issue or XSS), they can impersonate the user from any client/network. For a voting system, this could allow unauthorized vote casting.
+
+**Context:** This is a Level 3 ASVS requirement, indicating it's for high-assurance applications. The current session-based approach without sender binding is standard for many web applications but insufficient for Level 3 compliance.
+
+**Remediation:** For Level 3 compliance, implement client certificate binding or DPoP-equivalent session binding:
+```python
+# Option 1: Bind session to client TLS certificate fingerprint
+async def verify_sender_binding(request):
+    s = await asfquart.session.read()
+    client_cert_fp = request.headers.get('X-Client-Cert-Fingerprint')
+    if s.get('bound_cert_fp') and s['bound_cert_fp'] != client_cert_fp:
+        quart.abort(401, 'Session binding mismatch')
+```
+
+### Security Controls Inventory for 10.3.5
+
+| Control | Location | Status |
+|---------|----------|--------|
+| mTLS token binding | N/A | **NOT IMPLEMENTED** |
+| DPoP proof verification | N/A | **NOT IMPLEMENTED** |
+| Session cookie (bearer) | `asfquart.session.read()` | APPLIED (not sender-constrained) |
+
+### Positive Patterns for 10.3.5
+
+- The cryptographic vote token system (`crypto.gen_vote_token()`) provides server-side binding between a voter identity and their vote, making vote manipulation difficult even with session theft (the attacker would still need to know which election/issue combinations the user can vote on, though this is discoverable via the UI).
+
+---
+
+
+
+## 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