T09 · Insecure Skill Coding Practices
- Location
SKILL.md:19- Finding
Plaintext Storage Recommendation for a Privileged n8n API Key
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 19-24
Vulnerability Type: Plaintext sensitive-data storage
Risk Level: MediumVulnerable Code Snippet:
bash Suggested environment variables (or store in `.n8n-api-config`): export N8N_API_BASE_URL="https://your-instance.app.n8n.cloud/api/v1" # or http://localhost:5678/api/v1 export N8N_API_KEY="your-api-key-here"Technical Analysis
The documentation recommends storing the n8n API key in a local
.n8n-api-configfile but does not require restrictive file permissions, version-control exclusion, encryption, or secret-manager integration. This creates a risk that a privileged credential will remain in plaintext and become accessible through repository commits, backups, shared workspaces, filesystem access, or diagnostic archives.The key is used as the
X-N8N-API-KEYauthentication value for the n8n public API. The documented API surface includes administrative and destructive operations involving workflows, executions, credentials, users, projects, variables, and data tables. The exact privileges available to an attacker depend on the permissions assigned to the exposed key.The alternative example permits an
http://localhostbase URL. While appropriate in some isolated local deployments, plaintext HTTP should not be recommended for remote or untrusted network paths because the API key could be intercepted in transit.Attack Path
- A user follows the recommendation and writes a valid n8n API key to
.n8n-api-config. - The file is created with permissive filesystem permissions, included in a repository commit, copied into a backup, or exposed through a shared workspace.
- An attacker with access to that location retrieves the plaintext API key and configured n8n base URL.
- The attacker submits requests containing the stolen key in the
X-N8N-API-KEYheader. - Subject to the key's assigned permissions, the attacker reads ...[truncated 991 chars]
- A user follows the recommendation and writes a valid n8n API key to
- Remediation
View remediation
Remediation Suggestions
- Remove the general recommendation to store API keys in
.n8n-api-config; prefer a managed secret store or runtime secret injection. - If file-based storage is unavoidable, explicitly require permissions of
0600and ensure that only the intended account owns the file. - Add
.n8n-api-configto.gitignoreand equivalent exclusions for backup, packaging, container-build, and diagnostic processes. - Never commit a real API key, include it in generated workflow artifacts, or print it in logs and command output.
- Use dedicated, least-privilege API keys and rotate them periodically and immediately after suspected exposure.
- Require HTTPS with certificate validation for non-loopback connections. Restrict plaintext HTTP examples to explicitly isolated loopback-only development environments.
- Avoid loading configuration files as arbitrary shell scripts. Parse a strict key-value format so tampered configuration cannot introduce shell commands.
- Document revocation and incident-response procedures for exposed keys.
- Remove the general recommendation to store API keys in
