T09 · Insecure Skill Coding Practices
- Location
scripts/tavily_search.py:11- Finding
Hardcoded Tavily API Credential in Source Code
- Content
View full analysis
Vulnerability Details
File Location:
scripts/tavily_search.py:11
Vulnerability Type: Hardcoded secret
Risk Level: HighVulnerable Code
python TAVILY_API_KEY = os.getenv("TAVILY_API_KEY", "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")Technical Analysis
The Tavily client contains a live-looking API credential as the default value used when the
TAVILY_API_KEYenvironment variable is absent. Embedding credentials in distributable source code exposes them to every user who downloads, installs, audits, or otherwise obtains the package.The fallback also means the script silently authenticates with the embedded credential when the environment has not been configured. This behavior is independent of the API key collected by the setup script.
Attack Path
- An attacker downloads or otherwise obtains the Skill package.
- The attacker reads
scripts/tavily_search.py. - The attacker extracts the hardcoded Tavily API key from line 11.
- The attacker submits authenticated requests directly to the Tavily API using the exposed key.
- Requests consume the credential owner's quota and are attributed to the associated account until the key is revoked.
Impact Assessment
The exposed credential may allow unauthorized use of the Tavily account's API privileges. The practical scope is limited to the permissions assigned to that key, but may include quota consumption, service abuse, unexpected billing, account attribution, and denial of service to legitimate users through quota exhaustion.
- Remediation
View remediation
Remediation Suggestions
- Revoke and rotate the exposed credential immediately.
- Remove the credential from the current source tree and repository history.
- Require the key through an environment variable or an operating-system-backed secret store.
- Fail closed with a clear configuration error if no credential is available; do not provide a secret fallback.
- Add secret scanning to pre-commit hooks and CI pipelines.
- Ensure tests use mocked credentials or explicitly invalid placeholders.
- Integrate the search script with the setup configuration securely rather than maintaining separate, inconsistent credential sources.
