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 14:10:20 UTC
(tooling-agents) branch main updated: ASVS L3 audit: 6.5.1 (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 d778005 ASVS L3 audit: 6.5.1 (ch06_general)
d778005 is described below
commit d7780055f58dd463663e3b7715d20a0a2044161c
Author: ASF Tooling Team <ro...@apache.org>
AuthorDate: Wed Apr 22 16:10:15 2026 +0200
ASVS L3 audit: 6.5.1 (ch06_general)
---
.../reports/steve/v3/d0aa7e9/ch06_general/6.5.1.md | 198 +++++++++++++++++++++
1 file changed, 198 insertions(+)
diff --git a/repos/apache/ASVS/reports/steve/v3/d0aa7e9/ch06_general/6.5.1.md b/repos/apache/ASVS/reports/steve/v3/d0aa7e9/ch06_general/6.5.1.md
new file mode 100644
index 0000000..679d6cd
--- /dev/null
+++ b/repos/apache/ASVS/reports/steve/v3/d0aa7e9/ch06_general/6.5.1.md
@@ -0,0 +1,198 @@
+# ASVS 6.5.1 Security Audit Report
+
+## Executive Summary
+
+**Repository:** apache/steve
+**Audit Date:** Apr 22, 2026
+**Auditor:** Tooling Agents
+**ASVS Requirement:** 6.5.1 — Verify that lookup secrets, out-of-band authentication requests or codes, and time-based one-time passwords (TOTPs) are only successfully usable once.
+**ASVS Level:** 2
+**Section:** General Multi-factor authentication requirements
+
+**Files Analyzed:** 5 relevant out of 49 total, 12 skipped
+
+### Finding Summary
+
+| Severity | Count |
+|----------|-------|
+| Critical | 0 |
+| High | 0 |
+| Medium | 0 |
+| Low | 0 |
+| **Total** | **0** |
+
+### Audit Conclusion
+
+After thorough analysis of the provided codebase, **no MFA mechanisms (TOTP, lookup secrets, or out-of-band codes) are implemented within the application code**. Authentication is entirely delegated to the external `asfquart` framework. Therefore, compliance with ASVS 6.5.1 cannot be verified from the provided source alone, and no findings at MEDIUM or above severity can be substantiated against the in-scope code.
+
+---
+
+## Security Controls Inventory
+
+### Authentication Mechanism Analysis
+
+| Control | Defined? | Where? | Applied? | Notes |
+|---------|----------|--------|----------|-------|
+| Session-based Authentication | External | `asfquart.session` / `asfquart.auth` | Yes, via decorators | Not in-scope code |
+| Role-based Access (committer) | External | `asfquart.auth.Requirements` | Yes, on most routes | Enforced at route level |
+| Role-based Access (pmc_member) | External | `asfquart.auth.Requirements` | Yes, on create election | Only on `/do-create-election` |
+| TOTP Verification | **NOT FOUND** | — | — | Not implemented in codebase |
+| Lookup Secrets (recovery codes) | **NOT FOUND** | — | — | Not implemented in codebase |
+| Out-of-Band Authentication | **NOT FOUND** | — | — | Not implemented in codebase |
+| CSRF Token | Placeholder only | `pages.py:93` | **NOT APPLIED** | `basic.csrf_token = 'placeholder'` |
+
+### MFA-Relevant Code Search Results
+
+| Search Target | Files Searched | Found? | Location |
+|---------------|----------------|--------|----------|
+| TOTP / OTP generation/verification | All files | No | — |
+| Recovery code / backup code logic | All files | No | — |
+| SMS/email code send/verify | All files | No | — |
+| Single-use token invalidation | All files | No | — |
+| `pyotp` / `otpauth` imports | All files | No | — |
+| Nonce/replay prevention for auth | All files | No | — |
+
+---
+
+## Critical File Review
+
+### `v3/server/pages.py` — Route Authentication Coverage
+
+| Route | Method | Auth Decorator | MFA Check | Single-Use Token Check |
+|-------|--------|----------------|-----------|------------------------|
+| `/` | GET | None | N/A | N/A |
+| `/voter` | GET | `R.committer` | None | None |
+| `/vote-on/<eid>` | GET | `R.committer` | None | None |
+| `/admin` | GET | `R.committer` | None | None |
+| `/manage/<eid>` | GET | `R.committer` | None | None |
+| `/do-vote/<eid>` | POST | `R.committer` | None | None |
+| `/do-create-election` | POST | `R.pmc_member` | None | None |
+| `/do-open/<eid>` | GET | `R.committer` | None | None |
+| `/do-close/<eid>` | GET | `R.committer` | None | None |
+| `/do-add-issue/<eid>` | POST | `R.committer` | None | None |
+| `/do-edit-issue/<eid>/<iid>` | POST | `R.committer` | None | None |
+| `/do-delete-issue/<eid>/<iid>` | POST | `R.committer` | None | None |
+| `/profile` | GET | Bare `@require` | None | None |
+| `/docs/<iid>/<docname>` | GET | Bare `@require` | None | None |
+
+### `v3/steve/crypto.py` — Token/Secret Analysis
+
+| Function | Produces One-Time Value? | Invalidation After Use? | Relevance to 6.5.1 |
+|----------|--------------------------|-------------------------|---------------------|
+| `gen_salt()` | Yes (random salt) | N/A (stored, not auth) | Not MFA-related |
+| `gen_opened_key()` | Yes (per-election key) | N/A (integrity check) | Not MFA-related |
+| `gen_vote_token()` | Deterministic per voter/issue | Not invalidated; reusable for re-voting | Not MFA-related |
+| `create_id()` | Yes (random hex) | N/A (identifiers) | Not MFA-related |
+
+### `v3/steve/election.py` — Vote Token Reuse Analysis
+
+The `add_vote()` method at **line 223** generates a `vote_token` that is deterministic for a given `(opened_key, pid, iid, salt)` tuple:
+
+```python
+def add_vote(self, pid: str, iid: str, votestring: str):
+ md = self._all_metadata(self.S_OPEN)
+ mayvote = self.q_get_mayvote.first_row(pid, iid)
+ vote_token = crypto.gen_vote_token(md.opened_key, pid, iid, mayvote.salt)
+ ciphertext = crypto.create_vote(vote_token, mayvote.salt, votestring)
+ self.c_add_vote.perform(vote_token, ciphertext)
+```
+
+This token is deliberately **reusable** — voters may update their vote (re-vote), and tallying uses `q_recent_vote` to fetch the latest. This is a voting system design choice, not an authentication token, and is **not in scope for ASVS 6.5.1**.
+
+---
+
+## Findings
+
+**No findings at MEDIUM severity or above were identified for ASVS 6.5.1.**
+
+### Rationale for No Findings
+
+1. **No MFA mechanisms exist in the audited code.** ASVS 6.5.1 is a conditional requirement — it applies when lookup secrets, TOTP, or OOB codes are present. None are implemented.
+
+2. **Authentication is fully delegated** to the `asfquart` framework (Apache Software Foundation's Quart-based auth), which is not included in the audit scope.
+
+3. **Vote tokens and cryptographic salts** used in the election system are not authentication tokens and are not subject to ASVS 6.5.1 single-use requirements.
+
+4. The `vote_token` reusability in `election.py` is intentional (allows vote updates) and is not an authentication mechanism.
+
+---
+
+## Positive Security Patterns
+
+| Pattern | Location | Description |
+|---------|----------|-------------|
+| Cryptographically secure random generation | `crypto.py:33-35` | Uses `secrets.token_bytes()` for all salt generation |
+| Consistent auth decorators on routes | `pages.py` (all state-changing routes) | Every sensitive endpoint uses `@asfquart.auth.require` |
+| Session-based identity propagation | `pages.py:59-82` | `basic_info()` consistently reads session for UID |
+| State machine enforcement | `election.py:52-68, 116-130` | Election state checks (`is_editable`, `is_open`, `is_closed`) enforced with assertions before sensitive operations |
+| Deterministic vote tokens | `crypto.py:47-51` | Vote tokens derived from `(opened_key, pid, iid, salt)` via Argon2 — prevents token guessing |
+| Cryptographic shuffle | `crypto.py:92-105` | Fisher-Yates shuffle with `secrets.randbelow()` for vote ordering during tallying |
+
+---
+
+## Architecture Observations
+
+### 1. MFA Delegation to External Framework
+
+Authentication, including any MFA, is handled entirely by `asfquart.auth`. The application has no visibility into or control over whether MFA is enforced. If `asfquart` does not implement MFA, or if its MFA tokens are replayable, the application would be non-compliant with ASVS 6.5.1 despite having no ability to remediate within its own codebase.
+
+**Recommendation:** Verify that the `asfquart` / ASF authentication infrastructure enforces MFA with single-use TOTP/OOB codes. This requires a separate audit of that component.
+
+### 2. Session Integrity
+
+The session read at `pages.py:68-82` trusts whatever `asfquart.session.read()` returns. If the underlying session framework doesn't bind sessions to MFA completion status, a session established without MFA could access all protected routes.
+
+### 3. No Step-Up Authentication for Sensitive Operations
+
+Critical operations like opening/closing elections (`/do-open/<eid>`, `/do-close/<eid>`) and vote submission (`/do-vote/<eid>`) use the same authentication level as viewing pages. There is no step-up authentication or re-authentication for elevated-risk actions.
+
+---
+
+## Recommendations Summary
+
+### Immediate Actions
+
+| Priority | Recommendation | Rationale |
+|----------|----------------|-----------|
+| 1 | **Audit the `asfquart` authentication framework** for MFA implementation and single-use token enforcement | ASVS 6.5.1 compliance cannot be determined without examining the auth provider |
+| 2 | **Verify MFA completion in session data** — ensure routes check that the session was established with completed MFA, not just valid credentials | Prevents session established via password-only from accessing protected routes |
+
+### Short-term Actions
+
+| Priority | Recommendation | Rationale |
+|----------|----------------|-----------|
+| 3 | **Consider step-up authentication** for election lifecycle operations (open, close, delete) | These are irreversible high-impact operations that warrant additional verification |
+
+### Long-term Actions
+
+| Priority | Recommendation | Rationale |
+|----------|----------------|-----------|
+| 4 | **Document the MFA trust boundary** — explicitly state that MFA enforcement is delegated to the ASF auth infrastructure and what guarantees are expected | Ensures the security assumption is visible and testable |
+
+---
+
+## Appendix: Files Analyzed
+
+<details>
+<summary>Click to expand file list (5 files)</summary>
+
+1. **`v3/steve/crypto.py`** (relevance: 7)
+ - Cryptographic operations, salt generation, vote token creation
+
+2. **`v3/steve/election.py`** (relevance: 6)
+ - Election management, vote handling, state machine logic
+
+3. **`v3/server/pages.py`** (relevance: 5)
+ - Route definitions, authentication decorators, session handling
+
+4. **`v3/steve/vtypes/stv.py`** (relevance: 4)
+ - Single Transferable Vote tallying logic
+
+5. **`v3/steve/vtypes/yna.py`** (relevance: 4)
+ - Yes/No/Abstain vote tallying logic
+
+</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