T09 · Insecure Skill Coding Practices
- Location
nvidia_llm/core.py:55- Finding
Hardcoded NVIDIA API Credential Exposed in Package Source
- Content
View full analysis
dict: return {"Authorization": f"Bearer {self.api_key}", "Content-Type": "application/json"} ``` ### Technical Analysis The package contains a live-format NVIDIA API key as the default value when the `NVIDIA_API_KEY` environment variable is absent. Because Python package source is available to every recipient, this value cannot be treated as a secret. The fallback behavior also means normal users may unknowingly issue requests under the embedded credential rather than a credential they control. The key is placed in a bearer authorization header and used for requests to the NVIDIA API. Embedding a shared credential violates secret-management principles and prevents reliable attribution, rotation, per-user revocation, and quota isolation. ### Attack Path 1. An attacker downloads or installs the package. 2. The attacker opens `nvidia_llm/core.py` or searches the package for strings beginning with `nvapi-`. 3. The attacker extracts the embedded credential. 4. The attacker sends requests directly to the NVIDIA API with: ```http Authorization: Bearer ``` 5. Requests consume the credential owner's quota and may incur costs until the key is revoked. ### Impact Assessment An attacker can obtain the same NVIDIA API authorization represented by the embedded key. Depending on the key's server-side permissions, this may allow: - Unauthorized model inference requests. - Consumption of API quotas or paid resources. - Service disruption through quota exhaustion. - Loss of request attrib ...[truncated 246 chars]- Remediation
View remediation
