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/21 22:56:49 UTC
(tooling-agents) branch main updated: ASVS L3 audit: 10.4.10 (authentication_and_session)
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 1db5bcf ASVS L3 audit: 10.4.10 (authentication_and_session)
1db5bcf is described below
commit 1db5bcffd2f3e8ae82406ee47a11153ff35e500e
Author: ASF Tooling Team <ro...@apache.org>
AuthorDate: Wed Apr 22 00:56:44 2026 +0200
ASVS L3 audit: 10.4.10 (authentication_and_session)
---
.../d0aa7e9/authentication_and_session/10.4.10.md | 422 +++++++++++++++++++++
1 file changed, 422 insertions(+)
diff --git a/repos/apache/ASVS/reports/steve/v3/d0aa7e9/authentication_and_session/10.4.10.md b/repos/apache/ASVS/reports/steve/v3/d0aa7e9/authentication_and_session/10.4.10.md
new file mode 100644
index 0000000..ccde8ac
--- /dev/null
+++ b/repos/apache/ASVS/reports/steve/v3/d0aa7e9/authentication_and_session/10.4.10.md
@@ -0,0 +1,422 @@
+# ASVS 10.4.10 Security Audit Report
+
+## Executive Summary
+
+- **Repository:** apache/steve
+- **Audit Date:** Apr 21, 2026
+- **Auditor:** Tooling Agents
+- **ASVS Requirement:** 10.4.10 — Verify that confidential client is authenticated for client-to-authorized server backchannel requests such as token requests, pushed authorization requests (PAR), and token revocation requests.
+- **Level:** 2
+- **Section:** OAuth Authorization Server
+- **Files analyzed:** 3 relevant out of 3 total, 0 skipped
+
+### Finding Summary
+
+| Severity | Count | IDs |
+|----------|-------|-----|
+| Critical | 0 | - |
+| High | 0 | - |
+| Medium | 1 | ASVS-10410-SEV-001 |
+| Low | 0 | - |
+| **Total** | **1** | |
+
+### Key Findings
+
+This application operates as an OAuth Client delegating authentication to `oauth.apache.org`. The audit reveals no visible client authentication mechanism for backchannel token exchange requests. The `asfquart` framework handles OAuth internals, but without access to its implementation, client authentication compliance cannot be verified. This represents a significant audit evidence gap for ASVS 10.4.10 compliance.
+
+---
+
+## Security Controls Inventory
+
+| Control | Location | Purpose | Defined? | Applied? | Verified? |
+|---------|----------|---------|----------|----------|-----------|
+| OAuth Authorization URL | `main.py:38-40` | Initiates OAuth flow with state parameter | ✅ | ✅ | ⚠️ Template only |
+| OAuth Token Exchange URL | `main.py:41` | Exchanges authorization code for access token | ✅ | ✅ | ❌ No client auth visible |
+| Client Secret / Credentials Config | Not found | Authenticates client to authorization server | ❌ | ❌ | ❌ |
+| Client Certificate (mTLS) Config | Not found | Mutual TLS client authentication (RFC 8705) | ❌ | ❌ | ❌ |
+| Private Key JWT Config | Not found | JWT-based client authentication | ❌ | ❌ | ❌ |
+| `asfquart` Framework Auth Internals | External dependency | Handles actual token exchange requests | N/A | ❓ | ❌ Cannot verify |
+| HTTPS Transport Security | `main.py:38-41` | Protects OAuth communications in transit | ✅ | ✅ | ✅ |
+| OAuth State Parameter | `main.py:38-40` | CSRF protection for authorization flow | ✅ | ✅ | ✅ |
+
+**Coverage Assessment:** 3/8 controls verified, 2/8 present but unverified, 3/8 not found
+
+---
+
+## Critical File Review
+
+### `v3/server/main.py` — OAuth Configuration and Application Bootstrap
+
+| Line | Function/Code | Security Relevance | Reviewed | Status |
+|------|---------------|-------------------|----------|---------|
+| 37 | `import asfquart.generics` | OAuth configuration module import | ✅ | Info |
+| 38-40 | `OAUTH_URL_INIT = 'https://oauth.apache.org/auth?state=%s&redirect_uri=%s'` | Authorization endpoint with state parameter | ✅ | ✅ State present |
+| 41 | `OAUTH_URL_CALLBACK = 'https://oauth.apache.org/token?code=%s'` | Token endpoint configuration | ✅ | ⚠️ No client auth visible |
+| 43 | `asfquart.construct('steve', app_dir=THIS_DIR, ...)` | Application initialization, may load OAuth config | ✅ | ❓ Cannot verify internals |
+| 50-52 | `app.cfg.server.certfile`, `app.cfg.server.keyfile` | Server TLS configuration | ✅ | ✅ Server-side only |
+
+### `v3/server/pages.py` — OAuth Session Consumption
+
+| Line | Function | Security Relevance | Reviewed | Status |
+|------|----------|-------------------|----------|---------|
+| 83 | `s = await asfquart.session.read()` | Reads OAuth-derived session data | ✅ | ⚠️ Depends on token security |
+| 148 | `@asfquart.auth.require({R.committer})` | Authorization check using OAuth session | ✅ | ⚠️ Depends on session integrity |
+| 156 | `@asfquart.auth.require({R.committer})` | Authorization check for state changes | ✅ | ⚠️ Depends on session integrity |
+| 165 | `@asfquart.auth.require({R.committer})` | Authorization check for voting actions | ✅ | ⚠️ Depends on session integrity |
+
+### `v3/server/bin/asf-load-ldap.py` — LDAP Integration
+
+| Line | Function/Code | Security Relevance | Reviewed | Status |
+|------|---------------|-------------------|----------|---------|
+| 30 | `ldap.initialize('ldaps://ldap-us.apache.org/')` | LDAP connection with TLS | ✅ | ✅ LDAPS used |
+| 31 | `ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_NEVER)` | Disables certificate verification | ✅ | ⚠️ Security concern (separate from ASVS 10.4.10) |
+
+---
+
+## Findings
+
+### Medium Severity
+
+#### ASVS-10410-MED-001: No Visible Client Authentication for OAuth Token Exchange
+**Severity:** MEDIUM
+**Gap Type:** Type A — No visible client authentication control for OAuth backchannel requests
+**CWE:** CWE-306 (Missing Authentication for Critical Function)
+
+**Location:**
+- **File:** `v3/server/main.py`
+- **Function:** `create_app()`
+- **Lines:** 38-41
+
+**Related Functions Checked:**
+- `asfquart.generics.OAUTH_URL_INIT` configuration (line 38-40)
+- `asfquart.generics.OAUTH_URL_CALLBACK` configuration (line 41)
+- `asfquart.construct()` initialization (line 43)
+- Framework internals (not accessible for audit)
+
+**Description:**
+
+This server-side web application (Quart/Python) is inherently capable of maintaining credential confidentiality and should operate as a confidential OAuth client per RFC 6749 §2.1. ASVS 10.4.10 requires that confidential clients authenticate themselves to the authorization server during backchannel requests such as token exchange.
+
+The audit reveals no visible client authentication mechanism in the codebase. The only OAuth configuration present consists of two URL templates pointing to `oauth.apache.org`. Critical authentication elements are missing:
+
+1. **No `client_secret` configuration** — No client credentials visible in the code or configuration
+2. **No client certificate for mTLS** — While server TLS certificates are configured, no mutual TLS client authentication is set up
+3. **No `private_key_jwt` configuration** — No JWT assertion signing keys configured
+4. **Framework opacity** — The `asfquart` package handles the actual HTTP request to the token endpoint, but its internals cannot be verified without source code access
+
+Additionally, the token URL format uses query parameters (`token?code=%s`) rather than the RFC 6749 §4.1.3 recommended POST body approach, potentially exposing authorization codes in server logs.
+
+**Vulnerable Code:**
+```python
+# v3/server/main.py, lines 38-41
+asfquart.generics.OAUTH_URL_INIT = (
+ 'https://oauth.apache.org/auth?state=%s&redirect_uri=%s'
+)
+asfquart.generics.OAUTH_URL_CALLBACK = 'https://oauth.apache.org/token?code=%s'
+```
+
+**Data Flow:**
+```
+1. User completes authentication at oauth.apache.org
+ ↓
+2. Browser redirected back with authorization code
+ ↓
+3. asfquart framework calls OAUTH_URL_CALLBACK with code
+ ↓
+4. Token request sent to https://oauth.apache.org/token?code=<code>
+ ↓
+5. ⚠️ MISSING: No client_id, client_secret, client assertion, or mTLS configured
+ ↓
+6. Authorization server receives potentially unauthenticated token request
+ ↓
+7. Access token returned and used for session establishment
+```
+
+**Proof of Concept:**
+
+If no client authentication is enforced, an attacker who obtains a valid authorization code (e.g., from server logs, referrer headers, or network interception) can exchange it for tokens without proving client identity:
+
+```bash
+# Attacker with stolen authorization code
+curl 'https://oauth.apache.org/token?code=STOLEN_AUTH_CODE'
+
+# If no client authentication is required, this returns a valid access token
+# The authorization server cannot distinguish this request from a legitimate one
+```
+
+**Impact:**
+
+Operating as an unauthenticated public client introduces several security risks:
+
+- **Authorization code injection attacks** — Attackers who obtain valid authorization codes can exchange them for access tokens without proving client identity
+- **No client identity verification** — The authorization server cannot distinguish legitimate token requests from this application versus requests from attackers replaying stolen codes
+- **Token revocation vulnerability** — If token revocation is implemented, those requests would also lack authentication
+- **Refresh token exposure** — Any refresh token operations would be similarly unauthenticated
+
+**ASVS 10.4.10 Compliance Status:** ❌ Cannot verify compliance
+
+**Remediation:**
+
+**Immediate Actions:**
+
+1. **Verify current configuration** — Obtain and review the `asfquart` framework source code and any external configuration files (e.g., `APP.cfg`) to determine if client authentication is already configured but not visible in the audited files.
+
+2. **Confirm client registration** — Verify with Apache Infrastructure that the STeVe application is registered as a confidential client at `oauth.apache.org` and determine the configured authentication method.
+
+**Implementation Options (choose one based on AS capabilities):**
+
+**Option 1: Client Secret (Minimum Acceptable)**
+```python
+# main.py — Add explicit client authentication configuration
+asfquart.generics.OAUTH_CLIENT_ID = 'steve-voting-app'
+asfquart.generics.OAUTH_CLIENT_SECRET = os.environ['OAUTH_CLIENT_SECRET']
+asfquart.generics.OAUTH_CLIENT_AUTH_METHOD = 'client_secret_post'
+
+# Ensure secret is stored securely, not in source code
+# Use environment variables or secure configuration management
+```
+
+**Option 2: Private Key JWT (Recommended per ASVS)**
+```python
+# main.py — JWT-based client authentication
+asfquart.generics.OAUTH_CLIENT_ID = 'steve-voting-app'
+asfquart.generics.OAUTH_CLIENT_AUTH_METHOD = 'private_key_jwt'
+asfquart.generics.OAUTH_SIGNING_KEY_PATH = '/etc/steve/oauth-signing-key.pem'
+asfquart.generics.OAUTH_SIGNING_ALG = 'RS256'
+
+# Generate and securely store private key
+# Register corresponding public key with oauth.apache.org
+```
+
+**Option 3: Mutual TLS (RFC 8705)**
+```python
+# main.py — mTLS client authentication
+asfquart.generics.OAUTH_CLIENT_ID = 'steve-voting-app'
+asfquart.generics.OAUTH_CLIENT_AUTH_METHOD = 'tls_client_auth'
+asfquart.generics.OAUTH_CLIENT_CERT_PATH = '/etc/steve/client-cert.pem'
+asfquart.generics.OAUTH_CLIENT_KEY_PATH = '/etc/steve/client-key.pem'
+
+# Ensure client certificate is registered with oauth.apache.org
+# Certificate must meet RFC 8705 section 2.1 requirements
+```
+
+**Token Exchange Protocol Fix:**
+
+Ensure the authorization code is transmitted via POST body parameters rather than query parameters:
+
+```python
+# Instead of:
+asfquart.generics.OAUTH_URL_CALLBACK = 'https://oauth.apache.org/token?code=%s'
+
+# Use POST with form-encoded body (ensure framework supports this):
+asfquart.generics.OAUTH_TOKEN_ENDPOINT = 'https://oauth.apache.org/token'
+asfquart.generics.OAUTH_TOKEN_METHOD = 'POST'
+# Framework should handle: grant_type=authorization_code&code=<code>&redirect_uri=<uri>&client_id=<id>
+```
+
+**Verification Steps:**
+
+1. Enable debug logging for OAuth token exchange requests
+2. Confirm client authentication parameters are included in token requests
+3. Test that token exchange fails when client credentials are invalid
+4. Document the authentication method in security configuration documentation
+
+---
+
+## Positive Security Patterns
+
+### 1. HTTPS for All OAuth Communications
+**Location:** `main.py:38-41`
+
+Both `OAUTH_URL_INIT` and `OAUTH_URL_CALLBACK` use the `https://` scheme, ensuring that OAuth authorization codes, tokens, and client credentials (if present) are protected in transit via TLS encryption.
+
+```python
+asfquart.generics.OAUTH_URL_INIT = 'https://oauth.apache.org/auth?...'
+asfquart.generics.OAUTH_URL_CALLBACK = 'https://oauth.apache.org/token?...'
+```
+
+### 2. OAuth State Parameter Implementation
+**Location:** `main.py:38-40`
+
+The authorization URL template includes a `state=%s` parameter, which is critical for CSRF protection in the OAuth authorization flow. This prevents attackers from injecting authorization codes obtained from other sessions.
+
+```python
+'https://oauth.apache.org/auth?state=%s&redirect_uri=%s'
+```
+
+### 3. Consistent Authentication Enforcement
+**Location:** `pages.py:148, 156, 165, 183`
+
+All state-changing endpoints use `@asfquart.auth.require` decorators with appropriate role requirements, ensuring that OAuth-derived sessions are validated before processing sensitive operations:
+
+```python
+@asfquart.auth.require({R.committer})
+async def create_issue():
+ # Only authenticated committers can create issues
+```
+
+### 4. LDAP Over TLS
+**Location:** `bin/asf-load-ldap.py:30`
+
+The LDAP integration uses `ldaps://` protocol, encrypting LDAP authentication traffic:
+
+```python
+ldap.initialize('ldaps://ldap-us.apache.org/')
+```
+
+### 5. Server TLS Configuration
+**Location:** `main.py:50-52`
+
+The application supports TLS for its own server endpoints with configurable certificate and key files, protecting the application's web interface and API:
+
+```python
+certfile=app.cfg.server.certfile,
+keyfile=app.cfg.server.keyfile,
+```
+
+---
+
+## Architecture Observations
+
+### 1. Application Role Clarification
+
+This application operates as an **OAuth Client/Relying Party**, NOT as an OAuth Authorization Server. The authorization server is `oauth.apache.org`, which is operated by Apache Infrastructure.
+
+**Implication for ASVS 10.4.10:** This requirement is categorized under "OAuth Authorization Server" responsibilities. Since STeVe is a client, full compliance verification requires:
+- Auditing the client's authentication behavior (covered in this report)
+- Verifying that `oauth.apache.org` enforces client authentication (outside audit scope)
+
+### 2. Framework Abstraction Layer
+
+The `asfquart` framework provides a high-level abstraction over OAuth protocol details. While this simplifies application development, it creates an audit evidence gap:
+
+```python
+# All OAuth logic is delegated to the framework
+asfquart.construct('steve', app_dir=THIS_DIR, ...)
+s = await asfquart.session.read()
+```
+
+**Audit Impact:** Without access to `asfquart` source code, the audit cannot definitively confirm or deny the presence of client authentication mechanisms. The framework may:
+- Implement client authentication internally using configuration from `APP.cfg`
+- Rely on external configuration not visible in the audited codebase
+- Lack client authentication entirely
+
+### 3. Configuration Separation
+
+Application configuration is loaded via `asfquart.construct('steve', app_dir=THIS_DIR)` and accessed through `APP.cfg` object. Client credentials may exist in this configuration but are not visible in the source files provided for audit:
+
+```python
+app.cfg.server.certfile # Accessible configuration
+app.cfg.oauth.client_secret # Potentially exists but not confirmed
+```
+
+### 4. Plain OAuth 2.0 (Not OIDC)
+
+The code includes an explicit comment avoiding OIDC:
+
+```python
+# Line 36: "Avoid OIDC"
+```
+
+**Security Implications:**
+- No ID tokens with standardized user identity verification
+- No `nonce` parameter for replay protection
+- Increased reliance on the security of the token exchange process
+- User identity derived from access token introspection or userinfo endpoint
+
+This architectural choice makes proper client authentication for token exchange even more critical, as there are fewer protocol-level protections against token substitution attacks.
+
+### 5. Session Security Dependency Chain
+
+The application's authorization enforcement depends on OAuth session integrity:
+
+```
+OAuth Token Exchange (potentially unauthenticated)
+ ↓
+Session Establishment (asfquart.session)
+ ↓
+Authorization Checks (@asfquart.auth.require)
+ ↓
+Access to Sensitive Operations
+```
+
+If the token exchange lacks client authentication, the entire security chain is weakened at its foundation.
+
+### 6. External Authorization Server Trust
+
+The application places complete trust in `oauth.apache.org` for:
+- User authentication
+- Authorization decisions
+- Token issuance and validation
+- Session lifecycle management
+
+This is appropriate for an internal Apache project, but it means ASVS 10.4.10 compliance depends on both:
+- The client properly authenticating itself (this audit's focus)
+- The AS properly enforcing client authentication (assumed but not verified)
+
+---
+
+## Recommendations Summary
+
+### Immediate Actions (Within 1 Week)
+
+| Priority | Recommendation | Effort | Impact |
+|----------|----------------|--------|--------|
+| **P0** | **Provide `asfquart` framework source for audit** — The OAuth token exchange logic is completely opaque; client authentication compliance cannot be verified without access to framework internals or configuration files | Low | Enables compliance verification |
+| **P0** | **Confirm confidential client registration** — Verify with Apache Infrastructure that the STeVe application is registered as a confidential client at `oauth.apache.org` and document the authentication method in use | Low | Clarifies current security posture |
+| **P1** | **Review external configuration files** — Examine `APP.cfg` or equivalent configuration files that may contain OAuth client credentials not visible in source code | Low | May resolve audit evidence gap |
+
+### Short-Term Actions (Within 1 Month)
+
+| Priority | Recommendation | Effort | Impact |
+|----------|----------------|--------|--------|
+| **P1** | **Configure explicit client authentication** — If not already handled by the framework, add visible `client_secret`, `private_key_jwt`, or mTLS configuration to the application code for auditability | Medium | Ensures ASVS 10.4.10 compliance |
+| **P2** | **Migrate token exchange to POST body** — Ensure the authorization code is transmitted in the POST request body rather than as a URL query parameter, per RFC 6749 §4.1.3 | Medium | Prevents code leakage in logs |
+| **P2** | **Implement client authentication monitoring** — Add logging and alerting for OAuth token exchange failures to detect authentication issues or attacks | Medium | Improves security observability |
+
+### Long-Term Actions (Within 3 Months)
+
+| Priority | Recommendation | Effort | Impact |
+|----------|----------------|--------|--------|
+| **P3** | **Document OAuth security configuration** — Create comprehensive documentation of the OAuth client authentication method, configuration location, and key management procedures | Low | Enables future audits and maintenance |
+| **P3** | **Implement automated security testing** — Add integration tests that verify client authentication is enforced for token exchange requests | Medium | Prevents regression |
+| **P4** | **Consider OIDC migration** — Evaluate migrating from plain OAuth 2.0 to OpenID Connect for standardized user identity verification and additional security features (ID token validation, nonce protection) | High | Enhanced security posture |
+
+---
+
+## Appendix: Files Analyzed
+
+<details>
+<summary><strong>Click to expand file list (3 files)</strong></summary>
+
+### Files Reviewed for ASVS 10.4.10 Compliance
+
+1. **`v3/server/bin/asf-load-ldap.py`** (Relevance: 10/10)
+ - **Purpose:** LDAP integration for user data synchronization
+ - **Lines Analyzed:** 30-35 (LDAP connection and authentication)
+ - **Security Elements:** LDAPS usage, certificate validation settings
+ - **Findings:** No OAuth-related code; LDAP security separate from ASVS 10.4.10 scope
+
+2. **`v3/server/main.py`** (Relevance: 10/10)
+ - **Purpose:** Application bootstrap and OAuth configuration
+ - **Lines Analyzed:** 36-52 (OAuth URL configuration, app initialization, server setup)
+ - **Security Elements:** OAuth endpoint URLs, framework initialization, TLS configuration
+ - **Findings:** Primary source of ASVS-10410-MED-001; no visible client authentication
+
+3. **`v3/server/pages.py`** (Relevance: 10/10)
+ - **Purpose:** HTTP request handlers and authorization enforcement
+ - **Lines Analyzed:** 83, 148, 156, 165, 183 (session reads, auth decorators)
+ - **Security Elements:** OAuth session consumption, authorization checks
+ - **Findings:** Proper use of authentication decorators; security depends on upstream token exchange
+
+### Files Not Analyzed (Audit Scope Limitation)
+
+- **`APP.cfg`** or equivalent configuration files — May contain OAuth client credentials
+- **`asfquart` framework source code** — Contains actual OAuth token exchange implementation
+- **Apache Infrastructure `oauth.apache.org` configuration** — Authorization server settings
+
+</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