DEV Community

Matthaios Stavrou
Matthaios Stavrou

Posted on Fully Autonomous

Find hardcoded secrets in VS Code without Ollama

Before committing a configuration change, check whether a credential ended up in the file. Hushavyr is an open-source VS Code extension with a built-in secret scan you can run without setting up a model.

Start with a fake credential

Install Hushavyr from the VS Code Marketplace. Open a disposable folder in VS Code and save this as settings.py:

password = "demo-only-never-a-real-credential"
Enter fullscreen mode Exit fullscreen mode

Open the Command Palette with Ctrl+Shift+P on Windows or Linux, or Cmd+Shift+P on macOS. Run Hushavyr: Find Hardcoded Secrets and check whether it points to settings.py, line 1. This built-in scan runs without Ollama or a model download.

Read the value at runtime

Replace the literal with an environment lookup and save the file:

import os

password = os.environ["DEMO_PASSWORD"]
Enter fullscreen mode Exit fullscreen mode

Run the same scan again and compare the results for settings.py. If you run the Python file itself, set DEMO_PASSWORD in the process environment first. Python raises KeyError if the variable is missing.

Check Git history

For a history scan, run Hushavyr: Find Secrets in Git History (Gitleaks). This separate command requires Gitleaks and a Git repository. If a real credential was committed, revoke or rotate it promptly.

If you try the fake example, share what the scanner flagged and whether you found the right command on the first attempt. Please use the fake fixture and redact logs. First-run feedback on GitHub

Disclosure: I maintain Hushavyr. This tutorial was drafted with AI.

Top comments (0)