T09 · Insecure Skill Coding Practices
- Location
video_crawler.py:16- Finding
Hard-Coded DashScope API Credential in Source Code
- Content
View full analysis
Vulnerability Details
File Location:
video_crawler.py, line 16
Vulnerability Type: Hard-coded secret
Risk Level: HighVulnerable Code
python DASHSCOPE_API_KEY = "sk-c0f66bb7aeff4b94810691214a1477fd"Technical Analysis
The source code contains a credential-shaped DashScope API key in plaintext. Any person or system with access to the project package, source repository, build artifacts, backups, or logs containing this file can recover the value without authentication.
The credential is not used elsewhere in the reviewed script, so it is unnecessary for the documented video-download functionality. Its presence therefore expands the project's exposure without providing a functional benefit. Whether the credential remains active cannot be established through static analysis, but it must be treated as compromised because it has been distributed in plaintext.
Attack Path
- An attacker obtains a copy of the skill package, repository, archive, or related build artifact.
- The attacker reads
video_crawler.pyand extracts the value assigned toDASHSCOPE_API_KEY. - The attacker submits the key to compatible DashScope API endpoints.
- If the key is active, the attacker consumes the associated account's API quota or accesses capabilities granted to that credential.
Impact Assessment
A valid key could permit unauthorized use of the associated DashScope account within the credential's assigned permissions and quotas. Potential consequences include unexpected charges, quota depletion, service disruption, and access to API functionality available to the key. This finding does not provide local operating-system privileges by itself; its scope is limited to the external account and permissions represented by the credential.
- Remediation
View remediation
Remediation Suggestions
- Revoke or rotate the exposed key immediately and review the associated account's usage logs for unauthorized activity.
- Remove the credential from the current source and all accessible repository history, release archives, caches, and build artifacts.
- Because the key is unused, delete the variable entirely. If a future feature legitimately requires a secret, retrieve it from a protected environment variable or managed secret store.
- Apply least-privilege scopes, spending limits, quota alerts, expiration, and credential rotation policies.
- Add automated secret scanning to pre-commit hooks and continuous-integration pipelines to prevent recurrence.
