T09 · Insecure Skill Coding Practices
- Location
scripts/get-token.js:59- Finding
Microsoft Graph Bearer Token Exposed Through Standard Output and an Unsafe Predictable Temporary File
- Content
View full analysis
data.expires_at - 60000) { console.error("❌ Token expired. Run get-token.js again."); process.exit(1); } return data.access_token; } ``` Equivalent token-loading behavior appears in `scripts/find-meeting-times.js:37-49` and `scripts/list-users.js:21-33`. ### Technical Analysis The access token is written to a fixed filename in the operating system's shared temporary directory. `fs.writeFileSync()` is used without an explicit restrictive file mode, exclusive creation, symbolic-link protection, ownership verification, or atomic replacement. The resulting permissions depend on the process umask and may allow other local accounts to read the file. A local attacker may also pre-create the predictable path as a symbolic link, causing the token to be written through that link. The full bearer token is additionally printed to standard output. This exposes it to terminal scrollback, agent execution transcripts, CI/CD logs, process-output collectors, and any parent process that capture ...[truncated 1594 chars]- Remediation
View remediation
