Safeguard
Security Guides•

Where do command line tools store your credentials on a laptop?

AWS, GitHub, Docker and Kubernetes tools each keep credentials in known files or credential stores. Know the places so you can review and clean them.

Safeguard Security Team
3 min read

Command line tools keep credentials in a mix of plain files in your home directory and operating system credential stores. The AWS CLI uses plaintext config and credentials files, the GitHub CLI prefers a credential store but can fall back to a plain text file, and Docker falls back to a base64 encoded config.json when no store is set.

Why this belongs in a tooling post

Any program you run as yourself can read files in your home directory. That includes a poisoned editor extension, a malicious package install script, or a compromised global tool. So the question "what is lying around in my home folder" is the same question as "what would an attacker get if one tool on this laptop went bad". Our post on what to rotate after each attack class starts from the same idea.

Four tools, four behaviours

ToolWhere credentials live, per its documentationNotes
AWS CLIconfig and credentials files, described as plaintext files; SSO tokens cached under ~/.aws/sso/cacheShort-term credentials can appear in the credentials file
GitHub CLIsystem credential store after browser login; falls back to a plain text file if no store is foundgh auth status shows the stored location
Dockerthe configured credential store; Docker Desktop uses the OS keychainWithout a store, config.json holds base64 encoded credentials, which Docker calls less secure
kubectldefault kubeconfig at $HOME/.kube/config, or files listed in KUBECONFIGkubectl config view shows the merged result

Each of these facts comes from the tool's own documentation, listed below. Behaviour can change between versions, so confirm on your own machine.

How to review your own laptop

  1. Open the AWS config and credentials files and look for long-lived access keys. Prefer short-lived sign-in methods where your organisation supports them.
  2. Run gh auth status and note where the token is kept. If it says a plain text file, consider fixing the credential store.
  3. Open the Docker config.json. If it holds an auth entry, set up a credential store or helper.
  4. Run kubectl config view and delete contexts for clusters you no longer use.
  5. Look for tokens in shell profile files and project env files. Our post on how developers get secrets on laptops lists safer patterns.

What a good state looks like

  • Few long-lived credentials, each with the narrowest scope that does the job.
  • Credential stores in use, not plain files, wherever the tool supports it.
  • Nothing for projects you finished last year.
  • A written list of where each credential came from, so rotation is possible.

When a tool goes bad

If you install something that turns out to be malicious, assume what the account could read, was read. Rotate those credentials from a clean device, starting with the most powerful. A short inventory made now saves hours later.

Quick check

Is a base64 encoded credential encrypted?

No. Base64 is an encoding, not encryption. Docker's own documentation calls the config.json method less secure than a credential store.

How do I find where the GitHub CLI keeps its token?

Run gh auth status, which the documentation says shows the stored location.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.