T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/openclaw_config.py:350
- Finding
- Authentication secrets are accepted through command-line arguments<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:113-114, 151-153`; `scripts/openclaw_config.py:350-351, 365-366`; `scripts/claude_config.py:110-119` **Vulnerability Type**: Exposure of sensitive credentials through process arguments **Risk Level**: Medium ### Complete Code Snippets From `SKILL.md:113-114`: ```bash - For a brand-new provider, `add-model` needs enough provider config to make it valid: at minimum `--base-url` and `--api`; use `--api-key` and `--auth-header` when appropriate. - Use `add-openai-model` only for OpenAI-compatible provider setup flows that require explicit `apiKey` and `api` handling in one step. ``` From `SKILL.md:151-153`: ```bash python3 {baseDir}/scripts/claude_config.py --file ~/.claude/settings.json set-env \ --anthropic-auth-token 'sk-...' \ --attribution-header '0' ``` From `scripts/openclaw_config.py:350-351`: ```python add_model_parser.add_argument("--base-url") add_model_parser.add_argument("--api-key") ``` From `scripts/openclaw_config.py:365-366`: ```python add_openai_model_parser.add_argument("--base-url", required=True) add_openai_model_parser.add_argument("--api-key", required=True) ``` From `scripts/claude_config.py:110-119`: ```python for name in ("set-env", "replace-env"): env_parser = sub.add_parser(name) env_parser.add_argument("--anthropic-auth-token") env_parser.add_argument("--anthropic-base-url") env_parser.add_argument("--anthropic-default-haiku-model") env_parser.add_argument("--anthropic-default-opus-model") env_parser.add_argument("--anthropic-default-sonnet-model") env_parser.add_argument("--anthropic-model") env_parser.add_argument("--api-timeout-ms") env_parser.add_argument("--disable-nonessential-traffic") ``` ### Technical Analysis The Skill instructs the Agent to supply provider API keys and authentication tokens as literal command-line arguments. The scripts then retrieve these secrets through `argparse`. Command-line arguments are ...[truncated 1979 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove secret-bearing command-line options or retain them only as explicitly deprecated compatibility mechanisms. 2. Accept credentials through protected stdin, such as a dedicated `--api-key-stdin` or `--auth-token-stdin` option. 3. Alternatively, accept the name of an environment variable rather than its secret value, while ensuring the Agent runtime does not log environment contents. 4. For structured replacement operations, continue using stdin but ensure tool-call and input logging redact known secret fields. 5. Update `SKILL.md` examples so no token is placed in the command line, even as a placeholder pattern. 6. Implement centralized redaction for `apiKey`, `OPENAI_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, token, and refresh-token fields in errors and execution telemetry. 7. Encourage short-lived, narrowly scoped credentials and provider-side rotation after suspected exposure. ]]>
