agentsclimarketplace

N8n credential policy

Skill gabrielrdga/n8n-skills/skills/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

Install
npx -y skills add gabrielrdga/n8n-skills --skill n8n-credential-policy

Assembled 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

  1. Least Privilege — Create credentials with minimum required permissions
  2. Reuse Over Create — Check existing credentials before creating new ones
  3. Schema First — Always validate schema before creation
  4. Audit Trail — Log all credential operations with justification
  5. 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?

ServiceOver-Scoped ❌Right-Scoped ✅
SlackFull admin accessBot with channels:read, chat:write
GitHubFull repo accessRead-only for specific repo
AWSAdministratorSpecific IAM role with policy
DatabaseRoot/admin userApp-specific user with table permissions

3. Is the Classification Correct?

ClassificationDescriptionHandling
publicNon-sensitive (public API, no auth)Standard handling
internalInternal service credentialsEncrypt at rest
confidentialCustomer data accessEncrypt + access log
restrictedPayment, PII, admin accessEncrypt + 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

EnvironmentCredential SourceAuto-CreateActivation
DevelopmentCan use test values✅ YesAuto
StagingMust use real (but limited)⚠️ ReviewAuto
ProductionMust use production tokens❌ Approval RequiredManual

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

EventAudit Type
After workflow deployQuick audit: secrets, auth
Weekly (automated)Full audit: all credentials
After security incidentDeep scan: all workflows + credentials
Before compliance reviewComprehensive: 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

SeveritySLAAction
Critical (exposed secrets)1 hourRotate immediately, revoke old
High (unauthenticated webhook)24 hoursAdd authentication
Medium (missing error handling)7 daysAdd error handling
Low (naming convention)30 daysRename 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 getSchema before 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:

  1. Check existing → Don't create duplicates
  2. Schema first → Always getSchema before create
  3. Naming convention → {env}-{service}-{purpose}
  4. Least privilege → Minimum required permissions
  5. Environment separation → Never cross-pollinate
  6. Verify creation → List after create
  7. Audit regularly → Weekly full audit, post-deploy quick audit
  8. Rotate and revoke → Follow SLA by severity

Keep looking

Skills are one crate of 607,533. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.