N8n credential policy
Credential governance and security policy. Use when creating, managing, or auditing n8n credentials, discussing credential security, setting up authentication, or planning credential lifecycle management.From its SKILL.md
npx -y skills add gabrielrdga/n8n-skills --skill n8n-credential-policyAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
9.2 KB, as published. Nobody here has run it
n8n Credential Policy
Governance framework for secure credential management in n8n workflows.
Core Principles
- Least Privilege — Create credentials with minimum required permissions
- Reuse Over Create — Check existing credentials before creating new ones
- Schema First — Always validate schema before creation
- Audit Trail — Log all credential operations with justification
- Environment Separation — Never share credentials across dev/staging/prod
Credential Lifecycle
1. NEED IDENTIFIED
↓ Workflow spec lists required credential
2. CHECK EXISTING
↓ n8n_manage_credentials({action: "list"})
3. SCHEMA DISCOVERY
↓ n8n_manage_credentials({action: "getSchema", credentialType: "..."})
4. PRE-CREATE REVIEW
↓ Verify: scope, naming, classification
5. CREATE
↓ n8n_manage_credentials({action: "create", ...})
6. VERIFY
↓ List credentials, confirm creation
7. USE IN WORKFLOW
↓ Assign to nodes
8. MONITOR
↓ Periodic audit for unused/expired credentials
9. ROTATE / REVOKE
↓ Update or delete as needed
Pre-Create Checklist
Before creating ANY credential, verify:
1. Does It Already Exist?
// Always check first!
const existing = await n8n_manage_credentials({
action: "list"
});
const match = existing.find(c => c.type === "slackApi");
if (match) {
// REUSE — Don't create a duplicate
console.log(`Found existing: ${match.name} (ID: ${match.id})`);
}
2. Is the Scope Minimal?
| Service | Over-Scoped ❌ | Right-Scoped ✅ |
|---|---|---|
| Slack | Full admin access | Bot with channels:read, chat:write |
| GitHub | Full repo access | Read-only for specific repo |
| AWS | Administrator | Specific IAM role with policy |
| Database | Root/admin user | App-specific user with table permissions |
3. Is the Classification Correct?
| Classification | Description | Handling |
|---|---|---|
public | Non-sensitive (public API, no auth) | Standard handling |
internal | Internal service credentials | Encrypt at rest |
confidential | Customer data access | Encrypt + access log |
restricted | Payment, PII, admin access | Encrypt + approval + audit |
4. Does the Name Follow Convention?
Format: {env}-{service}-{purpose}
✅ prod-slack-order-notifications
✅ staging-postgres-inventory-db
✅ dev-github-ci-readonly
❌ slack (too vague)
❌ my-api-key (no environment)
❌ test123 (meaningless)
Schema-First Creation
ALWAYS discover the schema before creating:
// Step 1: Get schema
const schema = await n8n_manage_credentials({
action: "getSchema",
credentialType: "slackApi"
});
// Returns: required fields, types, descriptions
// Step 2: Review required fields
console.log(schema);
// → { accessToken: { type: "string", required: true } }
// Step 3: Create with all required fields
await n8n_manage_credentials({
action: "create",
name: "prod-slack-order-notifications",
type: "slackApi",
data: {
accessToken: "xoxb-..." // From secure source
}
});
// Step 4: Verify creation
const credentials = await n8n_manage_credentials({
action: "list"
});
// Confirm new credential appears
Environment Separation
Policy
| Environment | Credential Source | Auto-Create | Activation |
|---|---|---|---|
| Development | Can use test values | ✅ Yes | Auto |
| Staging | Must use real (but limited) | ⚠️ Review | Auto |
| Production | Must use production tokens | ❌ Approval Required | Manual |
Implementation
// Check environment before creating
const env = workflowSpec.environment; // from PRD discovery
if (env === "production") {
// BLOCK: Production credentials need human approval
console.log("⚠️ PRODUCTION credential requested.");
console.log("Action: Provide credentials manually or approve creation.");
// Don't auto-create production credentials
} else {
// Dev/staging: proceed with schema validation
const schema = await n8n_manage_credentials({
action: "getSchema",
credentialType: credType
});
// Continue creation flow...
}
Credential Security Rules
Never Do
// ❌ NEVER hardcode secrets in workflow nodes
{
"parameters": {
"authentication": "none",
"url": "https://api.example.com",
"headers": {
"Authorization": "Bearer sk-1234567890" // ❌ HARDCODED!
}
}
}
// ❌ NEVER create credentials without schema check
await n8n_manage_credentials({
action: "create",
name: "quick-test",
type: "unknown", // ❌ Type not validated
data: { key: "value" } // ❌ No schema validation
});
// ❌ NEVER share credentials across environments
// Using prod-slack in dev workflow = policy violation
Always Do
// ✅ ALWAYS use credential references
{
"parameters": {
"authentication": "predefinedCredentialType",
"nodeCredentialType": "slackApi"
// Actual secret managed by n8n credential system
}
}
// ✅ ALWAYS validate schema first
const schema = await n8n_manage_credentials({
action: "getSchema",
credentialType: "slackApi"
});
// Then create with validated fields
// ✅ ALWAYS verify after creation
const list = await n8n_manage_credentials({ action: "list" });
const created = list.find(c => c.name === expectedName);
Credential Audit
When to Audit
| Event | Audit Type |
|---|---|
| After workflow deploy | Quick audit: secrets, auth |
| Weekly (automated) | Full audit: all credentials |
| After security incident | Deep scan: all workflows + credentials |
| Before compliance review | Comprehensive: SOC2/GDPR checklist |
Audit Commands
// Quick audit: check for hardcoded secrets
await n8n_audit_instance({
customChecks: ["hardcoded_secrets"],
includeCustomScan: true
});
// Full audit: all checks
await n8n_audit_instance();
// Returns findings with remediation playbook
// Check for unused credentials
const creds = await n8n_manage_credentials({ action: "list" });
const workflows = await n8n_list_workflows();
// Cross-reference: which credentials are not used in any workflow?
Remediation SLA
| Severity | SLA | Action |
|---|---|---|
| Critical (exposed secrets) | 1 hour | Rotate immediately, revoke old |
| High (unauthenticated webhook) | 24 hours | Add authentication |
| Medium (missing error handling) | 7 days | Add error handling |
| Low (naming convention) | 30 days | Rename to convention |
Vault Integration Patterns
For enhanced security, reference external vaults via environment variables:
Pattern 1: Environment Variables
// In n8n configuration (docker-compose or .env)
// API_KEY=sk-from-vault
// In workflow expressions
// {{$env.API_KEY}}
// In credential data (if supported)
// Credential references $env values at runtime
Pattern 2: External Secret Operator (Kubernetes)
# ExternalSecret → n8n Secret → n8n Credential
# Vault rotates → Secret updates → n8n picks up new value
Pattern 3: Pre-workflow Secret Fetch
// Code node fetches secret from vault at runtime
// This avoids storing secrets in n8n at all
const secret = await $helpers.httpRequest({
url: 'https://vault.internal/v1/secret/data/api-key',
headers: { 'X-Vault-Token': $env.VAULT_TOKEN }
});
// Use secret.data.value for API calls
Best Practices
✅ Do
- Check existing credentials before creating new ones
- Use
getSchemabefore every create/update - Follow naming convention:
{env}-{service}-{purpose} - Audit credentials after every deploy
- Separate credentials by environment
- Document credential purpose and scope
- Set up rotation reminders for time-limited tokens
❌ Don't
- Hardcode secrets in workflow parameters
- Create duplicate credentials for same service
- Use admin/root-level credentials for app workflows
- Share credentials across dev/staging/prod
- Create credentials without schema validation
- Forget to verify creation with a list call
- Leave unused credentials active
Related Skills
- n8n-prd-discovery — Identifies credential needs during planning
- n8n-mcp-tools-expert — n8n_manage_credentials tool reference
- n8n-audit-compliance — Continuous credential auditing
- n8n-publish-gate — Verifies credentials before activation
- n8n-builder-orchestrator — Integrates credential checks into build flow
Summary
Credential Policy Workflow:
- Check existing → Don't create duplicates
- Schema first → Always getSchema before create
- Naming convention →
{env}-{service}-{purpose} - Least privilege → Minimum required permissions
- Environment separation → Never cross-pollinate
- Verify creation → List after create
- Audit regularly → Weekly full audit, post-deploy quick audit
- Rotate and revoke → Follow SLA by severity