T09 · Insecure Skill Coding Practices
- Location
twitter-article.js:514- Finding
Notion integration token exposed through command-line arguments
- Content
View full analysis
--page-id ``` ```javascript // twitter-article.js:514-526 async function main() { const args = process.argv.slice(2); const cmd = args[0]; const getArg = (name) => { const i = args.indexOf(`--${name}`); return i >= 0 ? args[i + 1] : null; }; try { switch (cmd) { // ... case 'notion-to-article': await cmdNotionToArticle(getArg('notion-key'), getArg('page-id'), { publish: args.includes('--publish') }); break; ``` ### Technical Analysis The documented interface instructs users to supply the Notion integration secret through the `--notion-key` command-line option. The implementation then retrieves that secret directly from `process.argv`. Command-line arguments are not an appropriate channel for secrets because they may be exposed through: - Shell history files. - Process listings and process-monitoring utilities. - Audit, telemetry, debugging, or orchestration logs that record command lines. - Wrapper scripts, job definitions, or CI logs containing the full invocation. - Error reports or administrative tooling that captures process metadata. The Notion token is legitimately required for the declared Notion-to-Twitter synchronization operation, and the code sends it only to the official Notion API. The vulnerability is therefore not unauthorized network exfiltration; it is insecure local credential handling that unnecessarily broadens access to the token. ### Attack Path 1. A user follows the documented example and runs the Skill with `--notion-key `. 2. The secret becomes part of the process command line and may also be written to shell history. 3. A local user, process-monitoring service, CI logger, o ...[truncated 821 chars]- Remediation
View remediation
" node twitter-article.js notion-to-article --page-id ``` 6. Advise existing users to remove exposed commands from shell history and rotate any token that may have entered logs. 7. Ensure error messages and diagnostic output never print the token or complete authorization headers. ]]>
