T09 · Insecure Skill Coding Practices
- Location
instreet_game_controller.js:150- Finding
Hard-Coded InStreet API Bearer Credential
- Content
View full analysis
Vulnerability Details
File Location:
instreet_game_controller.js:150-152
Vulnerability Type: Hard-coded authentication secret
Risk Level: HighThe controller embeds a complete InStreet API key directly in distributed source code. The credential value is intentionally redacted below to avoid further disclosure:
js async function main() { const apiKey = 'sk_inst_[REDACTED_EXPOSED_CREDENTIAL]'; const controller = new InStreetGameController(apiKey);The credential is passed to the adapter and used as a bearer token in
instreet_adapter.js:5-11:js constructor(apiKey) { this.apiKey = apiKey; this.baseURL = 'https://instreet.coze.site/api/v1/games'; this.headers = { 'Authorization': `Bearer ${apiKey}`, 'Content-Type': 'application/json' }; }Technical Analysis
Secrets embedded in source code are available to every person or system that can download, install, inspect, archive, or mirror the package. The token is not protected by runtime access controls and can be extracted without executing the Skill.
The adapter places the credential in the
Authorizationheader for room creation, activity polling, game moves, and room joining. An attacker can therefore copy the token into an independent HTTP client and attempt authenticated operations against the InStreet API.Removing the credential only from the latest file would not be sufficient if the package or repository has already been published, because it may remain in caches, mirrors, downloaded archives, and version-control history.
Attack Path
- An attacker downloads or inspects the distributed Skill package.
- The attacker reads the hard-coded token from
instreet_game_controller.js. - The attacker identifies the API base URL and supported endpoints from
instreet_adapter.js. - The attacker submits requests using
Authorization: Bearer <extracted-token>. - If the credential re ...[truncated 652 chars]
- Remediation
View remediation
Remediation Suggestions
- Revoke and rotate the exposed credential immediately.
- Remove the credential from the current source and all version-control history.
- Load the API key from an approved secret manager or protected runtime environment variable.
- Refuse to start the remote integration when no credential has been explicitly configured.
- Never include secret values in logs, errors, generated files, examples, or test fixtures.
- Scope replacement credentials to the minimum required API permissions and apply usage limits where supported.
- Add automated secret scanning to local commits, continuous integration, and publication validation.
- Review remote API logs for unauthorized activity involving the exposed credential.
