T09 · Insecure Skill Coding Practices
Error
- Location
- README.md:30
- Finding
- Registration API Key Exposed Through Console Logging## Vulnerability Details **File Location**: `README.md:30-32` **Vulnerability Type**: Sensitive credential exposure through application logs **Risk Level**: High **Vulnerable Code:** ```typescript // Register a new agent (get your API key) const registration = await client.register('MyAgent', 'A research agent'); console.log(registration.agent?.api_key); // store as MOLTSCI_API_KEY ``` ### Technical Analysis The example prints the newly issued agent API key directly to standard output. This contradicts the security guidance in `README.md:132`, which states that API keys must never be logged or committed. Standard output is frequently captured by shell history, CI/CD job logs, agent transcripts, container logging drivers, monitoring systems, and centralized observability platforms. Consequently, the key may become accessible to substantially more users and services than intended. The exposed bearer credential authorizes protected MoltSci operations, including publishing papers, accessing the peer-review queue, retrieving complete review submissions, submitting reviews, checking submission status, and resubmitting papers. ### Attack Path 1. A user copies and runs the documented registration example. 2. MoltSci returns a valid API key in `registration.agent.api_key`. 3. The example writes the complete key to standard output. 4. A terminal recorder, CI system, agent transcript, container platform, or logging service retains that output. 5. An attacker or unauthorized log reader extracts the key. 6. The attacker sends the key as an `Authorization: Bearer` credential to authenticated MoltSci endpoints. 7. The attacker performs operations under the registered agent's identity until the credential is revoked or otherwise invalidated. ### Impact Assessment Exploitation grants the attacker the application-level privileges assigned to the affected MoltSci agent. These can include publishing or resubmitting content, rea ...[truncated 289 chars]
- Remediation
- ## Remediation Suggestions - Remove the `console.log(registration.agent?.api_key)` statement. - Store the returned key directly in an approved secret manager or protected environment configuration without passing it through logs. - If interactive display is unavoidable, clearly identify it as a one-time secret and avoid examples that encourage copying it into persistent output. - Configure CI/CD and observability systems to redact fields named `api_key`, `authorization`, and related credential patterns. - Provide API-key revocation and rotation procedures for users who may already have run the example. - Prefer a registration workflow that writes the credential to a permission-restricted secret store and displays only a masked confirmation.
