T09 · Insecure Skill Coding Practices
- Location
scripts/enterprise_recruitment.py:242- Finding
API Key Exposure Through Command-Line Arguments and Plaintext Local Storage
- Content
View full analysis
Vulnerability Details
File Location:
scripts/enterprise_recruitment.py:62-77, 242-244andSKILL.md:29-33, 79
Vulnerability Type: API credential exposure
Risk Level: MediumVulnerable Code
The script accepts the API key directly as a command-line argument:
python if args[i] == "--key" and i + 1 < len(args): cli_key = args[i + 1] i += 2It also reads the credential from a plaintext file without checking ownership or permissions:
python def load_api_key(cli_key: str = None) -> str: if cli_key: return cli_key env_key = os.environ.get("JUHE_ENTERPRISE_RECRUITMENT_KEY", "").strip() if env_key: return env_key env_file = Path(__file__).parent / ".env" if env_file.exists(): for line in env_file.read_text(encoding="utf-8").splitlines(): line = line.strip() if line.startswith("JUHE_ENTERPRISE_RECRUITMENT_KEY="): val = line.split("=", 1)[1].strip().strip('"').strip("'") if val: return val return ""The documentation additionally instructs users to place the key in
scripts/.env, pass it on the command line, and includes a direct GET request example with the key in the URL.Technical Analysis
Command-line arguments are not an appropriate secret-transport mechanism. Depending on the operating system and execution environment, arguments can be exposed through:
- Process inspection tools and process metadata.
- Shell command history.
- Job runners, terminal session records, and automation logs.
- Error reports or monitoring systems that record complete commands.
The local
.envfallback stores the API key in plaintext inside the project tree. The script does not verify that the file is owned by the current user or restricted to owner-only access. It also does not ensure that the file is excluded from version control. ...[truncated 2315 chars]- Remediation
View remediation
Remediation Suggestions
- Remove support for the
--keycommand-line argument so credentials cannot be supplied through process arguments. - Prefer environment-variable injection from a trusted runtime secret store, such as a CI/CD secret manager, container secret, operating-system credential service, or orchestrator-managed secret.
- Remove the GET example containing
key=YOUR_KEY. Document only the HTTPS POST workflow and avoid placing credentials in URLs. - If
.envsupport must remain:- Require owner-only permissions, such as mode
0600on POSIX systems. - Reject the file or display a prominent warning when group or world access is enabled.
- Verify that the file is a regular file and is owned by the expected user.
- Add
scripts/.envand.envto.gitignore. - Clearly warn users never to commit or distribute the file.
- Require owner-only permissions, such as mode
- Avoid logging complete commands, request bodies, or credential-bearing configuration values.
- Recommend immediate key rotation if a key has previously appeared in shell history, repository history, process logs, or URL logs.
- Consider reading the key interactively with hidden input when environment-based secret injection is unavailable.
- Remove support for the
