T09 · Insecure Skill Coding Practices
- Location
index.py:9- Finding
Hard-Coded NVIDIA API Credential
- Content
View full analysis
Vulnerability Details
File Location:
index.py, line 9
Vulnerability Type: Hard-coded bearer credential
Risk Level: HighVulnerable Code
python API_KEY = "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"The credential is subsequently placed in the authorization header:
python headers = { "Authorization": f"Bearer {API_KEY}", "Accept": "application/json", }Technical Analysis
A reusable NVIDIA API bearer credential is embedded directly in distributable source code. Any party with read access to the Skill package, source repository, release artifact, backup, or log containing the file can recover and reuse the credential outside the Skill.
The application performs no additional authorization that binds the credential to a particular user or invocation. Consequently, possession of the source code is sufficient to impersonate the credential owner when accessing API operations permitted by the key.
The static pre-scan's decode-and-execute warning was not confirmed. The Base64 operation at
index.py:48only decodes image data returned by the NVIDIA API and writes it to a PNG file; the decoded content is not executed.Attack Path
- An attacker obtains read access to the Skill package or its source.
- The attacker opens
index.pyand extracts the plaintextnvapi-credential from line 9. - The attacker constructs independent requests to supported NVIDIA API endpoints and supplies the stolen value as a bearer token.
- NVIDIA attributes accepted requests to the credential owner's account until the key is revoked, expires, or is otherwise restricted.
Impact Assessment
Successful exploitation grants the attacker the NVIDIA API privileges assigned to the exposed key. Potential consequences include unauthorized model requests, consumption of account quotas, financial charges, rate-limit exhaustion, and service disruption for the le ...[truncated 207 chars]
- Remediation
View remediation
Remediation Suggestions
-
Revoke the exposed credential immediately and issue a replacement, treating the current key as compromised.
-
Remove the credential from source code, version-control history, release archives, build artifacts, and documentation.
-
Load the replacement from a protected environment variable or platform secret manager, and fail safely when it is unavailable. For example:
python API_KEY = os.environ.get("NVIDIA_API_KEY") if not API_KEY: raise RuntimeError("NVIDIA_API_KEY is not configured") -
Configure the secret through OpenClaw's protected runtime configuration rather than shipping it with the Skill.
-
Restrict the replacement key to the minimum API permissions, endpoints, quotas, and lifetime required for image generation.
-
Review NVIDIA usage and billing logs for unauthorized activity associated with the exposed key.
-
Add automated secret scanning to source-control and release pipelines to prevent future credential publication.
-
Avoid exposing credentials in exceptions, diagnostic output, or request logging.
-
