T09 · Insecure Skill Coding Practices
- Location
scripts/meshy_client.py:34- Finding
API Key Exposure Through Command-Line Arguments and Insecure Plaintext Storage
- Content
View full analysis
Vulnerability Details
File Location:
scripts/meshy_client.py:34-38,scripts/meshy_client.py:82-83, andSKILL.md:41
Vulnerability Type: Plaintext sensitive-data storage and command-line secret exposure
Risk Level: MediumVulnerable code and documentation:
scripts/meshy_client.py:34-38:python def set_key(api_key): env_path = os.path.join(os.path.dirname(__file__), "..", ".env") with open(env_path, "w") as f: f.write(f"MESHY_API_KEY={api_key}\n") print(f"API key saved to {env_path}")scripts/meshy_client.py:82-83:python elif command == "set-key": set_key(sys.argv[2])SKILL.md:41:markdown - **API Key:** Requires `MESHY_API_KEY`. Save locally: `python scripts/meshy_client.py set-key YOUR_KEY`.Technical Analysis
The documented setup procedure requires the Meshy API key to be supplied as a command-line argument. Command-line secrets may be retained in shell history and can be exposed through process-inspection mechanisms while the command is running.
The
set_keyfunction subsequently writes the credential in plaintext to the project-level.envfile. The file is opened using the process's default permissions, and the implementation does not explicitly enforce owner-only access. Its effective permissions therefore depend on the caller's umask and surrounding filesystem configuration. The file could also be unintentionally copied, archived, or committed to source control because no version-control exclusion is documented in the audited files.Exploitation requires local access, access to shell history or process metadata, access to an inadequately protected project directory, or accidental disclosure of the
.envfile. No remote mechanism for reading this credential was identified in the audited code.Attack Path
- A user follows the documented command and supplies the API key as `python scripts/meshy_client.py se ...[truncated 1091 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove support for passing API keys directly through command-line arguments.
- Read interactive secrets using
getpass.getpass()so they are not echoed or placed in shell history. - Prefer retrieving the credential from a dedicated operating-system secret store or secrets-management service.
- If a local file must be supported, create it atomically with owner-only permissions such as mode
0600. - Refuse to use a credential file whose owner or permissions are unsafe.
- Add
.envto the project's version-control ignore rules and document that it must not be committed, archived, or shared. - Avoid printing sensitive values and provide clear key-rotation instructions for users who may already have exposed a credential.
- Consider replacing the command with an interactive setup flow that validates permissions before writing the secret.
