[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79FG13YY2J10BBGFTGA6GRJ":3,"skill-same:01M79FG13YY2J10BBGFTGA6GRJ":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M79FG13YY2J10BBGFTGA6GRJ","hashicorp-vault-secret-management",null,"Enterprise secrets lifecycle management pattern using HashiCorp Vault. Enforces Zero-Trust access controls, dynamic database credential leasing, secret rotation engines, AppRole\u002FKubernetes authentication, and Vault Agent sidecar injection.","hamzabellouch\u002Fagent-skills","hamzabellouch","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F237856042?v=4","01M79BRYW7XAMK3YDWQEMTWGWS","Hamza Bellouch","01M79BRYWXQV3JK2TGVTX8GN2A",8,"MIT","https:\u002F\u002Fgithub.com\u002Fhamzabellouch\u002Fagent-skills\u002Fblob\u002Fmain\u002FSecurity\u002FDevSecOps_and_Supply_Chain_Security\u002Fhashicorp-vault-secret-management\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: hashicorp-vault-secret-management\ndescription: Enterprise secrets lifecycle management pattern using HashiCorp Vault. Enforces Zero-Trust access controls, dynamic database credential leasing, secret rotation engines, AppRole\u002FKubernetes authentication, and Vault Agent sidecar injection.\n---\n\n# HashiCorp Vault Secrets Management & Lifecycle Architecture\n\n## Overview\nThis skill provides production-grade templates, HCL policy configurations, and client SDK implementations for enterprise secret management via HashiCorp Vault. It eliminates static credentials through short-lived dynamic credentials, automated rotation engines, and identity-based access control.\n\n---\n\n## 1. Zero-Trust Secrets Architecture\n\n1. **Eliminate Static Long-Lived Secrets**: Move away from hardcoded API keys and static database passwords. Leverage Vault dynamic engines (AWS IAM, Database, PKI) that issue credentials with short Time-To-Live (TTL).\n2. **Strict Principle of Least Privilege (PoLP)**: Vault ACL policies must explicitly follow default-deny semantics. Path access is granted strictly based on workload identity (Kubernetes ServiceAccount, AWS IAM role, AppRole).\n3. **Automated Secret Leasing & Renewal**: Applications must handle lease expiration, dynamic token renewal, and graceful re-authentication without downtime.\n4. **Encryption in Transit & at Rest**: Force TLS 1.3 for all client communications; ensure Vault storage backends (Raft Integrated Storage) utilize AES-GCM 256-bit envelope encryption.\n\n---\n\n## 2. Dynamic Secret Rotation & Access Lifecycle\n\n```\n[ Application \u002F Pod ]\n      │  1. Authenticate via ServiceAccount \u002F AppRole\n      ▼\n[ Vault Server \u002F Agent ]\n      │  2. Issue short-lived Token (TTL: 1h)\n      │  3. Request Dynamic DB Credentials (TTL: 15m)\n      ▼\n[ Database Engine ] ──▶ Generates ephemeral user (e.g., v-approle-user-abc-123)\n```\n\n| Lifecycle Event | Mechanism | Standard TTL \u002F Frequency |\n| :--- | :--- | :--- |\n| **Authentication** | Kubernetes ServiceAccount \u002F AppRole | Token TTL: 1 Hour (Explicit Max TTL: 12 Hours) |\n| **KV-v2 Secrets** | Soft delete \u002F Versioning \u002F Metadata audit | Version retention: 10 versions max |\n| **Dynamic DB Passwords** | Vault DB Engine (`postgresql-database-plugin`) | Lease TTL: 15-30 Minutes; Auto-revoked on expiry |\n| **PKI TLS Certificates** | Vault PKI Secret Engine | Cert TTL: 24 Hours; Managed via Cert-Manager \u002F Vault Agent |\n\n---\n\n## 3. Anti-Patterns & Misconfigurations\n\n* **Anti-Pattern: Root Token Usage in Production**\n  * *Risk*: Total compromise of Vault cluster; unrevokable root privileges.\n  * *Remediation*: Revoke root tokens immediately after initial unseal & configuration setup.\n* **Anti-Pattern: Wildcard Path Permissions (`path \"secret\u002F*\" { capabilities = [\"sudo\", \"create\", \"read\", \"update\", \"delete\"] }`)**\n  * *Risk*: Over-privileged clients can read\u002Fmodify internal credentials of unrelated microservices.\n  * *Remediation*: Scope path rules tightly per environment and service name (`path \"secret\u002Fdata\u002Fproduction\u002Fpayment-service\u002F*\"`).\n* **Anti-Pattern: Static RoleID & SecretID in Code Repositories**\n  * *Risk*: Hardcoding AppRole credentials defeats zero-trust isolation.\n  * *Remediation*: Deliver SecretID via out-of-band push mechanism, Vault Agent auto-auth, or response wrapping.\n\n---\n\n## 4. Production Code Examples\n\n### A. Terraform HCL: Vault Engine, AppRole, & Dynamic Database Policy Setup (`main.tf`)\n\n```hcl\nterraform {\n  required_version = \">= 1.5.0\"\n  required_providers {\n    vault = {\n      source  = \"hashicorp\u002Fvault\"\n      version = \"~> 3.24.0\"\n    }\n  }\n}\n\nprovider \"vault\" {\n  address = \"https:\u002F\u002Fvault.internal.net:8200\"\n}\n\n# 1. Mount KV Secrets Engine v2\nresource \"vault_mount\" \"kvv2\" {\n  path        = \"secret\"\n  type        = \"kv-v2\"\n  description = \"Production Application Encrypted Secrets\"\n}\n\n# 2. Scope-Restricted Vault ACL Policy\nresource \"vault_policy\" \"payment_service_policy\" {\n  name   = \"payment-service-policy\"\n  policy = \u003C\u003CEOT\n# Read production payment service secrets\npath \"${vault_mount.kvv2.path}\u002Fdata\u002Fproduction\u002Fpayment-service\u002F*\" {\n  capabilities = [\"read\"]\n}\n\n# Read metadata for secret versions\npath \"${vault_mount.kvv2.path}\u002Fmetadata\u002Fproduction\u002Fpayment-service\u002F*\" {\n  capabilities = [\"list\", \"read\"]\n}\n\n# Issue dynamic PostgreSQL credentials\npath \"database\u002Fcreds\u002Fpayment-db-role\" {\n  capabilities = [\"read\"]\n}\nEOT\n}\n\n# 3. AppRole Authentication Configuration\nresource \"vault_auth_backend\" \"approle\" {\n  type = \"approle\"\n}\n\nresource \"vault_approle_auth_backend_role\" \"payment_approle\" {\n  backend        = vault_auth_backend.approle.path\n  role_name      = \"payment-service-role\"\n  token_policies = [vault_policy.payment_service_policy.name]\n  \n  token_ttl      = 3600\n  token_max_ttl  = 28800\n  secret_id_ttl  = 86400\n}\n\n# 4. PostgreSQL Dynamic Secrets Engine Setup\nresource \"vault_mount\" \"db\" {\n  path        = \"database\"\n  type        = \"database\"\n  description = \"Dynamic Database Credentials Engine\"\n}\n\nresource \"vault_database_secret_backend_connection\" \"postgres\" {\n  backend       = vault_mount.db.path\n  name          = \"postgresql\"\n  allowed_roles = [\"payment-db-role\"]\n\n  postgresql {\n    connection_url = \"postgresql:\u002F\u002F{{username}}:{{password}}@postgres.internal.net:5432\u002Fpayment_db?sslmode=verify-full\"\n    username       = \"vault_admin\"\n    password       = var.vault_db_admin_password\n  }\n}\n\nresource \"vault_database_secret_backend_role\" \"payment_db_role\" {\n  backend             = vault_mount.db.path\n  name                = \"payment-db-role\"\n  db_name             = vault_database_secret_backend_connection.postgres.name\n  creation_statements = [\n    \"CREATE ROLE \\\"{{name}}\\\" WITH LOGIN PASSWORD '{{password}}' VALID UNTIL '{{expiration}}';\",\n    \"GRANT SELECT, INSERT, UPDATE ON ALL TABLES IN SCHEMA public TO \\\"{{name}}\\\";\"\n  ]\n  default_ttl         = 1800 # 30 minutes\n  max_ttl             = 7200 # 2 hours\n}\n```\n\n---\n\n### B. Vault Agent Sidecar Configuration for Kubernetes (`vault-agent.hcl`)\n\n```hcl\nexit_after_auth = false\npid_file        = \"\u002Ftmp\u002Fvault-agent.pid\"\n\nauto_auth {\n  method \"kubernetes\" {\n    mount_path = \"auth\u002Fkubernetes\"\n    config = {\n      role = \"payment-service-role\"\n    }\n  }\n\n  sink \"file\" {\n    config = {\n      path = \"\u002Fvault\u002Fsecrets\u002F.vault-token\"\n      mode = 0600\n    }\n  }\n}\n\ntemplate {\n  destination = \"\u002Fvault\u002Fsecrets\u002Fdb-credentials.json\"\n  contents    = \u003C\u003CEOF\n{{- with secret \"database\u002Fcreds\u002Fpayment-db-role\" -}}\n{\n  \"db_user\": \"{{ .Data.username }}\",\n  \"db_password\": \"{{ .Data.password }}\",\n  \"lease_id\": \"{{ .LeaseID }}\",\n  \"lease_duration\": {{ .LeaseDuration }}\n}\n{{- end -}}\nEOF\n}\n```\n\n---\n\n### C. Python Application Integration: Auto-Renewal & Dynamic Secret Retrieval (`vault_client.py`)\n\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"\nProduction Vault Client with HVAC\nHandles AppRole Authentication, Dynamic Database Secret Fetching, and Background Lease Renewal.\n\"\"\"\n\nimport os\nimport time\nimport threading\nimport logging\nimport hvac\n\nlogging.basicConfig(level=logging.INFO, format=\"%(asctime)s [%(levelname)s] %(message)s\")\n\nclass VaultSecretManager:\n    def __init__(self, vault_url: str, role_id: str, secret_id: str):\n        self.vault_url = vault_url\n        self.role_id = role_id\n        self.secret_id = secret_id\n        self.client = hvac.Client(url=self.vault_url)\n        self.token_lease_renew_thread = None\n        self.running = True\n\n        self.authenticate()\n\n    def authenticate(self):\n        \"\"\"Authenticate using Vault AppRole.\"\"\"\n        logging.info(\"Authenticating with Vault via AppRole...\")\n        login_response = self.client.auth.approle.login(\n            role_id=self.role_id,\n            secret_id=self.secret_id\n        )\n        self.client.token = login_response['auth']['client_token']\n        auth_lease_duration = login_response['auth']['lease_duration']\n        \n        logging.info(\"Authentication successful. Token lease duration: %ss\", auth_lease_duration)\n        self._start_token_renewal_daemon(auth_lease_duration)\n\n    def _start_token_renewal_daemon(self, initial_ttl: int):\n        \"\"\"Background thread to keep Vault client token renewed.\"\"\"\n        def renew_loop():\n            while self.running:\n                sleep_time = max(10, initial_ttl \u002F\u002F 2)\n                time.sleep(sleep_time)\n                try:\n                    logging.info(\"Renewing Vault client token...\")\n                    renew_result = self.client.auth.token.renew_self()\n                    new_ttl = renew_result['auth']['lease_duration']\n                    logging.info(\"Token successfully renewed. New TTL: %ss\", new_ttl)\n                except Exception as err:\n                    logging.error(\"Failed to renew Vault token: %s\", err)\n                    # Attempt re-authentication\n                    self.authenticate()\n                    break\n\n        self.token_lease_renew_thread = threading.Thread(target=renew_loop, daemon=True)\n        self.token_lease_renew_thread.start()\n\n    def get_dynamic_database_credentials(self) -> dict:\n        \"\"\"Fetch short-lived dynamic PostgreSQL credentials.\"\"\"\n        logging.info(\"Requesting dynamic database credentials from Vault...\")\n        creds = self.client.secrets.database.generate_credentials(\n            name=\"payment-db-role\",\n            mount_point=\"database\"\n        )\n        \n        db_user = creds['data']['username']\n        db_pass = creds['data']['password']\n        lease_id = creds['lease_id']\n        lease_duration = creds['lease_duration']\n\n        logging.info(\"Obtained dynamic DB credentials for user '%s' (Lease TTL: %ss)\", db_user, lease_duration)\n        return {\n            \"username\": db_user,\n            \"password\": db_pass,\n            \"lease_id\": lease_id,\n            \"lease_duration\": lease_duration\n        }\n\n    def close(self):\n        self.running = False\n\nif __name__ == \"__main__\":\n    VAULT_ADDR = os.getenv(\"VAULT_ADDR\", \"https:\u002F\u002Fvault.internal.net:8200\")\n    ROLE_ID = os.getenv(\"VAULT_ROLE_ID\")\n    SECRET_ID = os.getenv(\"VAULT_SECRET_ID\")\n\n    if not ROLE_ID or not SECRET_ID:\n        logging.error(\"Missing VAULT_ROLE_ID or VAULT_SECRET_ID environment variables.\")\n        exit(1)\n\n    manager = VaultSecretManager(VAULT_ADDR, ROLE_ID, SECRET_ID)\n    db_credentials = manager.get_dynamic_database_credentials()\n    print(f\"Connecting to database with user: {db_credentials['username']}\")\n```\n","# HashiCorp Vault Secrets Management & Lifecycle Architecture\n\n## Overview\nThis skill provides production-grade templates, HCL policy configurations, and client SDK implementations for enterprise secret management via HashiCorp Vault. It eliminates static credentials through short-lived dynamic credentials, automated rotation engines, and identity-based access control.\n\n---\n\n## 1. Zero-Trust Secrets Architecture\n\n1. **Eliminate Static Long-Lived Secrets**: Move away from hardcoded API keys and static database passwords. Leverage Vault dynamic engines (AWS IAM, Database, PKI) that issue credentials with short Time-To-Live (TTL).\n2. **Strict Principle of Least Privilege (PoLP)**: Vault ACL policies must explicitly follow default-deny semantics. Path access is granted strictly based on workload identity (Kubernetes ServiceAccount, AWS IAM role, AppRole).\n3. **Automated Secret Leasing & Renewal**: Applications must handle lease expiration, dynamic token renewal, and graceful re-authentication without downtime.\n4. **Encryption in Transit & at Rest**: Force TLS 1.3 for all client communications; ensure Vault storage backends (Raft Integrated Storage) utilize AES-GCM 256-bit envelope encryption.\n\n---\n\n## 2. Dynamic Secret Rotation & Access Lifecycle\n\n```\n[ Application \u002F Pod ]\n      │  1. Authenticate via ServiceAccount \u002F AppRole\n      ▼\n[ Vault Server \u002F Agent ]\n      │  2. Issue short-lived Token (TTL: 1h)\n      │  3. Request Dynamic DB Credentials (TTL: 15m)\n      ▼\n[ Database Engine ] ──▶ Generates ephemeral user (e.g., v-approle-user-abc-123)\n```\n\n| Lifecycle Event | Mechanism | Standard TTL \u002F Frequency |\n| :--- | :--- | :--- |\n| **Authentication** | Kubernetes ServiceAccount \u002F AppRole | Token TTL: 1 Hour (Explicit Max TTL: 12 Hours) |\n| **KV-v2 Secrets** | Soft delete \u002F Versioning \u002F Metadata audit | Version retention: 10 versions max |\n| **Dynamic DB Passwords** | Vault DB Engine (`postgresql-database-plugin`) | Lease TTL: 15-30 Minutes; Auto-revoked on expiry |\n| **PKI TLS Certificates** | Vault PKI Secret Engine | Cert TTL: 24 Hours; Managed via Cert-Manager \u002F Vault Agent |\n\n---\n\n## 3. Anti-Patterns & Misconfigurations\n\n* **Anti-Pattern: Root Token Usage in Production**\n  * *Risk*: Total compromise of Vault cluster; unrevokable root privileges.\n  * *Remediation*: Revoke root tokens immediately after initial unseal & configuration setup.\n* **Anti-Pattern: Wildcard Path Permissions (`path \"secret\u002F*\" { capabilities = [\"sudo\", \"create\", \"read\", \"update\", \"delete\"] }`)**\n  * *Risk*: Over-privileged clients can read\u002Fmodify internal credentials of unrelated microservices.\n  * *Remediation*: Scope path rules tightly per environment and service name (`path \"secret\u002Fdata\u002Fproduction\u002Fpayment-service\u002F*\"`).\n* **Anti-Pattern: Static RoleID & SecretID in Code Repositories**\n  * *Risk*: Hardcoding AppRole credentials defeats zero-trust isolation.\n  * *Remediation*: Deliver SecretID via out-of-band push mechanism, Vault Agent auto-auth, or response wrapping.\n\n---\n\n## 4. Production Code Examples\n\n### A. Terraform HCL: Vault Engine, AppRole, & Dynamic Database Policy Setup (`main.tf`)\n\n```hcl\nterraform {\n  required_version = \">= 1.5.0\"\n  required_providers {\n    vault = {\n      source  = \"hashicorp\u002Fvault\"\n      version = \"~> 3.24.0\"\n    }\n  }\n}\n\nprovider \"vault\" {\n  address = \"https:\u002F\u002Fvault.internal.net:8200\"\n}\n\n# 1. Mount KV Secrets Engine v2\nresource \"vault_mount\" \"kvv2\" {\n  path        = \"secret\"\n  type        = \"kv-v2\"\n  description = \"Production Application Encrypted Secrets\"\n}\n\n# 2. Scope-Restricted Vault ACL Policy\nresource \"vault_policy\" \"payment_service_policy\" {\n  name   = \"payment-service-policy\"\n  policy = \u003C\u003CEOT\n# Read production payment service secrets\npath \"${vault_mount.kvv2.path}\u002Fdata\u002Fproduction\u002Fpayment-service\u002F*\" {\n  capabilities = [\"read\"]\n}\n\n# Read metadata for secret versions\npath \"${vault_mount.kvv2.path}\u002Fmetadata\u002Fproduction\u002Fpayment-service\u002F*\" {\n  capabilities = [\"list\", \"read\"]\n}\n\n# Issue dynamic PostgreSQL credentials\npath \"database\u002Fcreds\u002Fpayment-db-role\" {\n  capabilities = [\"read\"]\n}\nEOT\n}\n\n# 3. AppRole Authentication Configuration\nresource \"vault_auth_backend\" \"approle\" {\n  type = \"approle\"\n}\n\nresource \"vault_approle_auth_backend_role\" \"payment_approle\" {\n  backend        = vault_auth_backend.approle.path\n  role_name      = \"payment-service-role\"\n  token_policies = [vault_policy.payment_service_policy.name]\n  \n  token_ttl      = 3600\n  token_max_ttl  = 28800\n  secret_id_ttl  = 86400\n}\n\n# 4. PostgreSQL Dynamic Secrets Engine Setup\nresource \"vault_mount\" \"db\" {\n  path        = \"database\"\n  type        = \"database\"\n  description = \"Dynamic Database Credentials Engine\"\n}\n\nresource \"vault_database_secret_backend_connection\" \"postgres\" {\n  backend       = vault_mount.db.path\n  name          = \"postgresql\"\n  allowed_roles = [\"payment-db-role\"]\n\n  postgresql {\n    connection_url = \"postgresql:\u002F\u002F{{username}}:{{password}}@postgres.internal.net:5432\u002Fpayment_db?sslmode=verify-full\"\n    username       = \"vault_admin\"\n    password       = var.vault_db_admin_password\n  }\n}\n\nresource \"vault_database_secret_backend_role\" \"payment_db_role\" {\n  backend             = vault_mount.db.path\n  name                = \"payment-db-role\"\n  db_name             = vault_database_secret_backend_connection.postgres.name\n  creation_statements = [\n    \"CREATE ROLE \\\"{{name}}\\\" WITH LOGIN PASSWORD '{{password}}' VALID UNTIL '{{expiration}}';\",\n    \"GRANT SELECT, INSERT, UPDATE ON ALL TABLES IN SCHEMA public TO \\\"{{name}}\\\";\"\n  ]\n  default_ttl         = 1800 # 30 minutes\n  max_ttl             = 7200 # 2 hours\n}\n```\n\n---\n\n### B. Vault Agent Sidecar Configuration for Kubernetes (`vault-agent.hcl`)\n\n```hcl\nexit_after_auth = false\npid_file        = \"\u002Ftmp\u002Fvault-agent.pid\"\n\nauto_auth {\n  method \"kubernetes\" {\n    mount_path = \"auth\u002Fkubernetes\"\n    config = {\n      role = \"payment-service-role\"\n    }\n  }\n\n  sink \"file\" {\n    config = {\n      path = \"\u002Fvault\u002Fsecrets\u002F.vault-token\"\n      mode = 0600\n    }\n  }\n}\n\ntemplate {\n  destination = \"\u002Fvault\u002Fsecrets\u002Fdb-credentials.json\"\n  contents    = \u003C\u003CEOF\n{{- with secret \"database\u002Fcreds\u002Fpayment-db-role\" -}}\n{\n  \"db_user\": \"{{ .Data.username }}\",\n  \"db_password\": \"{{ .Data.password }}\",\n  \"lease_id\": \"{{ .LeaseID }}\",\n  \"lease_duration\": {{ .LeaseDuration }}\n}\n{{- end -}}\nEOF\n}\n```\n\n---\n\n### C. Python Application Integration: Auto-Renewal & Dynamic Secret Retrieval (`vault_client.py`)\n\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"\nProduction Vault Client with HVAC\nHandles AppRole Authentication, Dynamic Database Secret Fetching, and Background Lease Renewal.\n\"\"\"\n\nimport os\nimport time\nimport threading\nimport logging\nimport hvac\n\nlogging.basicConfig(level=logging.INFO, format=\"%(asctime)s [%(levelname)s] %(message)s\")\n\nclass VaultSecretManager:\n    def __init__(self, vault_url: str, role_id: str, secret_id: str):\n        self.vault_url = vault_url\n        self.role_id = role_id\n        self.secret_id = secret_id\n        self.client = hvac.Client(url=self.vault_url)\n        self.token_lease_renew_thread = None\n        self.running = True\n\n        self.authenticate()\n\n    def authenticate(self):\n        \"\"\"Authenticate using Vault AppRole.\"\"\"\n        logging.info(\"Authenticating with Vault via AppRole...\")\n        login_response = self.client.auth.approle.login(\n            role_id=self.role_id,\n            secret_id=self.secret_id\n        )\n        self.client.token = login_response['auth']['client_token']\n        auth_lease_duration = login_response['auth']['lease_duration']\n        \n        logging.info(\"Authentication successful. Token lease duration: %ss\", auth_lease_duration)\n        self._start_token_renewal_daemon(auth_lease_duration)\n\n    def _start_token_renewal_daemon(self, initial_ttl: int):\n        \"\"\"Background thread to keep Vault client token renewed.\"\"\"\n        def renew_loop():\n            while self.running:\n                sleep_time = max(10, initial_ttl \u002F\u002F 2)\n                time.sleep(sleep_time)\n                try:\n                    logging.info(\"Renewing Vault client token...\")\n                    renew_result = self.client.auth.token.renew_self()\n                    new_ttl = renew_result['auth']['lease_duration']\n                    logging.info(\"Token successfully renewed. New TTL: %ss\", new_ttl)\n                except Exception as err:\n                    logging.error(\"Failed to renew Vault token: %s\", err)\n                    # Attempt re-authentication\n                    self.authenticate()\n                    break\n\n        self.token_lease_renew_thread = threading.Thread(target=renew_loop, daemon=True)\n        self.token_lease_renew_thread.start()\n\n    def get_dynamic_database_credentials(self) -> dict:\n        \"\"\"Fetch short-lived dynamic PostgreSQL credentials.\"\"\"\n        logging.info(\"Requesting dynamic database credentials from Vault...\")\n        creds = self.client.secrets.database.generate_credentials(\n            name=\"payment-db-role\",\n            mount_point=\"database\"\n        )\n        \n        db_user = creds['data']['username']\n        db_pass = creds['data']['password']\n        lease_id = creds['lease_id']\n        lease_duration = creds['lease_duration']\n\n        logging.info(\"Obtained dynamic DB credentials for user '%s' (Lease TTL: %ss)\", db_user, lease_duration)\n        return {\n            \"username\": db_user,\n            \"password\": db_pass,\n            \"lease_id\": lease_id,\n            \"lease_duration\": lease_duration\n        }\n\n    def close(self):\n        self.running = False\n\nif __name__ == \"__main__\":\n    VAULT_ADDR = os.getenv(\"VAULT_ADDR\", \"https:\u002F\u002Fvault.internal.net:8200\")\n    ROLE_ID = os.getenv(\"VAULT_ROLE_ID\")\n    SECRET_ID = os.getenv(\"VAULT_SECRET_ID\")\n\n    if not ROLE_ID or not SECRET_ID:\n        logging.error(\"Missing VAULT_ROLE_ID or VAULT_SECRET_ID environment variables.\")\n        exit(1)\n\n    manager = VaultSecretManager(VAULT_ADDR, ROLE_ID, SECRET_ID)\n    db_credentials = manager.get_dynamic_database_credentials()\n    print(f\"Connecting to database with user: {db_credentials['username']}\")\n```\n",{"name":5,"description":7},"main","e905af21e5f1e1c3ca605e9656c3a7930360a84e","Security\u002FDevSecOps_and_Supply_Chain_Security\u002Fhashicorp-vault-secret-management",1,"https:\u002F\u002Fgithub.com\u002Fhamzabellouch\u002Fagent-skills","https:\u002F\u002Fhamzabellouch.github.io\u002F","https:\u002F\u002Fgithub.com\u002Fhamzabellouch","hamzabellouch.github.io","CEO & Founder of @tknoglobal | Researcher in Technology & Applied Sciences.","2026-10-17 03:20:19",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add hamzabellouch\u002Fagent-skills --skill hashicorp-vault-secret-management",{"tool":40,"command":41},"bunx","bunx skills add hamzabellouch\u002Fagent-skills --skill hashicorp-vault-secret-management",{"tool":43,"command":44},"pnpm","pnpm dlx skills add hamzabellouch\u002Fagent-skills --skill hashicorp-vault-secret-management","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fhamzabellouch\u002Fagent-skills\u002Fblob\u002Fmain\u002FSecurity\u002FDevSecOps_and_Supply_Chain_Security\u002Fhashicorp-vault-secret-management\u002FSKILL.md",true,[],[49,56,63,70,77,84],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":19},"01M79FHH2H815A9TAP6WNKH4Q8","security-audit","Comprehensive security guidance, source code audit, vulnerability assessment, and penetration test review for codebases, APIs, microservices, CLI tools, libraries, and LLM-backed applications. Triggers on requests to audit a codebase, conduct security reviews, find vulnerabilities or flaws, pen-test source code, or when the user asks in Arabic (فحص أمني، تدقيق الكود أمنياً، مراجعة الثغرات، فحص أمان المشروع). Supports Guidance mode (focused review) and Full Audit mode (deterministic 6-phase harness).","https:\u002F\u002Fgithub.com\u002Fhamzabellouch\u002Fagent-skills\u002Fblob\u002Fmain\u002FSecurity\u002FSecurity_Audit_and_Code_Review\u002Fsecurity-audit\u002FSKILL.md",[],[],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M79FHBGXVBY6VQ1X7ETAZMF1","malware-analysis-reversing","Production malware analysis workflows, reverse engineering methodologies, isolated sandbox triage, static\u002Fdynamic binary analysis, memory forensics, and YARA detection rule authoring.","https:\u002F\u002Fgithub.com\u002Fhamzabellouch\u002Fagent-skills\u002Fblob\u002Fmain\u002FSecurity\u002FOffensive_Security_and_Pentesting\u002Fmalware-analysis-reversing\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M79FH6EACDR801TZCE4R8SAC","application-security-pentesting","Production Application Security (AppSec) standards, OWASP Top 10 vulnerability remediation, SAST\u002FDAST pipeline integration, secure code review, threat modeling, and defensive security posture.","https:\u002F\u002Fgithub.com\u002Fhamzabellouch\u002Fagent-skills\u002Fblob\u002Fmain\u002FSecurity\u002FOffensive_Security_and_Pentesting\u002Fapplication-security-pentesting\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M79FH0VKVT44FK923K520ZQA","oauth2-oidc-security-flows","Implement enterprise OAuth 2.1 and OpenID Connect (OIDC) authorization code flow with Proof Key for Code Exchange (PKCE), state and nonce verification, refresh token rotation, token revocation, and centralized IdP federation (Keycloak, Auth0, Okta). Trigger when building secure authentication, single sign-on (SSO), or third-party delegated authorization.","https:\u002F\u002Fgithub.com\u002Fhamzabellouch\u002Fagent-skills\u002Fblob\u002Fmain\u002FSecurity\u002FIdentity_and_Access_Management_IAM\u002Foauth2-oidc-security-flows\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M79FGVVB3R4T88XXD8FRSV5B","jwt-session-management-hardening","Harden JWT-based authentication and session lifecycles using asymmetric signing (RS256\u002FEdDSA), JWKS rotation, strict claims validation, Redis-backed sliding window sessions, revocation lists, and secure HttpOnly cookie storage. Trigger when implementing token validation, session revocation, or hardening API authentication.","https:\u002F\u002Fgithub.com\u002Fhamzabellouch\u002Fagent-skills\u002Fblob\u002Fmain\u002FSecurity\u002FIdentity_and_Access_Management_IAM\u002Fjwt-session-management-hardening\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M79FGNCPZ85CVEY0B3NE4H3B","soc2-compliance-automation","Best practices for implementing SOC 2 Type II compliance controls, continuous evidence collection, infrastructure policy-as-code, and automated security monitoring. Use when automating Trust Services Criteria (Security, Availability, Confidentiality, Processing Integrity, Privacy), audit logging, IAM least privilege, or CI\u002FCD security gates.","https:\u002F\u002Fgithub.com\u002Fhamzabellouch\u002Fagent-skills\u002Fblob\u002Fmain\u002FSecurity\u002FGovernance_Compliance_and_Legal_Tech\u002Fsoc2-compliance-automation\u002FSKILL.md",[],[]]