T09 · Insecure Skill Coding Practices
- Location
scripts/get-douyin-token.js:67- Finding
OAuth Access and Refresh Tokens Exposed in Plaintext Console Output
- Content
View full analysis
` to exchange an OAuth authorization code. 2. The script prints the complete access token and refresh token to the console. 3. Terminal output is captured by a CI system, remote administration platform, process supervisor, session recorder, or another user with access to the terminal history. 4. An attacker extracts the bearer credential from the retained output. 5. The attacker invokes the Douyin API using the stolen token. 6. If the granted scopes include `video.create`, the attacker may upload or publish content as the authorized user. A stolen refresh token may enable renewed access, subject to Douyin's token validity and revocation rules. ### Impact Assessment An attacker can obtain the OAuth privileges granted to ...[truncated 408 chars]- Remediation
View remediation
value ? `${'*'.repeat(Math.max(0, value.length - 4))}${value.slice(-4)}` : '(missing)'; console.log('open_id:', openId); console.log('access_token received:', maskSecret(accessToken)); console.log('expires_in(seconds):', data?.expires_in); ``` 4. If credentials must be passed to another process, use an operating-system secret manager, protected file descriptor, or another channel designed for secrets rather than standard output. 5. Ensure CI and process-management systems redact known token fields. 6. Document token revocation and rotation procedures and advise users to revoke credentials immediately after suspected disclosure. ]]>
