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:04:52 UTC
(tooling-agents) branch main updated: ASVS audit: 15.3.3.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 d29c93b ASVS audit: 15.3.3.md (redacted)
d29c93b is described below
commit d29c93b74e22a7c23a5fdaf20342065b806d1d3f
Author: ASF Tooling Team <ro...@apache.org>
AuthorDate: Tue May 5 14:04:32 2026 +0200
ASVS audit: 15.3.3.md (redacted)
---
ASVS/reports/steve/v3/d0aa7e9/all/15.3.3.md | 187 ++++++++++++++++++++++++++++
1 file changed, 187 insertions(+)
diff --git a/ASVS/reports/steve/v3/d0aa7e9/all/15.3.3.md b/ASVS/reports/steve/v3/d0aa7e9/all/15.3.3.md
new file mode 100644
index 0000000..321431f
--- /dev/null
+++ b/ASVS/reports/steve/v3/d0aa7e9/all/15.3.3.md
@@ -0,0 +1,187 @@
+# Security Audit Report: ASVS 15.3.3
+
+## Executive Summary
+
+| Field | Value |
+|-------|-------|
+| **Repository** | apache/steve/v3 |
+| **Audit Date** | May 05, 2026 |
+| **Auditor** | Tooling Agents (bundled-pass mode) |
+| **ASVS Requirement** | ASVS 15.3.3 |
+| **Files Analyzed** | 10 relevant / 49 total |
+| **Files Skipped** | 12 |
+
+**Requirement description:** Verify that the application has countermeasures to protect against mass assignment attacks by limiting allowed fields per controller and action, e.g., it is not possible to insert or update a field value when it was not intended to be part of that action.
+
+### Findings Overview
+
+| Severity | Count |
+|----------|-------|
+| 🔴 Critical | 0 |
+| 🟠High | 0 |
+| 🟡 Medium | 1 |
+| 🟢 Low | 1 |
+
+---
+
+## ASVS-15.3.3: Mass Assignment Protection
+
+### Findings for 15.3.3
+
+### [MEDIUM]
+
+**Finding ID:** ASVS-1533-MED-001
+
+**Title:** No Formal Allowlist Mechanism for Form Input Fields
+
+**File:** `v3/server/pages.py`, lines 384-392, 419-422, 475-478, 497-500
+
+**Vulnerable code (representative example from `do_vote_endpoint`):**
+```python
+form = edict(await quart.request.form)
+if not form:
+ await flash_danger('No vote data provided.')
+ return quart.redirect(f'/vote-on/{election.eid}', code=303)
+
+votes = {}
+for key, value in form.items():
+ if key.startswith('vote-'):
+ iid = key.split('-', 1)[1]
+ votes[iid] = value
+```
+
+**Issue:** While the application currently uses explicit field selection (only accessing specific keys from form data), there is no formal allowlist or schema validation mechanism that rejects unexpected fields. The pattern of wrapping all form data in `edict(await quart.request.form)` loads ALL submitted fields into memory. Although only specific fields are subsequently accessed, this pattern:
+
+1. Provides no enforcement mechanism to ensure new code paths can't accidentally use unintended fields
+2. Doesn't reject requests containing unexpected fields (defense in depth)
+3. Relies entirely on developer discipline at each endpoint
+
+**Current protection analysis:**
+- `do_create_endpoint`: Uses only `form.title` (good)
+- `do_add_issue_endpoint`: Uses only `form.title`, `form.description` (good)
+- `do_edit_issue_endpoint`: Uses only `form.title`, `form.description`; `vtype` and `kv` come from existing database record (good)
+- `do_vote_endpoint`: Filters to `vote-` prefixed keys (good)
+- `_set_election_date`: Uses only `data.get('date')` from JSON (good)
+
+**Impact:** Low immediate risk (current code correctly selects fields), but medium long-term risk as the application grows. A developer might inadvertently use `form.owner_pid` or `form.authz` in a future endpoint without realizing the security implication.
+
+**Remediation:** Implement explicit input schemas:
+```python
+from dataclasses import dataclass
+
+@dataclass
+class CreateElectionInput:
+ title: str
+
+async def parse_form(form_data, schema_class):
+ """Parse and validate form data against an explicit schema."""
+ allowed_fields = {f.name for f in fields(schema_class)}
+ unexpected = set(form_data.keys()) - allowed_fields - {'csrf_token'}
+ if unexpected:
+ quart.abort(400, f'Unexpected fields: {unexpected}')
+ return schema_class(**{k: form_data[k] for k in allowed_fields if k in form_data})
+
+@APP.post('/do-create-election')
+@asfquart.auth.require({R.pmc_member})
+async def do_create_endpoint():
+ form_data = await quart.request.form
+ input_data = await parse_form(form_data, CreateElectionInput)
+ election = steve.election.Election.create(DB_FNAME, input_data.title, result.uid)
+```
+
+---
+
+### [LOW]
+
+**Finding ID:** ASVS-1533-LOW-001
+
+**Title:** Debug Print Statements Expose Full Form Data
+
+**File:** `v3/server/pages.py`, lines 476, 497
+
+**Vulnerable code:**
+```python
+# In do_add_issue_endpoint:
+form = edict(await quart.request.form)
+print('FORM:', form)
+
+# In do_edit_issue_endpoint:
+form = edict(await quart.request.form)
+print('FORM:', form)
+```
+
+**Issue:** The `print('FORM:', form)` statements output the entire form data (including any extra fields an attacker submits) to stdout/logs. While not a mass assignment vulnerability per se, it indicates the full form data object is being handled without filtering.
+
+**Impact:** Information disclosure through log files; demonstrates the full form is available to handlers.
+
+**Remediation:** Remove debug print statements and log only expected fields:
+```python
+_LOGGER.debug(f'Adding issue: title="{form.title}"')
+```
+
+### Security Controls Inventory for 15.3.3
+
+| Control | Location | Status |
+|---------|----------|--------|
+| Explicit field selection in create | `pages.py` line 422 | Active — only `form.title` used |
+| Explicit field selection in add_issue | `pages.py` line 480 | Active — only `form.title`, `form.description` |
+| Explicit field selection in edit_issue | `pages.py` line 503 | Active — only `form.title`, `form.description` |
+| Hardcoded vtype/kv in add_issue | `pages.py` lines 478-479 | Active — prevents user override |
+| Preserved vtype/kv in edit_issue | `pages.py` line 503 | Active — uses database values |
+| Session-sourced owner_pid | `pages.py` line 422 | Active — `result.uid` from session |
+| Session-sourced voter identity | `pages.py` line 404 | Active — `result.uid` from session |
+| Vote key prefix filtering | `pages.py` line 389 | Active — only `vote-` prefixed keys |
+| IID validation against election | `pages.py` line 399 | Active — validates against known issues |
+
+### Positive Patterns for 15.3.3
+
+- **Strong**: `owner_pid` always derived from authenticated session (`result.uid`), never from form input
+- **Strong**: In `do_edit_issue_endpoint`, `issue.vtype` and `issue.kv` come from the database-loaded issue object, not from form data — prevents attackers from changing vote type
+- **Strong**: In `do_add_issue_endpoint`, `vtype` is hardcoded to `'yna'` and `kv` is `None` — form submissions cannot override these
+- **Strong**: `add_vote()` uses `result.uid` (session) as the voter identity — impossible to vote as another user
+- **Good**: Vote form processing uses prefix-based key filtering (`vote-`) and validates IIDs against the election's actual issues
+- **Good**: `_set_election_date` only extracts `data.get('date')` from JSON payload
+
+---
+
+
+
+## Cross-cutting Architecture Observations
+
+1. **Authentication vs. Authorization Gap**: The application has authentication (`@asfquart.auth.require`) but lacks fine-grained authorization. All committers can manage any election — there are multiple `### check authz` placeholder comments indicating this is known but unimplemented. This creates a horizontal privilege escalation risk.
+
+2. **CSRF Protection Entirely Missing**: The `csrf_token = 'placeholder'` on line 83 of `pages.py` means every state-changing endpoint is vulnerable to CSRF. This affects multiple requirements:
+ - 15.2.5: No protection for dangerous operations (open/close election)
+ - 15.3.3: Mass assignment protection is weakened when attackers can submit forms cross-origin
+
+3. **Defense in Depth Architecture**: The application relies on a single-layer architecture where the web server, business logic, and cryptographic operations all run in the same process. This maximizes blast radius from any single vulnerability.
+
+4. **State Machine as Security Control**: The `assert`-based state machine in `election.py` (editable → open → closed) provides an important security boundary. However, `assert` statements can be disabled with Python's `-O` flag, making this a fragile control for production.
+
+5. **Query Design Philosophy**: The codebase shows two competing patterns — some queries (external-facing) explicitly select safe columns, while others (internal) use `SELECT *`. This split is well-documented but creates maintenance risk.
+
+6. **Session-Based Identity**: The consistent use of `result.uid` from authenticated sessions for identity (rather than client-supplied values) is a strong positive pattern across all endpoints.
+
+## Cross-cutting Recommendations
+
+### Immediate (Critical/High Priority)
+1. **Implement CSRF protection**: Replace `'placeholder'` with actual token generation and validation on all state-changing endpoints
+2. **Convert GET state-changers to POST**: `/do-open/<eid>` and `/do-close/<eid>` must be POST endpoints
+3. **Implement authorization checks**: Fill in all `### check authz` placeholders — at minimum, verify that the authenticated user is the election owner before allowing management operations
+4. **Replace `assert` with explicit checks**: State validation should use `if not ... : raise` rather than `assert` which can be optimized away
+
+### Short-term (Medium Priority)
+5. **Configure trusted proxy middleware**: Add ProxyFix or equivalent with appropriate trust depth
+6. **Add IP addresses to audit logs**: Include client IP (from trusted proxy chain) in security-relevant log entries
+7. **Replace `SELECT *` queries**: Use explicit column lists in all queries, especially those touching tables with cryptographic material
+8. **Implement formal input schemas**: Add dataclass or Pydantic-based input validation with explicit field allowlists
+9. **Remove debug print statements**: Replace with structured logging at appropriate levels
+10. **Pin dependency sources**: Add repository configuration and generate/commit lock file with hashes
+
+### Long-term (Architecture)
+11. **Service separation**: Split admin, voter, and cryptographic operations into separate services with network isolation
+12. **Containerization**: Deploy with container-level isolation between components
+13. **Least privilege**: The crypto/tally service should be the only component with access to opened_key values
+14. **Rate limiting**: Implement rate limiting using correctly-resolved client IPs
+15. **Dependency scanning**: Integrate automated dependency vulnerability scanning (e.g., `pip-audit`, `safety`) into CI/CD
+
\ 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