T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/enterprise_recruitment.py:241
- Finding
- API Key Exposure Through Command-Line Arguments## Vulnerability Details **File Location**: `scripts/enterprise_recruitment.py:241-243` **Vulnerability Type**: Sensitive credential exposure through process arguments **Risk Level**: Medium The script accepts the Juhe API key through the `--key` command-line option. The same insecure configuration method is explicitly documented in `SKILL.md:35-37`. ```python if args[i] == "--key" and i + 1 < len(args): cli_key = args[i + 1] i += 2 ``` ### Technical Analysis Command-line arguments are not an appropriate transport mechanism for secrets. Depending on the operating system and execution environment, arguments may be exposed through: - Process inspection utilities and process-monitoring services - Shell command history - CI/CD job logs and workflow telemetry - Debugging, auditing, or endpoint-monitoring software - Wrapper scripts that record invoked commands The script places the API key directly in `sys.argv` and does not warn users about these exposure channels. Although the key is legitimately transmitted to the declared Juhe API, accepting it through a command-line argument exceeds the minimum safe credential-handling behavior necessary for the Skill. ### Attack Path 1. A user follows the documented example and runs the script with `--key SECRET`. 2. The complete command is retained in shell history, captured by automation logs, or temporarily exposed through process metadata. 3. Another local user, system administrator, monitoring service, or person with access to the relevant logs retrieves the key. 4. The recovered key is used to call the Juhe API independently. 5. The attacker consumes the account's quota or causes billable API usage until the credential is revoked or restricted. ### Impact Assessment Exploitation does not grant operating-system privilege escalation or arbitrary code execution. It can grant unauthorized access to the Juhe API privileges associated with the exposed key. Th ...[truncated 173 chars]
- Remediation
- ## Remediation Suggestions 1. Remove support for the `--key` command-line option, or deprecate it with a prominent security warning. 2. Prefer a dedicated secret manager or the existing `JUHE_ENTERPRISE_RECRUITMENT_KEY` environment variable. 3. If interactive use is required, read the key through `getpass.getpass()` so it is not displayed or recorded in shell history. 4. Update `SKILL.md` and the command help to remove examples that place credentials in command arguments. 5. Ensure exception messages, debug logs, and serialized output never contain the API key. 6. Recommend that users rotate any key previously supplied in logged commands and apply provider-side quota and API-scope restrictions.
