T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:61
- Finding
- npm One-Time Password Exposed Through Command-Line Arguments<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:61` and `SKILL.md:73` **Vulnerability Type**: Sensitive credential exposure through process arguments and shell history **Risk Level**: Medium ### Vulnerable Code ```bash npm publish --access public --otp="<otp>" ``` ```bash npm publish --access public --tag beta --otp="<otp>" ``` ### Technical Analysis The documented publishing workflow instructs users or agents to substitute an npm one-time password directly into the `--otp` command-line argument. Although obtaining an OTP is legitimate for an authenticated npm publication, placing the value in a command exposes it to local observation channels such as: - Shell history files - Terminal or tmux logging - Command auditing and session-recording systems - Debug output or shell tracing - Process inspection while the command is running - Agent execution transcripts The related instruction at `SKILL.md:47` limits OTP retrieval to situations where npm requires it and therefore does not, by itself, exceed the publishing task's necessary privileges. No instruction sends the OTP to an unrelated service. The weakness is the insecure transfer of that credential from the password manager into a visible command-line argument. ### Attack Path 1. A release operator or agent initiates an npm publication that requires an OTP. 2. The OTP is retrieved through the referenced 1Password workflow. 3. The operator or agent replaces `<otp>` with the actual value in one of the documented commands. 4. The resulting command is captured through shell history, tmux logging, process monitoring, execution transcripts, or terminal-session recording. 5. An attacker with access to that local observation channel extracts the OTP before it expires. 6. If the attacker also has a usable npm authentication session or token, they may reuse the OTP to authorize a malicious publication or another protected npm operation during the OTP's validity window. ### Impact Assessment Succe ...[truncated 651 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Prefer npm's interactive OTP prompt rather than embedding the OTP in the command: ```bash npm publish --access public ``` For beta releases: ```bash npm publish --access public --tag beta ``` 2. Allow npm to request the OTP interactively only when the registry requires it. Retrieve the OTP immediately before entry and do not paste it into a reusable command. 3. Explicitly prohibit recording OTPs in shell history, agent transcripts, logs, scripts, environment files, or release documentation. 4. Ensure shell tracing is disabled while handling credentials: ```bash set +x ``` 5. Disable tmux session logging and avoid terminal-recording environments during credential entry. 6. Where supported by the release process, use npm trusted publishing or another short-lived, workload-identity-based mechanism so that human OTP handling is unnecessary. 7. Update the Skill guardrail to state that the 1Password workflow may retrieve the OTP only for immediate interactive entry into npm and must not print, persist, or interpolate it into a command line. ]]>
