Hi! I'm Tavish, a 9th grader interested in coding and cybersecurity.

I've been building an open-source project called PromptFence, and one feature I recently worked on is something I think developers might find useful: scanning staged Git changes for sensitive information.

Let me explain why.

The problem

Imagine you're working on a project.

You finish writing your code, stage your changes using "git add", and prepare to commit everything.

But what if you accidentally included an API key, password or access token?

It happens more easily than you'd think. Sometimes credentials end up in configuration files, test files or code snippets without the developer noticing.

And once sensitive information gets pushed to a public repository, it can become a serious problem.

I wanted PromptFence to help catch these mistakes earlier.

Introducing staged Git scanning

PromptFence now has a command called:

"promptfence scan-git"

It scans the staged changes in a Git repository and looks for potentially sensitive information.

Some things it can detect include:

  • API keys and tokens
  • Password-like assignments
  • Private key markers
  • Email addresses
  • Other configured sensitive patterns

It can also generate reports in different formats, including text, JSON and SARIF.

Why scan the Git index instead of the working directory?

This was one of the interesting technical decisions.

When you edit a file, your working directory contains your latest version. But Git's staging area contains the exact version you've prepared for your next commit.

These aren't always the same.

For example:

  1. You edit a file and accidentally add a credential.
  2. You stage the file.
  3. You notice the problem and remove the credential from your working copy.
  4. The staged version may still contain the original credential.

A scanner that only checks the working directory could miss this.

That's why PromptFence reads the staged Git content itself.

The scanner is read-only. It doesn't modify your files or Git index.

A few technical details

I also wanted to make sure the scanner behaved sensibly with different kinds of files.

It skips things such as:

  • Binary-looking content
  • Unsupported file types
  • Symlinks and submodules
  • Files that are too large
  • Content that isn't valid UTF-8

It also reports when a scan is incomplete, rather than pretending that everything was checked.

One important limitation: this feature scans staged added or modified files. It does not scan your entire Git history, untracked files or unstaged changes.

What's next?

I'm working on expanding PromptFence beyond the command line.

The project also has an initial VS Code extension, and I want to keep improving the developer experience while adding stronger policy controls and CI/CD support.

There's still a lot to build.

Check out the project

GitHub: https://github.com/tavishshukla/promptfence

I'd love to hear what developers think. If you find a bug, have an idea for a feature or want to contribute, feel free to open an issue or pull request.

For me, this project is about learning by building something real — and hopefully making development a little safer along the way.

Thanks for reading!

— Tavish