T09 · Insecure Skill Coding Practices
- Location
SKILL.md:43- Finding
Refresh Token Exposed Through Process Command-Line Arguments
- Content
View full analysis
--refresh-token "$OLARES_REFRESH_TOKEN" ``` Exchanges the refresh_token for an access_token once via `/api/refresh` and writes both to the keychain. **Read the token from an env var or secret manager — never inline plaintext.** ``` The same unsafe pattern is repeated in the security guidance at `SKILL.md:123`: ```markdown - **Never** echo `access_token` / `refresh_token` to the terminal. When passing a refresh_token to `profile import`, source it from an environment variable: `--refresh-token "$OLARES_REFRESH_TOKEN"`. ``` ### Technical Analysis The documented command expands `OLARES_REFRESH_TOKEN` before starting `olares-cli`. Although the token originates in an environment variable or secret manager, the shell substitutes its value into the `--refresh-token` argument. The resulting plaintext credential may therefore appear in the child process's argument vector. Depending on operating-system permissions and deployment configuration, command-line arguments can be observed through process inspection facilities, process-monitoring agents, audit logs, shell tracing, CI/CD diagnostic output, or wrappers that record invoked commands. Sourcing a secret from an environment variable does not protect it after it is expanded into a command-line argument. A refresh token is a long-lived bearer credential capable of obtaining new access tokens. Its disclosure is consequently more severe than disclosure of a short-lived access token. ### Attack Path 1. A user or automation system follows the documented import command. 2. The shell expands `$OLARES_REFRESH_TOKEN` into the plaintext `--refresh-token` argument. 3. A local process observer, privileged monitoring servi ...[truncated 1263 chars]- Remediation
View remediation
` usage. 4. Replace the documented example with a non-argument transport, for example: ```bash secret_manager_read olares-refresh-token | olares-cli profile import --olares-id "" --refresh-token-stdin ``` 5. Ensure the CLI does not print, log, or include the token in errors, telemetry, crash reports, or debug output. 6. Clear temporary in-memory buffers where practical after the token exchange. 7. Rotate any refresh token suspected of having appeared in process telemetry or build logs. ]]>
