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:01:20 UTC

(tooling-agents) branch main updated: ASVS audit: 10.3.1.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 28d7e8f  ASVS audit: 10.3.1.md (redacted)
28d7e8f is described below

commit 28d7e8f4545df95e34516182ba2936bd30665a57
Author: ASF Tooling Team <ro...@apache.org>
AuthorDate: Tue May 5 14:01:06 2026 +0200

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

diff --git a/ASVS/reports/steve/v3/d0aa7e9/all/10.3.1.md b/ASVS/reports/steve/v3/d0aa7e9/all/10.3.1.md
new file mode 100644
index 0000000..c6dccf0
--- /dev/null
+++ b/ASVS/reports/steve/v3/d0aa7e9/all/10.3.1.md
@@ -0,0 +1,124 @@
+# Security Audit Report: ASVS 10.3.1
+
+## Executive Summary
+
+| Field | Value |
+|-------|-------|
+| **Repository** | apache/steve/v3 |
+| **Audit Date** | May 05, 2026 |
+| **Auditor** | Tooling Agents (bundled-pass mode) |
+| **ASVS Requirement** | ASVS 10.3.1 |
+| **Files Analyzed** | 10 relevant / 49 total |
+| **Files Skipped** | 12 |
+
+**Requirement description:** Verify that the resource server only accepts access tokens that are intended for use with that service (audience). The audience may be included in a structured access token (such as the 'aud' claim in JWT), or it can be checked using the token introspection endpoint.
+
+### Findings Overview
+
+| Severity | Count |
+|----------|-------|
+| 🔴 Critical | 0 |
+| 🟠 High | 0 |
+| 🟡 Medium | 1 |
+| 🟢 Low | 0 |
+
+---
+
+## ASVS-10.3.1: Access Token Audience Validation
+
+### Findings for 10.3.1
+
+#### [MEDIUM]
+**Finding ID:** ASVS-1031-MED-001
+
+**File:** `v3/server/pages.py`, all endpoints using `@asfquart.auth.require`
+
+**Description:** The application acts as a resource server (protected API/web application). Token/session validation is performed by `asfquart.auth.require`, but there is no visible audience (`aud`) claim validation in the provided code. If the authentication mechanism uses structured access tokens (JWTs), the application should verify that tokens are intended for this specific service.
+
+**Vulnerable code (representative):**
+```python
+@APP.get('/voter')
+@asfquart.auth.require({R.committer})  ### need general solution
+@APP.use_template(TEMPLATES / 'voter.ezt')
+async def voter_page():
+    result = await basic_info()
+    # No audience validation visible
+```
+
+**Assessment:** The `asfquart.auth.require` decorator handles all authentication. Whether it validates the `aud` claim depends on the library's implementation, which is not provided. If this uses session-based authentication (session cookie → server-side session store), audience validation may not be directly applicable in the same way as JWT bearer tokens. However, if the session is created from an OAuth token exchange, the initial token should have been audience-validated.
+
+**Gap Type:** Cannot determine — control may exist in `asfquart` library.
+
+**Impact:** If another service in the ASF infrastructure issues tokens with the same authorization server but different intended audiences, a token meant for another service could potentially be used to access this application. Severity depends on the `asfquart` implementation.
+
+**Remediation:** Verify that the `asfquart` library validates the `aud` claim during token exchange or session creation. If using JWT access tokens directly, add audience validation:
+
+```python
+# In asfquart configuration (conceptual)
+APP.config['OAUTH_AUDIENCE'] = 'steve-voting-system'
+# Ensure asfquart validates this during token/session processing
+```
+
+### Security Controls Inventory for 10.3.1
+
+| Control | Location | Status |
+|---------|----------|--------|
+| Token audience validation | `asfquart` library (external) | ⚠️ Not inspectable |
+| Role-based access control | `pages.py` - all protected endpoints | ✅ Applied via decorators |
+| Per-resource authorization (mayvote check) | `pages.py:236,567` | ✅ Applied for vote-on and docs |
+
+### Positive Patterns for 10.3.1
+
+1. **Defense-in-depth authorization**: Beyond authentication, the application performs additional authorization checks (e.g., verifying voter eligibility via `q_find_issues` in `vote_on_page()`, line 236, and document access via `q_get_mayvote` in `serve_doc()`, line 567).
+2. **Resource-level access control**: Even after session authentication, access to specific resources (elections, documents) requires additional database-backed authorization checks.
+
+---
+
+
+
+## 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