Back/Engineering/Claude
IntermediateEngineering

Use an LLM as a Security Judge to Prioritize Codebase Analysis

Create an LLM-powered 'judge' to score and prioritize files in a large codebase for security analysis. This workflow helps focus expensive bug-hunting efforts on the most high-risk areas.

Use an LLM as a Security Judge to Prioritize Codebase Analysis

Source episode · 32:30

How Mozilla Fixed 500 Security Bugs with Claude Mythos

with Claire Vo

32:30 to 40:18: Mozilla uses an LLM judge to rank files and code paths by security relevance before assigning expensive analysis to the highest-risk areas.

Before you start

What you need

  • A codebase inventory with file paths and brief summaries
  • The product threat model and vulnerability classes of interest
  • A scoring rubric for reachability, privilege, input exposure, and impact

What you’ll make

A ranked analysis queue that explains why each file or subsystem deserves security review and passes the highest-risk targets to a hunter.

Tools used

Step by step

The workflow

Follow the sequence once, then adapt the prompts, checks, and handoffs to your own setup.

4 steps

Step01

Craft a Security Expert Prompt

Draft a prompt that assigns the LLM the role of a security expert. Provide specific context about the file types in your codebase, such as C++ files, IPDL, or Web IDL. Include details from your security bug classification program to ground the model's analysis.

Example prompt
You're a security expert. Here's the different kinds of files we're looking at: C++ files, IPDL files, Web IDL files. Here is some detail about each... Now, give me two scores. One score is how likely do you think there's a memory safety issue? And another is how easy could you access this from a webpage?
Step02

Request Likelihood and Accessibility Scores

Instruct the LLM to return two specific scores for each file. The first score should rate the likelihood of a particular vulnerability, like a memory safety issue. The second score should rate how easily a malicious actor could access the code, for example, from a webpage.

Example prompt
You are a security expert specializing in [language, e.g., C++]. I will provide you with the content of a source code file. Your task is to analyze it and provide two scores on a scale of 1-10. 1. Likelihood Score: How likely is this file to contain a [vulnerability type, e.g., memory safety issue]?
2. Accessibility Score: How easily could this code be accessed or exploited by an external actor, for example, from a public webpage or API endpoint? Return only the two scores in a parsable format like this:
Likelihood: [score]/10
Accessibility: [score]/10 Here is the file content:
[paste source code]
Step03

Generate a Ranked List

Set up a script to feed each target file, or relevant sections of code, to the LLM with your prompt. Parse the two scores from each response and compile them into a single list. Sort this list to rank files from highest to lowest risk, based on the scores.

Example prompt
Set up a script to feed each target file, or relevant sections of code, to the LLM with your prompt. Parse the two scores from each response and compile them into a single list. Sort this list to rank files from highest to lowest risk, based on the scores.

My actual values:
[insert the files, settings, accounts, or constraints for this step]

Give me the exact commands, settings, or output to use. Finish with a pass or fail check for generate a ranked list.
Step04

Feed the Prioritized List to a Bug Hunter

Use the final ranked list to prioritize the work of a more resource intensive process, like an automated bug hunting agent. By feeding the agent the highest risk files first, you focus expensive compute cycles on the most likely targets.

Example prompt
Use the final ranked list to prioritize the work of a more resource intensive process, like an automated bug hunting agent. By feeding the agent the highest risk files first, you focus expensive compute cycles on the most likely targets.

My actual values:
[insert the files, settings, accounts, or constraints for this step]

Give me the exact commands, settings, or output to use. Finish with a pass or fail check for feed the prioritized list to a bug hunter.

What good looks like

  • High-ranked items connect to concrete attack surfaces or trust boundaries
  • Each score includes a reason that a reviewer can challenge
  • The bug-hunting budget is concentrated on a small, justified set of targets

Build your next product with ChatPRD

Turn an idea into a PRD, user stories, and a plan.

Try ChatPRD free

After the steps

Runbook notes

How to recover when the loop fails and where human judgment helps.

Recover

If it goes sideways

The judge ranks files by scary names rather than behavior
Include call relationships, input sources, privileges, and file summaries in the judging context.
A critical path is buried because its file looks ordinary
Add architecture and threat-model signals, then compare the ranked list with known sensitive flows.

Start shipping
better products.

Join 100,000+ product managers who use ChatPRD to write better docs, align teams faster, and build products users love.

Free to start
No credit card
SOC 2 certified
Enterprise ready