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/04/22 13:53:10 UTC
(tooling-agents) branch main updated: ASVS L3 audit: 6.3.8 (ch06_general)
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 61878b8 ASVS L3 audit: 6.3.8 (ch06_general)
61878b8 is described below
commit 61878b8fec594caac4f0c6714b7a95d4e7e526ef
Author: ASF Tooling Team <ro...@apache.org>
AuthorDate: Wed Apr 22 15:53:04 2026 +0200
ASVS L3 audit: 6.3.8 (ch06_general)
---
.../reports/steve/v3/d0aa7e9/ch06_general/6.3.8.md | 341 +++++++++++++++++++++
1 file changed, 341 insertions(+)
diff --git a/repos/apache/ASVS/reports/steve/v3/d0aa7e9/ch06_general/6.3.8.md b/repos/apache/ASVS/reports/steve/v3/d0aa7e9/ch06_general/6.3.8.md
new file mode 100644
index 0000000..d59f3ce
--- /dev/null
+++ b/repos/apache/ASVS/reports/steve/v3/d0aa7e9/ch06_general/6.3.8.md
@@ -0,0 +1,341 @@
+# ASVS 6.3.8 Security Audit Report
+
+## Executive Summary
+
+**Audit Metadata:**
+- **Repository:** apache/steve
+- **Audit Date:** Apr 22, 2026
+- **Auditor:** Tooling Agents
+- **ASVS Requirement:** 6.3.8 — Verify that valid users cannot be deduced from failed authentication challenges, such as by basing on error messages, HTTP response codes, or different response times. Registration and forgot password functionality must also have this protection.
+- **ASVS Level:** 3
+- **ASVS Section:** General Authentication Security
+- **Files Analyzed:** 3 relevant files out of 49 total (12 skipped)
+
+**Finding Summary:**
+
+| Severity | Count | Status |
+|----------|-------|--------|
+| Critical | 0 | ✅ None found |
+| High | 0 | ✅ None found |
+| Medium | 1 | ⚠️ Requires attention |
+| Low | 0 | ✅ None found |
+| **Total** | **1** | |
+
+**Key Observations:**
+- Primary authentication is delegated to external ASF OAuth system (not verifiable from this codebase)
+- No user-facing registration or forgot password flows exist in application
+- One medium-severity differential response issue in PersonDB status checking
+- Strong positive security patterns for error message uniformity and session-based user identification
+
+---
+
+## Security Controls Inventory
+
+| Control | Defined In | Purpose | Coverage |
+|---------|-----------|---------|----------|
+| External OAuth Auth | `asfquart.auth` (external) | Primary authentication | All protected routes |
+| `@asfquart.auth.require({R.committer})` | `pages.py` decorators | Role-based access | Most endpoints |
+| PersonDB lookup | `pages.py:admin_page` | Check voter registration | `/admin` only |
+| Mayvote eligibility check | `pages.py:vote_on_page`, `serve_doc` | Voter authorization | `/vote-on/<eid>`, `/docs/` |
+| Generic error in vote submission | `pages.py:do_vote_endpoint` | Error message uniformity | `/do-vote/<eid>` |
+
+### Coverage Analysis
+
+| Authentication-Related Flow | User Enumeration Protection | Status |
+|----|---|---|
+| Login | Delegated to external ASF OAuth | **NOT VERIFIABLE** from this code |
+| Registration | No user-facing registration exists | N/A |
+| Forgot Password | No forgot password exists | N/A |
+| PersonDB status check (`/admin`) | Different HTTP codes (200 vs 404), different templates | **GAP** |
+| Voter eligibility (`/vote-on/<eid>`) | Same template reused (positive), but different page title | **PARTIAL** |
+| Vote submission errors | Generic error message | **COMPLIANT** |
+
+---
+
+## Critical File Review
+
+### `v3/server/pages.py`
+
+| Line(s) | Function | ASVS 6.3.8 Relevance | Status |
+|---------|----------|----------------------|--------|
+| ~297-310 | `admin_page` | PersonDB lookup reveals registration status | **FINDING** |
+| ~247-257 | `vote_on_page` | Eligibility check with template reuse | Mostly compliant |
+| ~405-408 | `do_vote_endpoint` | Generic error messages | ✅ Compliant |
+| ~578-581 | `serve_doc` | Generic 404 for unauthorized docs | ✅ Compliant |
+| ~165-186 | `load_election` | Election existence check | N/A (not user data) |
+
+### `v3/steve/election.py`
+
+| Line(s) | Function | ASVS 6.3.8 Relevance | Status |
+|---------|----------|----------------------|--------|
+| ~31-37 | `__init__` | `ElectionNotFound` exception | N/A (election, not user) |
+| ~233-248 | `add_vote` | Mayvote check may raise AttributeError | Caught generically upstream |
+| ~142-155 | `get_metadata` | Returns election metadata (no user info leaked) | ✅ Compliant |
+| ~459-465 | `ElectionNotFound` | Exception includes EID only | ✅ Compliant |
+
+### `v3/ARCHITECTURE.md`
+
+| Section | ASVS 6.3.8 Relevance | Status |
+|---------|----------------------|--------|
+| Authentication architecture | Documents external OAuth delegation | ℹ️ Informational |
+
+---
+
+## Findings
+
+### Medium Severity
+
+#### ASVS-638-MED-001: Differential Response in `/admin` Reveals PersonDB Registration Status
+
+**Severity:** MEDIUM
+
+**Location:**
+- **File:** `v3/server/pages.py`
+- **Function:** `admin_page`
+- **Lines:** ~297-310
+
+**Related Functions Checked:**
+- `basic_info()` — Session data retrieval
+- `steve.persondb.PersonDB.open()` — Database access
+- `pdb.get_person()` — User lookup
+- `raise_404()` — Error response handler
+
+**Description:**
+
+When an authenticated ASF committer visits `/admin`, the application checks whether they exist in the PersonDB (the STeVe voter/person database). Two distinct responses are returned:
+
+| Condition | HTTP Status | Template | Page Title | Processing Time |
+|-----------|------------|----------|------------|-----------------|
+| Person in PersonDB | 200 | `admin.ezt` | "Administration" | Longer (additional queries for owned elections, postprocessing) |
+| Person NOT in PersonDB | 404 | `e_bad_pid.ezt` | "Unknown Person" | Shorter (immediate abort) |
+
+This creates three observable differentiators:
+1. **HTTP response code**: 200 vs 404
+2. **Page content/template**: Full admin page vs. "Unknown Person" error
+3. **Timing**: Successful path executes additional DB queries and template processing
+
+**Vulnerable Code:**
+
+```python
+pdb = steve.persondb.PersonDB.open(DB_FNAME)
+try:
+ me = pdb.get_person(result.uid)
+except steve.persondb.PersonNotFound:
+ ### the authn'd committer is not in "person"
+
+ result = await basic_info()
+ result.title = 'Unknown Person'
+ result.pid = result.uid
+ # Note: result.uid (and friends) are needed for the navbar.
+ raise_404(T_BAD_PID, result)
+ # NOTREACHED
+```
+
+**Data Flow:**
+
+```
+Authenticated Session (result.uid)
+ ↓
+PersonDB.get_person(result.uid)
+ ↓
+├─ Found → HTTP 200 + admin.ezt template + additional DB queries
+└─ Not Found → HTTP 404 + e_bad_pid.ezt template + immediate abort
+```
+
+**Gap Classification:** Type A — Entry point with no user-enumeration control
+
+**Proof of Concept:**
+
+```http
+# Authenticated committer NOT in PersonDB:
+GET /admin HTTP/1.1
+Cookie: session=<valid_committer_session>
+
+→ HTTP/1.1 404 Not Found
+→ Content: "Unknown Person" page (T_BAD_PID template)
+
+# Authenticated committer IN PersonDB:
+GET /admin HTTP/1.1
+Cookie: session=<valid_committer_session>
+
+→ HTTP/1.1 200 OK
+→ Content: Full admin dashboard (admin.ezt template)
+```
+
+**Impact:**
+
+At ASVS Level 3, this differential response reveals whether an authenticated ASF committer is registered in the STeVe PersonDB (voter database). While the impact is limited because:
+- It requires prior ASF OAuth authentication
+- It only reveals the authenticated user's own registration status
+- PersonDB is a secondary database (not the authentication database)
+
+...at Level 3, even self-status information leakage through differential responses violates the principle of consistent error handling. In environments where PersonDB registration status is operationally sensitive (e.g., revealing who has been provisioned as a voter before an election is announced), this could be meaningful.
+
+**Remediation:**
+
+Return a consistent response regardless of PersonDB status. Either show a "setup required" page with the same HTTP 200 code, or handle the missing person case gracefully within the normal admin template:
+
+```python
+@APP.get('/admin')
+@asfquart.auth.require({R.committer})
+@APP.use_template(TEMPLATES / 'admin.ezt')
+async def admin_page():
+ result = await basic_info()
+ result.title = 'Administration'
+
+ with asfpy.stopwatch.Stopwatch():
+ election = steve.election.Election.open_to_pid(DB_FNAME, result.uid)
+ owned = steve.election.Election.owned_elections(DB_FNAME, result.uid)
+
+ result.owned = [postprocess_election(e) for e in owned]
+
+ pdb = steve.persondb.PersonDB.open(DB_FNAME)
+ try:
+ me = pdb.get_person(result.uid)
+ for e in result.owned:
+ e.owner_name = me[0]
+ result.person_registered = True
+ except steve.persondb.PersonNotFound:
+ # Return a consistent 200 response with a "not yet registered" state
+ # visible in the template, rather than a 404 error page
+ result.person_registered = False
+
+ result.len_election = len(election)
+ result.len_owned = len(owned)
+
+ return result
+```
+
+---
+
+## Positive Security Patterns
+
+### 1. Consistent Error Template Reuse in `vote_on_page`
+
+**Location:** `v3/server/pages.py`, line ~257
+
+```python
+raise_404(T_BAD_EID, result) # Reuse template for consistency
+```
+
+The developer explicitly noted the intent to reuse the `T_BAD_EID` template for consistency when a user is not eligible, rather than creating a distinct "not eligible" error page. This is a good practice for preventing information leakage, though the different `result.title` value partially undermines it.
+
+### 2. Generic Vote Submission Error Messages
+
+**Location:** `v3/server/pages.py`, lines ~405-408
+
+```python
+except Exception as e:
+ _LOGGER.error(f'Error adding vote for user[U:{result.uid}] on issue[I:{iid}]: {e}')
+ await flash_danger(f'Error submitting vote for issue {iid}.')
+```
+
+Detailed error information is logged server-side only, while the user receives a generic error message that doesn't reveal the specific failure reason (e.g., eligibility vs. crypto error vs. database error).
+
+### 3. Document Access Returns Generic 404
+
+**Location:** `v3/server/pages.py`, lines ~578-581
+
+```python
+row = db.q_get_mayvote.first_row(result.uid, iid)
+if not row:
+ # Nothing fancy. Just pretend the file does not exist
+ quart.abort(404)
+```
+
+The developer deliberately returns 404 (pretending the resource doesn't exist) rather than 403 (revealing the resource exists but access is denied), preventing information leakage about document existence.
+
+### 4. Session-Based User Identification
+
+All user-related checks use `result.uid` from the authenticated session rather than accepting user identifiers as URL parameters or form inputs. This prevents one authenticated user from probing information about another user.
+
+### 5. Election Existence Checks Use Consistent Templates
+
+**Location:** `v3/server/pages.py`, `load_election` and `load_election_issue` decorators
+
+Both decorators use the same `T_BAD_EID`/`T_BAD_IID` template and 404 status code for not-found resources, providing consistent responses.
+
+---
+
+## Architecture Observations
+
+### 1. External Authentication Dependency
+
+Authentication is entirely delegated to ASF OAuth (`asfquart.auth`). ASVS 6.3.8 compliance for the login flow itself **cannot be verified** from this codebase. The external authentication system must be independently audited for user enumeration protections.
+
+### 2. No Registration or Forgot Password Flows
+
+The application has no user-facing registration or password reset functionality. Voter registration is performed through administrative processes (CLI tools, PersonDB management). This eliminates two of the three enumeration vectors specified in ASVS 6.3.8.
+
+### 3. Two-Layer User Database
+
+The system has two user databases — the external ASF OAuth system (authentication) and the internal PersonDB (authorization/voter management). The differential response in `admin_page` reveals status in the secondary database, not the primary authentication database.
+
+### 4. Session-Only User Identification
+
+All post-authentication user checks derive the user identifier from the server-side session (`result.uid`), never from client-supplied parameters. This architectural decision effectively prevents cross-user enumeration.
+
+---
+
+## Recommendations Summary
+
+### Immediate Actions (Priority 1)
+
+| Recommendation | Effort | Impact |
+|----------------|--------|--------|
+| Fix `admin_page` to return consistent HTTP 200 regardless of PersonDB status (ASVS-638-MED-001) | Low | Medium |
+
+**Details:** Modify the `admin_page` function to handle PersonDB lookup failures gracefully within the normal admin template, returning HTTP 200 with a "not yet registered" state rather than a 404 error page.
+
+### Short-term Actions (Priority 2)
+
+| Recommendation | Effort | Impact |
+|----------------|--------|--------|
+| Make `vote_on_page` eligibility denial use the same title as `load_election`'s not-found response to fully align responses | Low | Low |
+| Document that ASVS 6.3.8 login/registration/forgot-password requirements are delegated to external auth provider in security documentation | Low | Low |
+
+**Details:**
+- Standardize page titles in error responses to eliminate subtle timing/content differences
+- Create formal documentation acknowledging the authentication boundary and external dependency
+
+### Long-term Actions (Priority 3)
+
+| Recommendation | Effort | Impact |
+|----------------|--------|--------|
+| Verify external ASF OAuth system independently for ASVS 6.3.8 (login flow user enumeration) | Medium | High |
+
+**Details:** Coordinate with ASF OAuth system owners to conduct independent audit of login flow for user enumeration protections, including error messages, HTTP response codes, and timing analysis.
+
+---
+
+## Appendix: Files Analyzed
+
+<details>
+<summary>Click to expand file list (3 files)</summary>
+
+### Relevant Files
+
+1. **`v3/server/pages.py`** (Relevance: 8/10)
+ - Primary application routes and authentication checks
+ - Contains ASVS-638-MED-001 finding
+ - Multiple positive security patterns identified
+
+2. **`v3/steve/election.py`** (Relevance: 3/10)
+ - Election management and vote processing
+ - Generic exception handling reviewed
+ - No user enumeration issues found
+
+3. **`v3/ARCHITECTURE.md`** (Relevance: 2/10)
+ - Architecture documentation
+ - Authentication delegation documented
+ - Informational only
+
+### Files Skipped
+
+12 files skipped due to low relevance to ASVS 6.3.8 (authentication flows, user enumeration)
+
+</details>
+
+---
+
+**End of Report**
\ 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