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:07:32 UTC
(tooling-agents) branch main updated: ASVS audit: 10.1.2.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 0834529 ASVS audit: 10.1.2.md (redacted)
0834529 is described below
commit 0834529c7b1acc4d10a2598f2140ef481a94a15d
Author: ASF Tooling Team <ro...@apache.org>
AuthorDate: Tue May 5 14:00:59 2026 +0200
ASVS audit: 10.1.2.md (redacted)
---
ASVS/reports/steve/v3/d0aa7e9/all/10.1.2.md | 187 ++++++++++++++++++++++++++++
1 file changed, 187 insertions(+)
diff --git a/ASVS/reports/steve/v3/d0aa7e9/all/10.1.2.md b/ASVS/reports/steve/v3/d0aa7e9/all/10.1.2.md
new file mode 100644
index 0000000..f0597ed
--- /dev/null
+++ b/ASVS/reports/steve/v3/d0aa7e9/all/10.1.2.md
@@ -0,0 +1,187 @@
+# Security Audit Report: ASVS 10.1.2
+
+## Executive Summary
+
+| Field | Value |
+|-------|-------|
+| **Repository** | apache/steve/v3 |
+| **Audit Date** | May 05, 2026 |
+| **Auditor** | Tooling Agents (bundled-pass mode) |
+| **ASVS Requirement** | ASVS 10.1.2 |
+| **Files Analyzed** | 10 relevant / 49 total |
+| **Files Skipped** | 12 | **Requirement description:** Verify that the client only accepts values from the authorization server (such as the authorization code or ID Token) if these values result from an authorization flow that was initiated by the same user agent session and transaction. This requires that client-generated secrets, such as the proofβ¦
+
+### Findings Overview
+
+| Severity | Count |
+|----------|-------|
+| π΄ Critical | 1 |
+| π High | 1 |
+| π‘ Medium | 0 |
+| π’ Low | 0 | ---
+
+## ASVS-10.1.2: Transaction Binding and Client-Generated Secrets
+
+### Findings for 10.1.2
+
+## generate a real token and store in the session
+basic.csrf_token = 'placeholder'
+```
+
+**Description:** The application uses a hardcoded placeholder value for its CSRF token rather than generating a cryptographically random, per-session, per-transaction secret. This means the "secret" is predictable, not specific to any transaction, and not securely bound to the user agent session. While this is labeled as a CSRF token (not an OAuth `state` or PKCE `code_verifier`), it represents the application's mechanism for binding form submissions to user sessions β which is the same [...]
+
+**Data flow:** Hardcoded `'placeholder'` β template `[csrf_token]` β form hidden field β POST endpoint β **never validated**
+
+**Gap Type:** Type A + Type B β The control placeholder EXISTS but is never implemented AND the result is never checked.
+
+**Proof of concept:**
+```http
+POST /do-vote/abc123 HTTP/1.1
+Host: target.example.com
+Content-Type: application/x-www-form-urlencoded
+Cookie: session=<victim_session>
+
+csrf_token=placeholder&vote-issue1=y
+```
+Any attacker can include `csrf_token=placeholder` since the value is publicly known and never validated.
+
+**Impact:** Any authenticated user's browser can be tricked into submitting votes, creating elections, opening/closing elections, or performing any POST action without their consent. The placeholder token provides zero protection against cross-site request forgery.
+
+**Remediation:**
+```python
+import secrets
+
+async def basic_info():
+ basic = edict()
+ # ...session reading...
+
+ s = await asfquart.session.read()
+ if s:
+ # Generate or retrieve a per-session CSRF token
+ if 'csrf_token' not in s:
+ s['csrf_token'] = secrets.token_hex(32)
+ await asfquart.session.write(s)
+ basic.csrf_token = s['csrf_token']
+
+ return basic
+```
+
+#### [HIGH]
+**Finding ID:** ASVS-1012-HIGH-001
+
+**File:** `v3/server/pages.py`, all POST endpoints
+
+**Description:** No POST endpoint validates the CSRF token submitted with forms. The token is included in templates but never checked server-side. This means even if a real token were generated, it would provide no protection.
+
+**Vulnerable code (representative example from `do_vote_endpoint`, line 372):**
+```python
+@APP.post('/do-vote/<eid>')
+@asfquart.auth.require({R.committer})
+@load_election
+async def do_vote_endpoint(election):
+ result = await basic_info()
+ ### check authz
+ form = edict(await quart.request.form)
+ # No CSRF validation performed
+ if not form:
+ await flash_danger('No vote data provided.')
+ ...
+```
+
+**Affected endpoints (all POST):**
+- `/do-vote/<eid>` (line 372)
+- `/do-create-election` (line 410)
+- `/do-add-issue/<eid>` (line 469)
+- `/do-edit-issue/<eid>/<iid>` (line 493)
+- `/do-delete-issue/<eid>/<iid>` (line 516)
+- `/do-set-open_at/<eid>` (line 360)
+- `/do-set-close_at/<eid>` (line 366)
+
+**Gap Type:** Type B β CSRF token field exists in forms but is never validated.
+
+**Impact:** All state-changing operations are vulnerable to CSRF attacks regardless of any future token generation.
+
+**Remediation:**
+```python
+async def validate_csrf(form_or_headers):
+ """Validate CSRF token from form data or headers."""
+ s = await asfquart.session.read()
+ if not s or 'csrf_token' not in s:
+ quart.abort(403, 'No session CSRF token')
+
+ # Check form field or header
+ submitted = form_or_headers.get('csrf_token') or \
+ quart.request.headers.get('X-CSRFToken')
+ if not secrets.compare_digest(submitted or '', s['csrf_token']):
+ quart.abort(403, 'CSRF token mismatch')
+```
+
+### Security Controls Inventory for 10.1.2
+
+| Control | Location | Status |
+|---------|----------|--------|
+| CSRF token generation | `pages.py:83` | β Placeholder only |
+| CSRF token in forms | Templates (manage.ezt, admin.ezt, vote-on.ezt) | β
Present in HTML |
+| CSRF token validation | None | β Never implemented |
+| OAuth state parameter | Not in scope (asfquart) | β οΈ Not inspectable |
+| PKCE code_verifier | Not in scope (asfquart) | β οΈ Not inspectable |
+| OIDC nonce | Not in scope (asfquart) | β οΈ Not inspectable | ### Positive Patterns for 10.1.2
+
+1. **Template-level CSRF field inclusion**: All forms include `<input type="hidden" name="csrf_token" value="[csrf_token]">` β infrastructure is ready for proper implementation.
+2. **Fetch header inclusion**: The `manage.ezt` template's JavaScript includes `'X-CSRFToken': csrfToken` in fetch headers β ready for validation.
+3. **Per-election cryptographic secrets**: The election system uses per-transaction salts via `crypto.gen_salt()` for vote tokens, demonstrating the architectural understanding of transaction binding.
+
+---
+
+
+> **Note:** 1 Critical finding has been redacted from this report and forwarded to the project's PMC private mailing list.
+
+
+
+
+## Cross-cutting Architecture Observations
+
+1. **OAuth/OIDC Implementation is External**: The actual OAuth/OIDC client implementation (token handling, authorization code flow, PKCE, state parameter) is entirely within the `asfquart` library, which is not provided for review. This limits the ability to fully assess requirements 10.1.1, 10.1.2, 10.2.1, 10.2.2, 10.2.3, and 10.3.1.
+
+2. **Session-Based Architecture**: The application uses a server-side session pattern where OAuth tokens are exchanged for a session. This is architecturally sound for 10.1.1 (tokens stay server-side) but shifts the security burden to session management.
+
+3. **CSRF Protection is Entirely Missing**: The most critical cross-cutting issue is the complete absence of CSRF protection. The placeholder token creates a false sense of security in the codebase. This affects requirements 10.1.2 and 10.2.1 directly.
+
+4. **State-Changing GET Requests**: The `/do-open/<eid>` and `/do-close/<eid>` endpoints perform irreversible operations via GET requests, violating HTTP semantics and creating trivially exploitable CSRF vulnerabilities.
+
+5. **Authorization Gaps**: Multiple `### check authz` placeholder comments indicate that ownership/permission validation is not implemented. Any authenticated committer can manage any election, regardless of ownership. This is a broader security issue that compounds with the CSRF vulnerabilities.
+
+6. **Acknowledged Issues**: The `TODO.md` file demonstrates awareness of the CSRF and authorization issues, indicating these are known technical debt rather than unknown vulnerabilities.
+
+---
+
+## Cross-cutting Recommendations
+
+### Immediate (P0 β Deploy blockers)
+
+1. **Implement real CSRF tokens**: Generate per-session cryptographic tokens using `secrets.token_hex(32)`, store in session, validate on all POST/state-changing endpoints. Estimated effort: 2-4 hours.
+
+2. **Convert GET state-changes to POST**: Change `/do-open/<eid>` and `/do-close/<eid>` from GET to POST, update templates to use form submissions with CSRF tokens. Estimated effort: 1 hour.
+
+3. **Implement ownership authorization**: Add checks that verify the authenticated user owns or has permission to manage an election before allowing open/close/edit/delete operations. Estimated effort: 4-8 hours.
+
+### Short-term (P1 β Next sprint)
+
+4. **Audit `asfquart` library**: Review the `asfquart` library's OAuth implementation to verify:
+ - PKCE or state parameter usage in authorization code flow
+ - Token audience validation
+ - Token storage security (HttpOnly, Secure cookies)
+ - Session fixation protection
+
+5. **Add SameSite cookie attributes**: Ensure session cookies use `SameSite=Lax` or `SameSite=Strict` as an additional CSRF defense layer.
+
+6. **Validate `docname` in `serve_doc()`**: While not OAuth-related, the path traversal risk in document serving should be addressed alongside authentication improvements.
+
+### Long-term (P2 β Architecture improvements)
+
+7. **Consider token-bound sessions**: If the infrastructure supports it, implement sender-constrained tokens (DPoP or mTLS) to prevent token theft/replay.
+
+8. **Implement rate limiting**: Add rate limiting on authentication-dependent endpoints to prevent brute-force attacks on election IDs.
+
+9. **Add security headers**: Implement `Content-Security-Policy`, `X-Content-Type-Options`, `X-Frame-Options` headers to complement the OAuth security posture.
+
\ 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