Inspiration

As AI-assisted coding becomes increasingly common, developers can generate and modify software much faster than before. However, the ability to produce code quickly does not guarantee that the code is secure.

My interest in this problem grew after seeing a security report shared through Berkeley CALICO involving exposed network ports and a compromised development environment. It raised a question I wanted to explore: how can developers verify that code is safe when they increasingly rely on AI to write and review it?

Existing tools can identify vulnerabilities, but AI-generated security explanations introduce another problem. A model might describe a plausible vulnerability without correctly identifying the code responsible for it. I wanted to build a tool that would help developers investigate both the code and the AI's conclusions.

What It Does

Patch is a VS Code extension that brings security review directly into the development environment.

The extension performs local static analysis of JavaScript and TypeScript code to identify potentially dangerous patterns, including credential logging, unsafe evaluation, and disabled TLS verification. Findings are connected to relevant source locations so developers can investigate them without leaving the editor.

Patch also supports dependency vulnerability checks using OSV and container-image scanning through Trivy. These checks provide additional information about security risks beyond the application's source code.

For more detailed reviews, developers can explicitly approve code excerpts before sending them to an AI model through Groq. The model returns structured findings with references to the code. Patch then validates the response format and checks whether cited source quotations correspond to the submitted code.

This verification does not guarantee that every security finding is correct. Instead, it provides developers with evidence they can inspect rather than asking them to accept an AI-generated explanation at face value.

How I Built It

I developed Patch as a VS Code extension using JavaScript and Node.js, with local source analysis based on TypeScript's abstract syntax tree.

The local scanner examines supported code patterns and associates its findings with source locations. For AI-assisted reviews, Patch communicates with an authenticated Fastify backend that integrates with Groq. Review responses follow structured schemas and are checked against saved source information before being displayed.

I integrated OSV for npm dependency advisories and Trivy for optional Docker image vulnerability scans. The extension also supports reviewing suggested code changes before applying them, keeping the developer in control of modifications.

I used automated tests and GitHub Actions to validate the project and package it as an installable VS Code extension.

Challenges

One of the largest challenges was distinguishing a plausible AI-generated security warning from a finding supported by the actual code.

Large language models can produce convincing explanations even when their references are inaccurate. To address this, I implemented validation of structured responses, source references, and exact quotations. This helps identify unsupported references, although it cannot independently establish whether the underlying security interpretation is correct.

Another challenge was combining different forms of security analysis into one workflow. Static analysis, dependency advisories, container scanning, and AI-assisted review produce different kinds of evidence. Presenting those results coherently without implying that every warning has the same level of certainty required careful design.

Packaging and testing the extension also introduced engineering challenges involving VS Code integration, asynchronous operations, and external tools.

What I Learned

Building Patch helped me understand the difference between integrating an AI model and building a system that can evaluate its outputs.

I learned more about abstract syntax trees, security scanning, API integration, structured response validation, software testing, and VS Code extension development.

More importantly, I learned that identifying a suspicious code pattern is not the same as proving a vulnerability. Static checks have limitations, and AI-generated findings require interpretation and verification.

What's Next

Patch is packaged as a locally installable VS Code extension, but public deployment and broader adoption are still open decisions.

A future direction would be evaluating Patch against a larger collection of real-world vulnerabilities and benign examples to measure detection coverage and false positives. Improving these measurements would help determine how useful the extension is beyond controlled demonstrations.

My goal is to make security findings more transparent and easier for developers to verify, rather than replacing their judgment with another AI-generated answer.

Built With

Share this project:

Updates

Submission history