T09 · Insecure Skill Coding Practices
- Location
scripts/enterprise_list.py:155- Finding
API Key Exposure Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
scripts/enterprise_list.py:155-157
Additional Locations:SKILL.md:32-33,scripts/enterprise_list.py:10-13,scripts/enterprise_list.py:172-173
Vulnerability Type: Credential exposure through process arguments and command history
Risk Level: MediumThe Skill explicitly supports passing the Juhe API key through the
--keycommand-line option. The vulnerable argument-processing code is:python if args[i] == "--key" and i + 1 < len(args): cli_key = args[i + 1] i += 2The usage instructions also advertise this method:
bash python scripts/enterprise_list.py --key 你的 AppKey --keyword 天聚地合Technical Analysis
Command-line arguments are not an appropriate secret transport mechanism. Depending on the host and execution environment, arguments can be exposed through:
- Shell history files
- Process inspection utilities and operating-system process metadata
- Audit and endpoint-monitoring logs
- CI/CD job output and automation logs
- Terminal recording or support-session capture
The key is legitimately transmitted over HTTPS to the fixed, documented Juhe endpoint, and no unrelated data exfiltration was identified. The vulnerability concerns local credential handling before the network request rather than the necessity or destination of that request.
Attack Path
- A user follows the documented example and invokes the script with
--key. - The shell records the complete command in its history, or process/audit tooling captures the argument list.
- Another local user, administrator, monitoring-system operator, or party with access to retained logs reads the API key.
- The party reuses the exposed key to make unauthorized requests to the Juhe API.
- The unauthorized requests consume the victim's quota and may generate charges or interfere with legitimate service availability.
Impact Assessment
Successf ...[truncated 514 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove or deprecate the
--keycommand-line option so credentials are not accepted through process arguments. - Prefer the existing
JUHE_ENTERPRISE_LIST_KEYenvironment variable or integration with a platform secret manager. - If file-based configuration remains supported, require a dedicated secret file with restrictive permissions, such as mode
0600, and ensure.envis excluded from version control. - For interactive use, obtain the key with
getpass.getpass()so it is not echoed or recorded in command history. - Update
SKILL.md, the module docstring, help output, and examples to remove commands containing keys. - Warn existing users to inspect shell histories and automation logs and rotate any key previously supplied through
--key. - Avoid printing the key in errors, debug output, telemetry, or logs; retain the current behavior of excluding it from the result object.
- Remove or deprecate the
