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 21:01:40 UTC

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

commit 57c352f293bcd326a767782420bc32926c96daba
Author: ASF Tooling Team <ro...@apache.org>
AuthorDate: Tue May 5 22:55:16 2026 +0200

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

diff --git a/ASVS/reports/steve/v3/d0aa7e9/all/2.3.5.md b/ASVS/reports/steve/v3/d0aa7e9/all/2.3.5.md
new file mode 100644
index 0000000..8b30b50
--- /dev/null
+++ b/ASVS/reports/steve/v3/d0aa7e9/all/2.3.5.md
@@ -0,0 +1,173 @@
+# Security Audit Report: ASVS 2.3.5
+
+## Executive Summary
+
+| Field | Value |
+|-------|-------|
+| **Repository** | apache/steve/v3 |
+| **Audit Date** | May 05, 2026 |
+| **Auditor** | Tooling Agents (bundled-pass mode) |
+| **ASVS Requirement** | ASVS 2.3.5 |
+| **Files Analyzed** | 17 relevant / 49 total |
+| **Files Skipped** | 12 |
+
+**Requirement description:** Verify that high-value business logic flows require multi-user approval to prevent unauthorized or accidental actions. This could include but is not limited to large monetary transfers, contract approvals, access to classified information, or safety overrides in manufacturing.
+
+### Findings Overview
+
+| Severity | Count |
+|----------|-------|
+| 🔴 Critical | 0 |
+| 🟠 High | 0 |
+| 🟡 Medium | 1 |
+| 🟢 Low | 1 |
+
+---
+
+## ASVS-2.3.5: Multi-User Approval for High-Value Operations
+
+### Findings for 2.3.5
+
+### [MEDIUM]
+
+**Finding ID**: ASVS-235-MED-001
+**Title**: Irreversible Election State Changes Require Only Single-User Action
+
+**Location**: `v3/server/pages.py`, `do_open_endpoint()` (line 431), `do_close_endpoint()` (line 451)
+
+**Vulnerable code**:
+```python
+@APP.get('/do-open/<eid>')
+@asfquart.auth.require({R.committer})
+@load_election
+async def do_open_endpoint(election):
+    result = await basic_info()
+    ### check authz
+    pdb = steve.persondb.PersonDB.open(DB_FNAME)
+    election.open(pdb)  # Single user, irreversible
+    ...
+
+@APP.get('/do-close/<eid>')
+@asfquart.auth.require({R.committer})
+@load_election
+async def do_close_endpoint(election):
+    result = await basic_info()
+    ### check authz
+    election.close()  # Single user, irreversible
+    ...
+```
+
+**Data flow**: Single authenticated committer → GET request → irreversible state change (open or close) → no approval workflow
+
+**Context**: Opening an election triggers irreversible cryptographic operations (salt generation, opened_key computation). Closing an election permanently ends voting. Both actions have significant organizational impact — voters may be disenfranchised by premature closure, or an improperly configured election may be opened without review.
+
+**Impact**: A single user (or compromised account) can irreversibly alter election state without oversight. For an organization like the ASF where elections determine governance, this represents a high-value operation that should require multi-party approval.
+
+**Remediation**:
+```python
+# Add approval workflow
+@APP.post('/do-request-open/<eid>')
+@asfquart.auth.require({R.committer})
+@load_election
+async def request_open_endpoint(election):
+    # Record the request and notify approvers
+    election.request_state_change('open', requester_pid=result.uid)
+    # Notify election owner or designated approvers
+    ...
+
+@APP.post('/do-approve-open/<eid>')
+@asfquart.auth.require({R.committer})
+@load_election
+async def approve_open_endpoint(election):
+    # Verify approver is different from requester
+    # Verify approver has authority
+    # Execute the state change
+    ...
+```
+
+---
+
+### [LOW]
+
+**Finding ID**: ASVS-235-LOW-001
+**Title**: Election Creation Has No Secondary Approval
+
+**Location**: `v3/server/pages.py`, `do_create_endpoint()` (line 410)
+
+**Vulnerable code**:
+```python
+@APP.post('/do-create-election')
+@asfquart.auth.require({R.pmc_member})
+async def do_create_endpoint():
+    ...
+    election = steve.election.Election.create(DB_FNAME, form.title, result.uid)
+    ...
+```
+
+**Impact**: While creation itself is not destructive, it's the entry point for the entire election lifecycle. A PMC member could create elections without organizational awareness. This is lower severity as elections must still be opened and closed, and the `R.pmc_member` requirement provides some gatekeeping.
+
+### Security Controls Inventory for 2.3.5
+
+| Control | Location | Coverage Status |
+|---------|----------|-----------------|
+| `R.pmc_member` for creation | `pages.py` `do_create_endpoint` | APPLIED — higher privilege for creation |
+| Client-side confirmation modals | `manage.ezt` | APPLIED — but single-user, client-side only |
+| Multi-user approval workflow | Not present | NOT IMPLEMENTED |
+| Audit logging of state changes | `pages.py` (various `_LOGGER.info`) | APPLIED — records who made changes |
+
+### Positive Patterns for 2.3.5
+
+- The client-side confirmation modals for open/close operations provide UX friction against accidental clicks (though they don't constitute multi-user approval).
+- Comprehensive audit logging records which user performed each state change, providing after-the-fact accountability.
+- The `R.pmc_member` requirement for election creation provides a higher authorization bar than general management.
+
+---
+
+
+
+## Cross-cutting Architecture Observations
+
+1. **Type B Gaps Dominate**: The most critical pattern is controls that EXIST in the codebase (owner_pid, authz, CSRF tokens, state validation) but are NOT APPLIED at the enforcement point. This creates false confidence — the schema and comments suggest security is in place, but enforcement is absent.
+
+2. **Assert vs. Exception Pattern Inconsistency**: The codebase uses `assert` for state checks in some methods (`open()`, `close()`, `add_issue()`) but proper exceptions in others (`add_vote()` via `_all_metadata(required_state)`). This inconsistency means security enforcement depends on which code path is taken.
+
+3. **GET for State Changes**: The use of GET requests for irreversible operations (`/do-open/<eid>`, `/do-close/<eid>`) combines with the CSRF gap to create a particularly dangerous attack surface.
+
+4. **Single-Layer Defense**: Security controls exist primarily at the model layer (`election.py`) with minimal web-layer enforcement. The web layer (pages.py) trusts that the model will enforce constraints, but the model uses bypassable assertions.
+
+5. **SQLite Concurrency Model**: The application relies on SQLite's implicit serialization for concurrency safety, but the check-then-act patterns in the application layer create TOCTOU windows that could be exploited in multi-process deployments.
+
+6. **Audit Trail Strength**: Logging of user actions is consistently implemented, providing after-the-fact accountability even where preventive controls are missing.
+
+## Cross-cutting Recommendations
+
+### Immediate (P0 — Address Before Production Use)
+
+1. **Replace all `assert` statements** with proper exception raising (`ElectionBadState`) in `election.py`. This is the most critical fix as it affects all state enforcement.
+
+2. **Implement authorization checks** in all management endpoints — compare `result.uid` against `election.owner_pid`/`election.authz`. This closes the most impactful Type B gap.
+
+3. **Implement CSRF protection** — generate real tokens per session and validate them in all POST endpoints. Change `/do-open/` and `/do-close/` to POST methods.
+
+4. **Add vote string validation** in `add_vote()` — validate against issue type before encryption.
+
+### Short-term (P1 — Within Next Sprint)
+
+5. **Wrap vote submission in a transaction** — ensure atomic ballot submission in `do_vote_endpoint()`.
+
+6. **Make election open operation atomic** — combine `add_salts()` and the state change in a single transaction.
+
+7. **Add rate limiting** on all mutating endpoints, prioritizing `/do-vote/<eid>` and `/do-create-election`.
+
+8. **Add prerequisite validation** before election opening (verify issues exist, voters are registered).
+
+### Long-term (P2 — Architecture Improvements)
+
+9. **Implement multi-user approval** for irreversible state changes (open/close elections), particularly for elections with many eligible voters.
+
+10. **Add explicit optimistic locking** (e.g., version column) on the election table to prevent concurrent state modifications.
+
+11. **Re-enable and complete transactions** in the `create-election.py` script.
+
+12. **Consider vote garbage collection** — periodically remove superseded vote rows to prevent unbounded table growth.
+        
\ 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