InterviewHubPRO
Section Overview
Q48

Question 48 of 50

Part 5: API Security, DevSecOps & Enterprise Incident Handling (43 - 50)

96%
Web Security & OWASP (50 Qs)•Part 5: API Security, DevSecOps & Enterprise Incident Handling (43 - 50)

Enterprise Secrets Management: Zero-Secret-Leak architectures and dynamic credentials with Vault.

Eliminating Static Credentials

Hardcoding secrets (database passwords, API keys, private keys) in source code or Git history is the single most common cause of enterprise security breaches. Once committed, a secret must be assumed compromised even if the repository is private.

sql
Legacy Anti-Pattern (Vulnerable):
- Storing passwords in .env files committed to git.
- Storing static AWS root credentials in CI repository secrets.

Modern Dynamic Secrets Architecture (HashiCorp Vault):
[ Microservice / Pod ]
           | 1. Authenticates via Kubernetes ServiceAccount Token
           v
[ HashiCorp Vault ]
           | 2. Talks to PostgreSQL Engine
           v
[ PostgreSQL ] ---> Generates dynamic user: "v-token-123", valid for 60 MINUTES!
           |
[ Microservice ] <--- Receives ephemeral credentials with automatic lease renewal.

Secret Leak Prevention Guardrails

  1. Pre-Commit Git Hooks: Run Gitleaks locally so that git commit is physically blocked if regex patterns detect an AWS Access Key or private RSA key.
  2. Git History Scrubbing: If a secret is accidentally pushed, immediate action is required:
    • First, rotate the secret immediately in the target service.
    • Second, scrub Git history using BFG Repo-Cleaner or git-filter-repo (simply deleting the line in a new commit leaves the secret permanently in Git history).