---
title: "Securing Heroku CLI Credentials with System Keychain Storage"
description: "Starting with version 11.8.0, the Heroku CLI stores auth tokens in the OS keychain by default instead of plaintext `.netrc` files."
url: "https://swe.quest/articles/securing-heroku-cli-credentials-with-system-keychain-storage-55fa15429954cfb7"
canonical: "https://www.heroku.com/blog/securing-heroku-cli-credentials-with-system-keychain-storage/"
source: "Heroku Engineering"
published: "2026-07-01"
difficulty: "medium"
kind: "Release"
reading_minutes: 5
tags: ["identity-auth","developer-tools","security"]
---

# Securing Heroku CLI Credentials with System Keychain Storage

A post on [Heroku Engineering](https://swe.quest/sources/heroku.md), published 2026-07-01, 5 min read, Release. Original: [https://www.heroku.com/blog/securing-heroku-cli-credentials-with-system-keychain-storage/](https://www.heroku.com/blog/securing-heroku-cli-credentials-with-system-keychain-storage/)

## Summary

Starting with version 11.8.0, the Heroku CLI stores auth tokens in the OS keychain by default instead of plaintext \`.netrc\` files. It uses macOS Keychain via \`security\`, Secret Service via \`secret-tool\` on Linux, and Windows PasswordVault, all under the service name "heroku-cli". Credential lookup follows a four-tier precedence: \`HEROKU\_API\_KEY\`, then \`HEROKU\_NETRC\_WRITE=true\` forcing \`.netrc\`, then the keychain, then \`.netrc\` as a fallback. A new git credential helper keeps \`git push heroku main\` working, and CI pipelines using \`HEROKU\_API\_KEY\` need no changes.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Identity & auth](https://swe.quest/tags/identity-auth.md) (Security)
- [Developer tools](https://swe.quest/tags/developer-tools.md) (Engineering practices)
- [Security](https://swe.quest/tags/security.md) (Security)

## Prerequisites

- command-line tools
- netrc credential files

## Keywords

Heroku CLI, netrc, macOS Keychain, Secret Service API, Windows Credential Manager, git credential helper

## Related posts

- [Better security for your app's secrets](https://swe.quest/articles/better-security-for-your-app-s-secrets-1add70314c176532.md): incident.io · 2023-07-10 · Medium · 9 min read · Security, Cloud platforms, Configuration management, Identity & auth, Go
  incident.io's Go app loads config from per-environment YAML files, overrides values with environment variables, then resolves \`secret-manager:\` references from Google Secret Manager at boot.
- [Using GitHub Actions with Heroku Flow for additional Security Control](https://swe.quest/articles/using-github-actions-with-heroku-flow-for-additional-security-control-fea72ed977a6f5e4.md): Heroku Engineering · 2025-03-27 · Medium · 7 min read · CI/CD, Deployment, Security, Cloud platforms
  Because GitHub Orgs can't allowlist Heroku IP ranges, Heroku offers a sample pattern: a self-hosted GitHub Actions runner deployed as a Docker app in a Heroku Private Space with static outbound IPs, plus a Heroku Flow Action.
- [Auth setup with Neon, Keycloak and Koyeb](https://swe.quest/articles/auth-setup-with-neon-keycloak-and-koyeb-120106d3cf82095b.md): Neon · 2023-12-15 · Medium · 5 min read · Identity & auth, PostgreSQL, Deployment
  Keycloak can use Neon serverless Postgres as its backing store, with the Keycloak server deployed as a container on Koyeb.
- [Security Disclosure Recommendation: Redeploy Buckets and Reconnect GitHub After the Credential Reset](https://swe.quest/articles/security-disclosure-recommendation-redeploy-buckets-and-reconnect-github-after-3877fd6f9ee92bd0.md): Railway · 2026-10-22 · Medium · 4 min read · Incidents & postmortems, Identity & auth, Security, Deployment
  After a security disclosure, Railway invalidated and regenerated S3 access keys for every storage bucket and removed the GitHub tokens it held, including GHCR registry tokens stored on services.
- [Automatically Rotating GitHub Tokens (So You Don’t Have To)](https://swe.quest/articles/automatically-rotating-github-tokens-so-you-don-t-have-to-45a6ed60a4bb7896.md): Shopify Engineering · 2022-12-20 · Medium · 11 min read · Identity & auth, CI/CD, Security, Developer tools
  Shopify replaced long-lived GitHub personal access tokens with short-lived GitHub App installation tokens that are rotated automatically by scheduled GitHub Actions workflows and written into repository secrets.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
