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/02 14:57:44 UTC
(tooling-agents) branch main updated: ASVS audit: 14.2.1.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 f1b060e ASVS audit: 14.2.1.md (redacted)
f1b060e is described below
commit f1b060e2c94c38191ba4032d1a5488d4869908bb
Author: ASF Tooling Team <ro...@apache.org>
AuthorDate: Sat May 2 16:55:53 2026 +0200
ASVS audit: 14.2.1.md (redacted)
---
.../245aad3/data_protection_caching/14.2.1.md | 374 +++++++++++++++++++++
1 file changed, 374 insertions(+)
diff --git a/ASVS/reports/mahout/245aad3/data_protection_caching/14.2.1.md b/ASVS/reports/mahout/245aad3/data_protection_caching/14.2.1.md
new file mode 100644
index 0000000..091ba31
--- /dev/null
+++ b/ASVS/reports/mahout/245aad3/data_protection_caching/14.2.1.md
@@ -0,0 +1,374 @@
+# ASVS 14.2.1 Security Audit Report
+
+## Executive Summary
+
+**Repository:** apache/mahout
+**Audit Date:** May 02, 2026
+**Auditor:** Tooling Agents
+**ASVS Requirement:** 14.2.1 — Verify that sensitive data is only sent to the server in the HTTP message body or header fields, and that the URL and query string do not contain sensitive information, such as an API key or session token.
+**Level:** 1
+**Section:** General Data Protection
+
+**Files Analyzed:** 3 relevant out of 3 total, 0 skipped
+
+**Finding Counts:**
+
+| Severity | Count |
+|----------|-------|
+| Critical | 0 |
+| High | 0 |
+| Medium | 0 |
+| Low | 2 |
+| **Total** | **2** |
+
+**Summary:** ASVS 14.2.1 requires that sensitive data is only sent via HTTP message body or header fields, never in URLs or query strings. The three files under audit are **core library components** (GPU memory management, file I/O, and quantum circuit interface) that **do not directly implement HTTP transport**. No direct violations of URL-based sensitive data leakage were identified. However, architectural patterns in `qumat.py` present risks if the library is wrapped in a web service [...]
+
+---
+
+## Security Controls Inventory
+
+| Control | Defined? | Location | Applied At All Entry Points? | Coverage |
+|---------|----------|----------|------------------------------|----------|
+| HTTP transport layer | ❌ Not present | N/A | N/A | Not applicable — library code |
+| URL construction controls | ❌ Not present | N/A | N/A | Not applicable — no HTTP |
+| Credential isolation from config | ❌ Not present | `qumat.py` | N/A | No separation of credentials from general config |
+| Data minimization in backend calls | ❌ Not present | `qumat.py` | N/A | Full config dict passed to backends |
+| Input validation | ✅ Present | `qumat.py:85-100` | All gate operations | Good coverage |
+| Path handling (non-URL) | ✅ Present | `io.rs` | All file operations | Standard library `AsRef<Path>` |
+
+---
+
+## Critical File Review
+
+### File: `qdp/qdp-core/src/gpu/memory.rs`
+
+**Relevance to ASVS 14.2.1:** None
+
+| Aspect | Assessment |
+|--------|------------|
+| HTTP endpoints | None |
+| URL construction | None |
+| Sensitive data in strings | Error messages contain memory sizes and CUDA error codes only — no credentials or tokens |
+| Network communication | None |
+
+### File: `qdp/qdp-core/src/io.rs`
+
+**Relevance to ASVS 14.2.1:** None (direct), Low (indirect)
+
+| Aspect | Assessment |
+|--------|------------|
+| HTTP endpoints | None |
+| URL construction | None — uses `std::path::Path` for local filesystem |
+| Sensitive data in file paths | File paths are user-controlled local paths, not URLs |
+| Network communication | None in provided code (S3/GCS paths delegated to other modules) |
+
+### File: `qumat/qumat.py`
+
+**Relevance to ASVS 14.2.1:** Medium (architectural risk)
+
+| Function | Line | Sensitive Data Flow | Risk |
+|----------|------|---------------------|------|
+| `__init__` | 45-60 | `backend_config` stored containing potential AWS credentials | Config dict retained with no credential isolation |
+| `execute_circuit` | 224-258 | `self.backend_config["parameter_values"] = bound_parameters` | Full config + parameters passed to backend module |
+| `get_final_state_vector` | 277-312 | `self.backend_config["parameter_values"] = bound_parameters` | Full config + parameters passed to backend module |
+| `initialize_backend` | 58 | `self.backend_module.initialize_backend(self.backend_config)` | Entire config dict passed to backend initialization |
+
+**Configuration Dictionary as Credential Transport:**
+
+The `backend_config` dictionary serves as both general configuration and potential credential transport:
+
+```python
+# Line 58: Full config passed to backend initialization
+self.backend = self.backend_module.initialize_backend(self.backend_config)
+
+# Line 255-257: Full config (now with parameter_values) passed to execution
+self.backend_config["parameter_values"] = bound_parameters
+return self.backend_module.execute_circuit(
+ self.circuit, self.backend, self.backend_config
+)
+```
+
+**What could `backend_config` contain for Amazon Braket?**
+```python
+{
+ "backend_name": "amazon_braket",
+ "backend_options": {
+ "simulator_type": "...",
+ "shots": 1000,
+ "s3_bucket": "my-bucket", # Could be sensitive
+ "device_arn": "arn:aws:...", # Potentially sensitive
+ # AWS region, endpoint URLs, etc.
+ }
+}
+```
+
+**Why this matters for 14.2.1:** If any downstream backend module constructs HTTP requests using values from `backend_config` and places them in URL query parameters (e.g., `?device_arn=...&s3_bucket=...`), this would violate ASVS 14.2.1. The `QuMat` class provides no controls or documentation to prevent this pattern.
+
+---
+
+## Findings
+
+### LOW SEVERITY
+
+#### ASVS-1421-SEV-001: No Data Minimization in Backend Configuration Passing
+
+**Severity:** LOW
+**Gap Type:** Type A (Entry point with no control)
+
+**Location:**
+- **File:** `qumat/qumat.py`
+- **Functions:** `__init__` (line 58), `execute_circuit` (line 255), `get_final_state_vector` (line 308)
+
+**Related Functions Checked:**
+- `initialize_backend()` (line 58)
+- `execute_circuit()` (line 224-258)
+- `get_final_state_vector()` (line 277-312)
+
+**Description:**
+
+The entire `backend_config` dictionary, including any credentials or sensitive identifiers, is passed to backend modules without data minimization. If a backend module (current or future) constructs HTTP URLs from arbitrary config fields, sensitive data could leak into URLs, violating ASVS 14.2.1.
+
+**Vulnerable Code:**
+
+```python
+# Line 58 - Full config dict passed to backend
+self.backend = self.backend_module.initialize_backend(self.backend_config)
+
+# Line 253-257 - Config mutated with runtime data, then passed wholesale
+self.backend_config["parameter_values"] = bound_parameters
+return self.backend_module.execute_circuit(
+ self.circuit, self.backend, self.backend_config
+)
+```
+
+**Data Flow:**
+
+```
+User-provided backend_config (may contain credentials, API keys, S3 paths)
+ → Stored as self.backend_config (mutable dict)
+ → Mutated: parameter_values added at runtime
+ → Passed wholesale to backend_module.execute_circuit()
+ → Backend module constructs HTTP requests to cloud services
+ → No control ensures credentials stay in headers, not URLs
+```
+
+**Proof of Concept:**
+
+```python
+# A custom or misconfigured backend could extract credentials from config
+# and place them in URL parameters:
+config = {
+ "backend_name": "custom_cloud",
+ "backend_options": {
+ "api_key": "sk-secret-key-12345", # Sensitive
+ "endpoint": "https://quantum-api.example.com",
+ "shots": 1000
+ }
+}
+qm = QuMat(config)
+# config["api_key"] passed to backend, which might do:
+# requests.get(f"{endpoint}/run?api_key={api_key}&shots={shots}")
+```
+
+**Impact:**
+
+This is mitigated by the current use of official SDKs that handle HTTP transport correctly, but creates a fragile dependency on third-party SDK behavior. If a backend module (current or future) constructs HTTP URLs from arbitrary config fields, sensitive data could leak into URLs, violating ASVS 14.2.1.
+
+**Remediation:**
+
+```python
+def execute_circuit(self, parameter_values=None):
+ self._ensure_circuit_initialized()
+ # ... parameter binding logic ...
+
+ # Data minimization: only pass execution-relevant fields
+ execution_config = {
+ "backend_options": {
+ k: v for k, v in self.backend_config.get("backend_options", {}).items()
+ if k in ("simulator_type", "shots") # Allowlist non-sensitive fields
+ },
+ "parameter_values": bound_parameters,
+ }
+
+ return self.backend_module.execute_circuit(
+ self.circuit, self.backend, execution_config
+ )
+```
+
+---
+
+#### ASVS-1421-SEV-002: Backend Configuration Mutation Enables Data Accumulation
+
+**Severity:** LOW
+**Gap Type:** Type A (Entry point with no control)
+
+**Location:**
+- **File:** `qumat/qumat.py`
+- **Functions:** `execute_circuit` (line 253), `get_final_state_vector` (line 306)
+
+**Related Functions Checked:**
+- `execute_circuit()` (line 224-258)
+- `get_final_state_vector()` (line 277-312)
+
+**Description:**
+
+The `backend_config` dictionary is mutated during execution to add `parameter_values`. Over multiple circuit executions, this object accumulates execution data alongside any credentials. If this object is serialized, logged, cached, or transmitted (e.g., through telemetry as noted in the domain context: "Sensitive data could be sent to external trackers if quantum backends have telemetry enabled"), both credentials and quantum algorithm parameters (which may be IP-sensitive) would be exp [...]
+
+**Vulnerable Code:**
+
+```python
+# Line 253 - execute_circuit
+self.backend_config["parameter_values"] = bound_parameters
+
+# Line 306 - get_final_state_vector
+self.backend_config["parameter_values"] = bound_parameters
+```
+
+**Data Flow:**
+
+```
+Initial backend_config (credentials + options)
+ → execute_circuit() adds parameter_values (quantum IP)
+ → Entire dict now contains credentials + quantum IP
+ → If backend has telemetry → both leak to external trackers
+ → If serialized to URL for cloud API → violates 14.2.1
+```
+
+**Impact:**
+
+If the `backend_config` object is serialized, logged, cached, or transmitted, both credentials and quantum algorithm parameters (which may be IP-sensitive) would be exposed together. This increases the blast radius of any data exposure incident.
+
+**Proof of Concept:**
+
+```python
+qm = QuMat({"backend_name": "braket", "backend_options": {"api_key": "secret"}})
+qm.execute_circuit([0.5, 1.0]) # Adds parameter_values to backend_config
+# Now backend_config contains both api_key and parameter_values
+# If logged or sent to telemetry: both leak
+```
+
+**Remediation:**
+
+```python
+def execute_circuit(self, parameter_values=None):
+ # ... validation ...
+
+ # Create execution-scoped config copy instead of mutating instance config
+ exec_config = dict(self.backend_config)
+ exec_config["parameter_values"] = bound_parameters
+
+ return self.backend_module.execute_circuit(
+ self.circuit, self.backend, exec_config
+ )
+```
+
+---
+
+## Positive Security Patterns
+
+| Pattern | Location | Description |
+|---------|----------|-------------|
+| Error messages exclude sensitive data | `memory.rs:68-90` | OOM messages contain only memory metrics (MiB, qubit counts), never configuration or credentials |
+| Type-safe filesystem paths | `io.rs` (all read/write functions) | Uses `AsRef<Path>` generics — prevents URL/path conflation |
+| Backend module namespace restriction | `qumat.py:56` | `import_module(f".{backend_name}_backend", package="qumat")` — limited to `qumat` package, preventing arbitrary module loading |
+| Input validation before operations | `qumat.py:85-100` | `_validate_qubit_index` checks type, range, and bounds before any gate application |
+| Configuration structure validation | `qumat.py:45-55` | Validates `backend_config` is dict, checks required keys `backend_name` and `backend_options` |
+| RAII memory management | `memory.rs:436-448` | `PinnedHostBuffer::Drop` ensures cleanup; error in drop logged to stderr without exposing sensitive state |
+| Overflow-safe allocation | `memory.rs:209-215` | Uses `checked_mul()` to prevent integer overflow before memory allocation |
+
+**Detailed Examples:**
+
+**Error messages exclude sensitive data (`memory.rs:68-90`):**
+```rust
+// OOM messages contain only memory metrics, never configuration or credentials
+fn build_oom_message() {
+ format!("Failed to allocate {} MiB for {} qubits", size_mib, num_qubits)
+}
+```
+
+**Type-safe filesystem paths (`io.rs`):**
+```rust
+// Uses AsRef<Path> generics — prevents URL/path conflation
+pub fn read_parquet<P: AsRef<Path>>(path: P) -> Result<DataFrame> {
+ // Standard library ensures this is a filesystem path, not a URL
+}
+```
+
+---
+
+## Architecture Observations
+
+### 1. No HTTP Layer in Provided Code
+
+The provided files are library internals (GPU memory, file I/O, circuit interface). HTTP transport is delegated to third-party quantum backend SDKs (Qiskit, Cirq, Braket). ASVS 14.2.1 compliance depends on those SDKs, which are outside the audit scope but are official SDKs that follow proper HTTP practices.
+
+### 2. Configuration as Credential Transport
+
+The `backend_config` dictionary serves double duty as both configuration and implicit credential transport. There is no type-safe separation between:
+- Operational parameters (shots, simulator_type)
+- Credentials (API keys, AWS config)
+- Runtime data (parameter_values)
+
+This makes it difficult to enforce that credentials never appear in URLs if a web wrapper is added.
+
+### 3. Web Service Wrapping Risk
+
+The domain context notes this could be "wrapped in web service." If a REST API is built on top of `QuMat`:
+- Circuit parameters could be passed as URL query parameters (e.g., `/execute?shots=1000&angle=1.57`)
+- Backend names could be in URL paths (e.g., `/backend/amazon_braket/execute`)
+- State vectors could be returned with full precision rather than minimum necessary data
+
+### 4. Full State Vector Exposure
+
+The domain context notes: "The system returns full quantum state vectors rather than minimum required data." While not a URL-specific issue, `get_final_state_vector()` returns the complete quantum state, which could contain IP-sensitive research data. If exposed via a web API, this data should only travel in response bodies, never cached in URLs.
+
+---
+
+## Recommendations Summary
+
+### Immediate Actions (Critical/High Priority)
+
+No immediate actions required — no Critical or High severity findings identified.
+
+### Short-term Recommendations (Medium Priority)
+
+| Priority | Recommendation | Rationale |
+|----------|----------------|-----------|
+| 1 | **Separate credentials from operational config** in `QuMat.__init__`: Create a typed configuration class that isolates credentials (sourced from env vars per AWS best practices) from operational parameters (shots, simulator_type). | Prevents credential leakage if config is serialized, logged, or passed to URL-constructing code |
+| 2 | **Stop mutating `self.backend_config`** in `execute_circuit()` and `get_final_state_vector()`: Create execution-scoped copies instead. | Prevents data accumulation and reduces blast radius if config object is exposed |
+| 3 | **Document ASVS 14.2.1 requirements for web wrappers**: If the library is wrapped in an HTTP service, provide guidance that credentials and quantum state data must only be transmitted in HTTP bodies/headers, never in URLs. | The library is likely to be wrapped in a web API; proactive documentation prevents violations |
+
+### Long-term Recommendations (Low Priority)
+
+| Priority | Recommendation | Rationale |
+|----------|----------------|-----------|
+| 4 | **Add anti-caching headers guidance**: If quantum state vectors or measurement results are served over HTTP, ensure `Cache-Control: no-store` and `Pragma: no-cache` headers are documented for web service implementors. | Domain context notes: "No anti-caching headers are set" |
+| 5 | **Implement data minimization for state vectors**: Add an option to `get_final_state_vector()` that returns only measurement probabilities or specific qubit states rather than the full state vector. | Reduces the amount of sensitive IP data that could be exposed through any channel |
+
+---
+
+## Appendix: Files Analyzed
+
+<details>
+<summary>Click to expand file list (3 files)</summary>
+
+1. **`qdp/qdp-core/src/gpu/memory.rs`** (relevance: 10)
+ - GPU memory allocation and deallocation via CUDA FFI
+ - No HTTP communication or URL construction
+ - Error messages contain only operational data
+
+2. **`qdp/qdp-core/src/io.rs`** (relevance: 10)
+ - File I/O for scientific data formats
+ - Uses `std::path::Path` for local filesystem paths
+ - No URL construction or network communication
+
+3. **`qumat/qumat.py`** (relevance: 10)
+ - Quantum circuit interface and backend configuration
+ - Constructs backend configurations passed to cloud quantum backends
+ - Primary source of architectural risk for ASVS 14.2.1
+
+</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