T09 · Insecure Skill Coding Practices
- Location
scripts/enterprise_restriction.py:243- Finding
API Key Exposure Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
scripts/enterprise_restriction.py:243-245andSKILL.md:35-40
Vulnerability Type: Credential exposure through process arguments and shell history
Risk Level: MediumThe Skill supports passing the Juhe API key directly through the
--keycommand-line option and explicitly documents this method.Vulnerable implementation:
python if args[i] == "--key" and i + 1 < len(args): cli_key = args[i + 1] i += 2Documented usage:
bash # Option 3: Pass it on the command line for each invocation python scripts/enterprise_restriction.py --key YOUR_APP_KEY --name COMPANY_NAMETechnical 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-listing utilities, process metadata, audit frameworks, monitoring agents, job-runner logs, terminal scrollback, and shell history.
The API key is subsequently sent to the fixed Juhe HTTPS endpoint as required for the declared lookup functionality. That network transfer is expected and necessary. The vulnerability is the optional local credential-input method, not the use of the declared remote API.
The script also supports an environment variable and a local
.envfile, so accepting the key through--keyis not required for the Skill's core functionality and exceeds the minimum safe credential-handling design.Attack Path
- A user follows the documented example and invokes the script with
--key. - The complete command, including the API key, may be stored in shell history or captured by process monitoring, audit logging, or orchestration telemetry.
- A local user or component with access to that data extracts the API key.
- The exposed key is reused against the Juhe API.
- The attacker consumes paid quota or accesses the API entitlement associated with t ...[truncated 766 chars]
- A user follows the documented example and invokes the script with
- Remediation
View remediation
Remediation Suggestions
- Remove the
--keycommand-line option and all documentation examples that place credentials in command arguments. - Retain the dedicated
JUHE_ENTERPRISE_RESTRICTION_KEYenvironment variable as the primary supported configuration method. - If
.envsupport remains, require owner-only permissions such as mode0600, reject files with unsafe permissions where practical, and ensure.envis excluded from version control. - For interactive use, optionally read the key with Python's
getpass.getpass()so it is not echoed or stored in command history. - Avoid including credentials in exceptions, debug output, query-result objects, or telemetry.
- Rotate any API key previously supplied through the documented
--keymethod if command histories or execution logs may have been retained.
- Remove the
