T09 · Insecure Skill Coding Practices
- Location
scripts/daily_update.py:19- Finding
Hard-Coded Serper API Credential
- Content
View full analysis
Vulnerability Details
File Location:
scripts/daily_update.py:19
Vulnerability Type: Hard-coded secret
Risk Level: Highpython SERPER_API_KEY = os.environ.get('SERPER_API_KEY', '374959ea28cae888d8049ea2e34d8acc156c602b')Technical Analysis
The script embeds a Serper API key as the default value used when
SERPER_API_KEYis not present in the environment. Anyone who can download, clone, inspect, or otherwise access the Skill package can recover this credential without authentication.The credential is subsequently placed in the
X-API-KEYHTTP header and transmitted to the expected Serper endpoint. Although no transmission to an unrelated endpoint was identified, embedding a live credential in distributed source code removes effective control over who may use it.Attack Path
- An attacker obtains a copy of the Skill package or its source repository.
- The attacker reads
scripts/daily_update.pyand extracts the fallback API key from line 19. - The attacker submits requests directly to the Serper API using the exposed key.
- Requests consume the credential owner's quota and may continue until the key is revoked or restricted.
Impact Assessment
Exploitation grants unauthorized use of the Serper account privileges associated with the exposed key. Potential consequences include API quota exhaustion, unexpected charges where billing applies, disruption of legitimate updates, and loss of attribution between legitimate and unauthorized requests.
This finding does not grant local operating-system privileges or GitHub access by itself. Its scope is limited to the permissions and usage limits assigned to the exposed Serper credential.
- Remediation
View remediation
Remediation Suggestions
- Revoke and rotate the exposed API key immediately.
- Remove the fallback credential and require the key to be supplied through a protected environment variable:
python SERPER_API_KEY = os.environ.get("SERPER_API_KEY") if not SERPER_API_KEY: raise RuntimeError("SERPER_API_KEY is required") - Store the replacement key in a CI/CD secret store or operating-system secret manager rather than in source files.
- Restrict the key by API scope, quota, origin, or account policy where supported.
- Scan repository history and distributed artifacts for prior copies of the credential.
- Add automated secret scanning and pre-commit checks to prevent future credential commits.
