T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:40
- Finding
- Plaintext Secret Exposure Through Terminal Output, Tmux Capture, and Files## Vulnerability Details **File Location**: `SKILL.md:40-45`; `references/cli-examples.md:10-13,17-19,23-24` **Vulnerability Type**: Plaintext credential disclosure caused by unsafe secret-handling examples **Risk Level**: High ### Vulnerable Code `SKILL.md:40-45`: ```bash tmux -S "$SOCKET" new -d -s "$SESSION" -n shell tmux -S "$SOCKET" send-keys -t "$SESSION":0.0 -- "op signin --account my.1password.com" Enter tmux -S "$SOCKET" send-keys -t "$SESSION":0.0 -- "op whoami" Enter tmux -S "$SOCKET" send-keys -t "$SESSION":0.0 -- "op vault list" Enter tmux -S "$SOCKET" capture-pane -p -J -t "$SESSION":0.0 -S -200 tmux -S "$SOCKET" kill-session -t "$SESSION" ``` `references/cli-examples.md:10-13`: ```bash - `op read op://app-prod/db/password` - `op read "op://app-prod/db/one-time password?attribute=otp"` - `op read "op://app-prod/ssh key/private key?ssh-format=openssh"` - `op read --out-file ./key.pem op://app-prod/server/ssh/key.pem` ``` `references/cli-examples.md:17-19`: ```bash - `export DB_PASSWORD="op://app-prod/db/password"` - `op run --no-masking -- printenv DB_PASSWORD` - `op run --env-file="./.env" -- printenv DB_PASSWORD` ``` `references/cli-examples.md:23-24`: ```bash - `echo "db_password: {{ op://app-prod/db/password }}" | op inject` - `op inject -i config.yml.tpl -o config.yml` ``` ### Technical Analysis Several documented examples resolve sensitive 1Password references directly to standard output or plaintext files. In particular, `op run --no-masking -- printenv DB_PASSWORD` explicitly disables 1Password's output masking and prints the resolved database password. The `op read` and piped `op inject` examples can likewise place passwords, one-time passwords, or private keys in terminal output. The required workflow subsequently demonstrates `tmux capture-pane`, which copies terminal scrollback to the caller's output. If a secret-producing command is run in the same pane, its ...[truncated 2150 chars]
- Remediation
- ## Remediation Suggestions 1. Remove `--no-masking` and all examples that pass resolved secrets to `printenv`, `echo`, or other standard-output commands. 2. Demonstrate `op run` only by launching the intended application directly, without displaying its secret-bearing environment: ```bash op run --env-file="./.env" -- ./application ``` 3. Do not run `tmux capture-pane` after any command that may display a secret. Use a separate pane for authentication and status checks, clear scrollback before capture, or avoid pane capture entirely. 4. Replace direct `op read` examples with examples that consume the secret without printing it. Where output is inherently required, add an explicit warning that the command must not be executed through captured or logged terminals. 5. Avoid writing private keys or injected configurations to disk. Prefer process substitution, standard input, or an application interface that consumes the secret in memory. 6. When a file is unavoidable, create it in a protected directory with restrictive permissions, for example by setting `umask 077`, and securely delete it immediately after use. 7. Add automated redaction or output filtering as defense in depth, while making clear that redaction is not a substitute for avoiding plaintext output. 8. Update the workflow so its examples are consistent with the existing prohibition against placing secrets in logs, chat, or code.
