Inspiration
Love for the game. And one very specific fear: pasting a config file into a chat window and noticing the production password two seconds after hitting Enter. Everyone on the team has done it or watched someone do it. We wanted a tool that makes that mistake impossible instead of merely embarrassing.
What it does
AirGap sits between your repository and the model. sanitize finds passwords, tokens, keys, internal hostnames and personal data, and replaces each one with a stand-in that looks real but is not. restore puts the originals back, byte for byte.
The stand-ins are the point. A JSON file is still valid JSON, a connection string still looks like a connection string, and the same secret gets the same stand-in everywhere in the repo, so the model can still reason about the code. It just never sees the real thing.
How we built it
- Thirteen generators collect everything that could be a secret: assignments, URLs with credentials, encoded blobs, key files, and so on.
- A rule layer sorts the candidates into three piles: surely secret, surely harmless, and "honestly, no idea".
- Only the third pile goes to Mellum2. We ask three times, each time with a different amount of surrounding code, and take the majority.
- A final audit pass searches the output for leftover copies of anything we masked.
If Mellum2 does not answer, we mask. Silence is never treated as "safe".
Challenges we ran into
- Decoys are harder than secrets. Masking everything that looks random is easy and costs exactly as much as it gains. A commit hash, a UUID and an API key look like siblings.
- Mellum2 is a tie-breaker, not a judge. It is right about 80 to 86 % of the time, whatever we wrote in the prompt. We tried many prompts. The model was not impressed by any of them.
- Thinking is expensive. Around 250 tokens per candidate, so we had to be picky about what we ask.
- One repository full of cryptographic test vectors, where the same kind of hex string is a secret in most files and a decoy in a few. We lost a lot of sleep to that one.
- A laptop that restarted at night and took ten running experiments with it. We now keep our work in a folder that survives reboots.
Accomplishments that we're proud of
- Not a single broken file and not a single failed repository, in every run.
- When the model went down for a whole run (by accident, not by design), the score dropped by only 1.6 points and nothing leaked.
- 925 tests, all written with invented values.
- A long list of clever ideas that we measured, found useless and threw away. We are oddly proud of that list.
What we learned
Measure first, believe later. Roughly half of our good ideas made things worse once we tested them on data we had kept aside. We also learned that a small model is most useful when you ask it few, well-chosen questions and have a plan for the times it stays silent.
What's next for AirGap
A proxy mode that sits in front of any LLM API, so the swap happens without anyone thinking about it. An IDE plugin. And team-specific allow lists, because every company has its own idea of what counts as secret.
Our Final commit
https://github.com/nel0x/airgap 77c648bbd4c24d3e00b0d33b085eeb3e323b66db
Docker: gateway/Dockerfile