ShieldHabits
Language: English

Code, secrets and supply chain

Software supply chain failures entered the OWASP Top 10 in 2025, after worms such as Shai-Hulud spread through hundreds of npm packages. Meanwhile 28.65 million secrets leaked in public GitHub commits in 2025, and most leaked keys stay valid for years.

0 of 6 habits in place

Your progress is saved only in this browser. Nothing is sent to us.

Essential
Do this first. It stops the most common attacks.
Advanced
Extra protection for people facing higher risk.

Keep secrets out of code

Essential

Use environment variables or a secrets manager, and keep GitHub push protection switched on.

Why it matters

API keys and passwords committed to code are found by automated scanners within minutes. Push protection blocks many secrets before they reach the repository.

How to do it

  1. Store keys in environment variables or a secrets manager, never in source files.
  2. Add .env and similar files to .gitignore.
  3. Turn on secret scanning and push protection for your repositories.
  4. Scan the existing history for old secrets.

Revoke a leaked key instead of just deleting the commit

Essential

If a secret leaks, revoke it and issue a new one; removing the commit is not enough.

Why it matters

Once a secret is public, copies exist elsewhere. Most leaked secrets that were valid in 2022 still worked in January 2026, because nobody revoked them.

How to do it

  1. Revoke the leaked key at the provider immediately.
  2. Create a new key and update your applications.
  3. Check the provider's logs for misuse.
  4. Then clean the repository history if needed.

Use passkeys or security keys on developer accounts

Essential

Protect GitHub, npm and PyPI accounts with WebAuthn or passkeys instead of one-time codes.

Why it matters

Attackers phish developer accounts to publish malicious package versions. CISA and GitHub both call for phishing-resistant MFA.

How to do it

  1. Add a passkey or security key to your GitHub account.
  2. Do the same for npm, PyPI and any other registry you publish to.
  3. Remove text message and code-based methods once a stronger one is set up.
  4. Store recovery codes offline.

Publish packages with trusted publishing

Advanced

Publish from CI with trusted publishing (OIDC) instead of long-lived tokens.

Why it matters

Stolen publishing tokens let attackers push malicious versions. Trusted publishing for npm has been generally available for GitHub Actions and GitLab CI since July 2025, and it leaves no token to steal.

How to do it

  1. Configure trusted publishing for your package in the registry.
  2. Publish from your CI workflow using OIDC.
  3. Delete old publishing tokens.
  4. Require review for changes to the release workflow.

Last reviewed November 28, 2026