T09 · Insecure Skill Coding Practices
- Location
valuation.py:16- Finding
Hard-Coded Tavily API Credential
- Content
View full analysis
Vulnerability Details
File Location:
valuation.py, line 16
Vulnerability Type: Hard-coded API credential
Risk Level: HighVulnerable Code:
python os.environ["TAVILY_API_KEY"] = "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"Technical Analysis
A Tavily API credential is embedded directly in the distributed source code. Anyone with read access to the project can recover the plaintext token without executing the skill. The assignment also overwrites any
TAVILY_API_KEYalready supplied through a secure runtime configuration, forcing all executions to use the exposed credential.The token can be copied from the source and submitted directly to Tavily from a separate system. No local privilege escalation or command execution is required.
Attack Path
- An attacker obtains read access to the skill package or a repository containing
valuation.py. - The attacker reads line 16 and extracts the Tavily API token.
- The attacker configures the extracted token in an independent API client.
- The attacker submits Tavily requests under the credential owner's account until the credential is revoked, expires, or reaches its service limits.
Impact Assessment
Successful exploitation permits unauthorized use of the Tavily account within the permissions assigned to the exposed token. This may consume API quota, disrupt legitimate requests through rate-limit exhaustion, expose account usage metadata, and create financial impact if usage-based billing is enabled. The code does not establish that this token grants local system privileges or access to unrelated services.
- An attacker obtains read access to the skill package or a repository containing
- Remediation
View remediation
Remediation Suggestions
- Revoke and rotate the exposed Tavily token immediately; deleting it from the current source alone does not invalidate copies in repository history or distributed packages.
- Remove the hard-coded assignment and read the credential from runtime configuration:
python tavily_api_key = os.environ.get("TAVILY_API_KEY") if not tavily_api_key: raise RuntimeError("TAVILY_API_KEY is not configured") - Supply the token through a secret manager or a protected environment variable with access limited to the service account running the skill.
- Do not overwrite an existing securely configured environment variable.
- Purge the credential from version-control history and previously published artifacts where feasible.
- Add automated secret scanning and pre-commit checks to prevent credentials from being committed again.
- Review Tavily access and usage logs for unauthorized requests, and restrict the replacement token's permissions and quotas to the minimum required.
