Join our Newsletter — 33% off our NHI Course
Home› Guides› Secrets Management Myths and Facts: Vaults, Env Vars…
Guide Secrets Management

Secrets Management Myths and Facts: Vaults, Env Vars and Private Repos

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 27 November 2026 13 min read
On this page

Most secrets incidents trace back to a belief that sounded reasonable at the time: the repo is private, the variable is only in the environment, the vault has it covered. This guide takes the myths that developers, DevOps engineers and engineering managers repeat most often and sets each one against what the primary sources actually say, from the OWASP Secrets Management Cheat Sheet to the Kubernetes, Docker, GitHub and Linux documentation. Every fact is tied to a source you can check. It is not a list of mistakes or a vault tutorial: for the full discipline, read the Secrets Management Guide alongside it.

Key takeaways

  • Private is an access setting, not a control. Anyone, or any token, that can read a private repository can read every secret in its history, and stolen OAuth tokens have been used to clone private repositories looking for exactly that.
  • Environment variables are a delivery method, not a store. OWASP lists them as the last resort of three injection methods because they are visible to other processes and end up in logs and dumps.
  • Encoding and encryption at rest are not the same as access control. Kubernetes Secrets are base64 encoded and, by default, stored unencrypted in etcd; anyone who can create a Pod in the namespace can read them.
  • A vault moves the problem, it does not end it. Workloads still need a way to authenticate to the vault (the secret zero problem), and the vault itself becomes a high value system to protect.
  • Rotation, deletion and scanning each solve one part. A leaked credential stays valid until it is revoked; deleting the commit or restarting the app does not revoke anything, and scanners only find the patterns they know.

Why myths persist

Secrets myths survive because each one is half true. A private repository really does keep strangers out. An environment variable really is better than a literal in source code. A vault really does centralise storage and logging. The myth is the step from "better" to "safe", and it usually goes unnoticed because the failure only shows up when a second control fails: a token is stolen, a laptop is compromised, a log is shipped to a third party.

Three forces keep the myths alive:

  • Tooling defaults: frameworks and the Twelve-Factor App guidance popularised storing config, including credentials, in environment variables, and many teams read that as a complete security answer, although its aim is to keep config separate from code.
  • Invisible blast radius: nobody sees who can read a repository's full history, which CI jobs inherit a variable, or which roles can create Pods, so the exposure is never weighed.
  • Checkbox thinking: "we bought a vault" or "we turned on scanning" ends the conversation before anyone asks how workloads authenticate, who holds the root credential, or what the scanner misses.

The OWASP Non-Human Identities Top 10 (2025) puts Secret Leakage at NHI2 and Long-Lived Secrets at NHI7, which is a good reminder that these are not edge cases. See the OWASP NHI Top 10 NHI2 Secret Leakage Guide.

Myths about storage (private repos, env vars, encrypted files)

MythFactSource
"Our repository is private, so a key in it is safe."Every reader of the repository, every clone and every integration token with read access can see the full history. In the GitHub OAuth Token Breach 2022, stolen tokens were used to clone private repositories, and a live AWS key found in one was then used against production.GitHub Docs; NHI Mgmt Group breach analysis
"We deleted the commit, so the secret is gone."GitHub's guidance is to revoke or rotate the secret first. After a history rewrite the data can still exist in other users' clones, forks and cached views, and refs/pull/ references are read only and need GitHub Support to remove.GitHub Docs: Removing sensitive data
"Environment variables are secure."OWASP describes environment variables as generally accessible to all processes and liable to appear in logs or system dumps, and recommends them only when file or in-memory injection is not possible. On Linux, a process's initial environment is readable through /proc/[pid]/environ to anyone who passes a ptrace read check.OWASP Cheat Sheet 5.1; Linux man page proc_pid_environ(5)
"Passing the key as a Docker build ARG or ENV is fine."Docker's own build check states that secrets set with ENV or ARG persist in the final image. Use build secret mounts instead.Docker Docs: SecretsUsedInArgOrEnv
"Kubernetes Secrets are encrypted."Values are base64 encoded, which the Kubernetes docs say does not provide any useful level of confidentiality. Secrets are stored unencrypted in etcd by default, and anyone authorised to create a Pod (or a Deployment) in a namespace can read any Secret in it.Kubernetes Docs: Secrets
"The secrets file is encrypted, so we can commit it."Committing asymmetrically encrypted secrets is a recognised GitOps pattern, but only when the decryption key lives elsewhere. OWASP states you should not store keys next to the secrets they encrypt, and recommends environment specific keys.OWASP Cheat Sheet 3.6 and 7.3

What to do instead:

Myths about vaults and rotation

MythFactSource
"Once we have a vault, secrets management is solved."A vault centralises storage, access policy and audit. Workloads still have to authenticate to it, and OWASP notes the primary secret of a secrets manager must itself be secured in a second system. OWASP also advises avoiding static bootstrap credentials by using short-lived OIDC tokens and workload identity federation.OWASP Cheat Sheet 2.2 and 3.2.2
"The vault is encrypted, so a breach of the platform holding our secrets cannot expose them."Encryption at rest protects disks and backups, not a running system. In the CircleCI Breach 2023, data encrypted at rest was exposed because encryption keys were extracted from a running process, and customers were told to rotate every stored secret.NHI Mgmt Group breach analysis
"Rotating regularly means a leak does not matter."Rotation limits how long a stolen credential is useful; until the next rotation, it works. OWASP recommends automated rotation and dynamic secrets with short leases, and notes that restarting the application does not itself revoke stolen credentials.OWASP Cheat Sheet 2.4 and 2.7.2
"Every secret should be rotated on the same schedule, passwords included."OWASP excludes user credentials from regular rotation, following NIST guidance that they be changed on suspected compromise. Machine secrets and keys need lifetimes set by risk and usage, and NIST SP 800-57 Part 1 Rev. 5 is the reference for cryptographic key management.OWASP Cheat Sheet 2.7.2; NIST SP 800-57 Part 1 Rev. 5
"Dynamic secrets mean there are no static secrets left."OWASP notes that creating dynamic secrets often requires a long-term static secret, for example the credential the vault uses to create database users. That credential needs its own protection and rotation.OWASP Cheat Sheet 6.2
"Rotation is safe to automate blindly."OWASP's rotation example validates the current and pending credentials and tests the pending one before promoting it. Untested rotation is a common cause of outages, which is why teams then switch it off.OWASP Cheat Sheet 2.4.1

The bootstrap question is the one most often skipped. Read the Secrets Zero Problem Guide before choosing how workloads reach the vault, and the Securing the secrets manager itself page for the controls around the vault. For the difference between shortening lifetimes and killing a credential, see Secret Rotation vs Revocation.

Myths about scanning and detection

  • Myth: "Secret scanning catches everything." Fact: GitHub's push protection covers defined categories (partner patterns, generic patterns you enable, custom patterns and, in public preview, AI detected generic secrets) and the documentation makes no claim of complete coverage. OWASP recommends combining tools and balancing entropy and pattern based detection. See the Secret Scanner Rule Coverage Comparison Guide.
  • Myth: "Push protection means nothing can be pushed." Fact: by default anyone with write access can bypass push protection by giving a reason. Bypasses raise alerts and audit log entries, and delegated bypass restricts who may approve. Review bypasses, do not just count blocks. See the Push Protection Guide.
  • Myth: "Scanning the main branch is enough." Fact: GitHub secret scanning covers the entire Git history on all branches, plus issues, pull request descriptions and comments, discussions and wikis, because that is where secrets actually land. Your own tooling should match that scope.
  • Myth: "Scanning private repositories is free and automatic." Fact: on GitHub, secret scanning runs automatically for free on public repositories; private and internal organisation repositories need GitHub Secret Protection on GitHub Team or Enterprise Cloud. Check what is actually switched on.
  • Myth: "If the vault logs access, we will notice misuse." Fact: logs only help if someone reads them. OWASP lists minimum audit events (requests, approvals, usage, expiry, reuse of expired secrets, authentication errors, administrative actions), tamper resistant storage and alerts on anomalous retrieval. See Secrets Access Logging and Detection.

Myths about NHIs and AI agents

  • Myth: "A service account is just configuration." Fact: an API key, token or client secret is the identity of a workload. Treat it as an identity with an owner, scope and lifecycle; the OWASP NHI Top 10 lists improper offboarding (NHI1) and overprivileged NHI (NHI5) beside leakage. See the Non-Human Identity (NHI) Guide.
  • Myth: "Putting the key in the system prompt is fine because users cannot see it." Fact: the OWASP Top 10 for LLM Applications 2025 (LLM07 System Prompt Leakage) says the system prompt should not be considered a secret and that credentials and connection strings should not be in it; externalise them to systems the model does not directly access. See Secrets in Prompts.
  • Myth: "Agents need long-lived keys because they run unattended." Fact: unattended does not mean static. OWASP's CI/CD guidance on short-lived OIDC tokens and platform identities applies equally to agent runtimes: issue job scoped credentials and keep caller attribution. See the Workload Identity Federation Guide.
  • Myth: "The vault login is the only secret our pipeline holds." Fact: OWASP recommends keeping runtime secrets out of the pipeline entirely, with the deployed service using a platform identity to fetch its own secrets, and least privilege CI/CD service accounts.

What good looks like

Replacing myths with practice is a sequence, not a purchase. A workable order for most teams:

  1. Inventory and own: list every secret by system, owner, consumer, scope and age. Without an owner there is no one to rotate or revoke it.
  2. Stop new leaks: enable pre-commit or IDE detection and push protection with reviewed bypasses, and scan history, issues and CI logs, not just the default branch.
  3. Revoke what is exposed: for every confirmed historical leak, revoke or rotate first, then clean history. Test the replacement before cutting over.
  4. Centralise storage: move secrets into a secrets manager with per workload policies, audit logging and alerts, and protect its own root and break-glass credentials in a second system, tested regularly.
  5. Remove static bootstrap credentials: use workload identity federation or platform identity so workloads authenticate without a stored secret wherever the platform supports it.
  6. Shorten lifetimes: automate rotation with validation and a rollback path, and use dynamic secrets with short leases where the target system supports them. See the Dynamic Secrets and Ephemeral Credentials Guide.
  7. Measure: track the metrics below every month and report them to engineering leadership.

Small teams can usually do steps 1 to 3 in weeks with built-in platform features. Larger organisations should pilot steps 4 to 6 with one product team, prove rotation without outages, then roll out by platform.

Metrics that show the myths are gone in practice:

  • Secrets in code: open secret scanning alerts on all branches and history, with mean time to revoke.
  • Bypass rate: push protection bypasses per month and the share reviewed.
  • Static credential share: percentage of workloads still authenticating with a stored long-lived secret.
  • Secret age: share of machine secrets older than their target lifetime.
  • Ownership: percentage of secrets with a named owner and rotation method, as OWASP section 8.4 asks you to document.

Where these practices sit in common frameworks:

FrameworkReferenceRelevance
NIST CSF 2.0PR.AA-01Identities and credentials for users, services and hardware are managed
NIST CSF 2.0PR.DS-01Data at rest protected, including stored secrets
NIST SP 800-53 Rev. 5IA-5 Authenticator ManagementLifecycle, protection and change of authenticators
NIST SP 800-53 Rev. 5SC-12, SC-28Key establishment and management; protection of information at rest
MITRE ATT&CKT1552.001 Credentials In Files, T1552.004 Private KeysTechniques that exploit secrets left in repositories, files and images
MITRE ATT&CKT1528 Steal Application Access TokenTheft of tokens such as OAuth grants used to reach private code
OWASP NHI Top 10 2025NHI2 Secret Leakage, NHI7 Long-Lived SecretsThe two risks most of these myths feed

Practitioner checklist

  • Treat any secret ever committed to any repository, private or public, as exposed and revoke it.
  • Confirm secret scanning and push protection are enabled for private and internal repositories, not only public ones.
  • Review every push protection bypass and restrict who can approve them.
  • Remove secrets from Dockerfile ARG and ENV and use build secret mounts.
  • Enable Kubernetes encryption at rest and audit who can list Secrets or create Pods in each namespace.
  • Prefer file or in-memory delivery over environment variables, and keep secrets out of logs and crash dumps.
  • Document how each workload authenticates to the vault and remove static bootstrap credentials where federation is available.
  • Protect the vault's own root and break-glass credentials in a separate system and test them.
  • Test rotation with validation and rollback before scheduling it.
  • Keep credentials out of LLM system prompts and agent context; broker them at runtime instead.

Standards and references

Related NHI Mgmt Group resources: Secrets Management Guide · Secrets Zero Problem Guide · GitHub OAuth Token Breach 2022 · CircleCI Breach 2023 · Environment Variables vs Secrets Manager

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.