agentleFS
G1JoshiG1Joshi/Agent-Skills/skills/security/vault/SKILL.md

vault

Skill15 starsChanged 42 days agoMITView on GitHub

Expert HashiCorp Vault assistance covering secret engines, dynamic secrets, transit encryption, and AppRole auth. Use when managing secrets, rotating database credentials, or securing cloud infrastructure.

11 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 10 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use Dynamic Database Credentials: Never share static database passwords across services.

    line 104

“Common” is measured: kept by at least 6 in 10 of the 10 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

HashiCorp Vault

Vault is a tool for securely accessing secrets. A secret is anything that you want to tightly control access to, such as API keys, passwords, or certificates. Vault provides a unified interface to any secret while providing tight access control and recording a detailed audit log.

When to Use

  • Centralized Secrets Management: Securely storing and accessing API keys, database credentials, certificates, and encryption keys.
  • Dynamic On-Demand Credentials: Generating short-lived, unique database credentials that expire automatically after task completion.
  • Data Encryption as a Service (Transit Engine): Encrypting sensitive data in transit and at rest without exposing cryptographic keys to applications.
  • PKI & Certificate Authority Automation: Issuing short-lived X.509 certificates for microservices and internal domains.

Quick Start

vault server -dev
export VAULT_ADDR='http://127.0.0.1:8200'

# Write a secret
vault kv put secret/hello foo=world

# Read a secret
vault kv get secret/hello

Core Concepts

Secret Engines & Path-Based Access

Vault organizes capabilities under hierarchical mount paths:

secret/data/my-app/config     -> Key-Value (KV v2) persistent secrets
database/creds/readonly-user  -> Dynamic on-demand temporary database roles
transit/encrypt/customer-pii  -> Encryption-as-a-Service without key export
pki/issue/internal-domain     -> Dynamic TLS certificate generation

Dynamic Database Credential Generation

Vault connects to PostgreSQL/MySQL and creates unique users on the fly with automatic lease expiration:

# Application requests temporary credentials
vault read database/creds/readonly-role

# Output:
# lease_id: database/creds/readonly-role/h712398
# lease_duration: 1h
# username: v-token-readonly-1727420400
# password: A1b2C3d4E5f6G7h8

Application Authentication via Kubernetes Auth

Applications running in Kubernetes authenticate using their native ServiceAccount tokens:

import vault from "node-vault";
import fs from "fs";

const jwt = fs.readFileSync(
  "/var/run/secrets/kubernetes.io/serviceaccount/token",
  "utf8",
);

const client = vault({ endpoint: "https://vault.internal.corp:8200" });
const result = await client.kubernetesLogin({
  role: "billing-service-role",
  jwt: jwt,
});

// Read secret using authenticated client token
client.token = result.auth.client_token;
const secret = await client.read("secret/data/billing/api-keys");
console.log("Stripe Secret:", secret.data.data.STRIPE_KEY);

Common Patterns

Dynamic PostgreSQL Database Credential Generation

Problem: Long-lived, shared database passwords hardcoded in application config leak over time.

Solution: Request short-lived dynamic credentials with automatic TTL revocation:

# Read dynamic database credentials with 1-hour lease
vault read database/creds/readonly-app

# Key-Value v2 secret read with JSON output
vault kv get -format=json secret/data/payments/stripe | jq '.data.data.api_key'

Best Practices

Do:

  • Use Dynamic Database Credentials: Never share static database passwords across services; let Vault issue short-lived credentials.
  • Authenticate via Cloud / Platform Identity: Use Kubernetes Auth, AWS IAM Auth, or Azure Managed Identity instead of static root tokens.
  • Enable Transit Secret Engine for Sensitive PII: Offload encryption and key rotation to Vault; keep private keys out of application memory.
  • Automate Lease Renewal: Ensure background tasks renew long-running leases or re-authenticate prior to token expiration.

Don't:

  • Store the Vault Root Token: Revoke the root token immediately after initial setup and cluster unsealing.
  • Disable TLS on the Vault API: Never communicate with Vault over unencrypted HTTP.
  • Grant broad wildcard policies: Follow least privilege; grant read access only to specific secret paths needed by each microservice.

Troubleshooting

ErrorCauseSolution
Error: Vault is sealedVault restarted or initialized without unsealing keys.Run vault operator unseal with threshold Shamir key shards or use auto-unseal.
permission denied (403)Token or AppRole policy lacks read permission on specific path.Inspect associated HCL policy and ensure path "secret/data/*" { capabilities = ["read"] } is granted.
token expired and cannot be renewedLease duration reached maximum TTL limit.Re-authenticate client AppRole to obtain a fresh token.

References

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.