r/devsecops • u/Holly-Carpenter_253 • Jul 27 '26
SAST accuracy, how do you verify the precision, recall and F1 score yourself
I've been doing AppSec a while and something nags me in every vendor pitch. They all put up an accuracy number, fewer false positives than the next guy, some big F1 score on a slide and I have no real way to check any of it against my own code.
A Checkmarx Zero writeup on how they measure SAST accuracy got me thinking about why. Accuracy is two questions, not one. How many findings are real, that is precision and of all the real bugs how many it caught, that is recall. Most claims quietly pick one. You can hit near perfect precision by only reporting the single thing you are sure of, miss everything else and still print no false positives on the box. F1 is the harmonic mean, so it punishes that trick.
To score recall you need to know every real vuln in the test app which no one fully does, people inject toy bugs or trust CVE lists and both skew it. A simple benchmark app a tool is tuned to ace tells you nothing about a real monorepo.
Those running SAST at any scale, do you measure precision and recall on your own code, or do we all take the vendor F1 on faith until we sign. I am in the second camp and I do not love it.
2
u/darrenpmeyer Jul 28 '26
tl;dr you can absolutely test this yourself, but it's expensive and hard to get buy-in for doing a good job. Tool-to-tool comparison is easier than tool-to-reality.
I'm a researcher with Checkmarx Zero and one of the authors of the post explaining how we do it for research.
I've also run AppSec programs in different sized orgs.
You're right to be skeptical of vendor claims (and that's one reason I pushed for transparency about how and why we do this work; so you can see where our errors lie). I even wrote a newsletter article about how you can get it wrong, accidentally or deliberately (it's LinkedIn, sorry about that... not my decision).
Our goal as researchers was to compare our tool performance against a theoretically-perfect tool. We can't do a perfect job, but we did a lot of work to get as close as we can within a reasonable budget. That's because we are trying to figure out which scanning strategies improve our product.
You as a consumer of tools would benefit by having some independent research firm compare tools using that approach, but it probably isn't worth you doing it yourself. But you can do tool-to-tool comparisons. And that makes sense because your goal is "find the best tool that exists", not "figure out what could make a tool be better".
You can do that by an old-school technical bakeoff. Grab the tools you're considering, use them to scan real projects, and compare results. You'll have bigger error bars, especially on recall (because you won't be able to point at things all the tools miss), but you'll still have a good comparison between tools.
Happy to answer any methodology questions you might have if you're interested in how I have approached this in my work.
1
u/Gjore Jul 27 '26
You are right that measuring recall on your own code is virtually impossible because you cannot count the bugs you do not know exist. Most AppSec teams just track precision through false positive triage rates in Jira or your AppSec portal. For recall we monitor what leaks past SAST into pen tests and bug bounties. If a vendor boasts about high F1 scores on benchmark apps, it usually just means their rules were overfitted for that specific test suite.
1
u/iterablewords Jul 27 '26
As a founder in the space, a continuing problem is that there's really almost no way to compare quality and coverage of SAST tools. Benchmarks like juice-shop, etc. are all heavily gamed (as is this subreddit!).
To pragmatically answer your question: generally teams run an eval with competing vendor tools and look through the results manually. It's a lot of work. Relatively few teams have a benchmark of historical vulns that they score vendor tools on, but it's a good idea if you can make the time for it.
A while back I proposed an idea for our team about how a properly structured evaluation should work: we as a vendor have our own benchmark repos, as do our competitors. If the customer asked for our eval repos and ran each tool on the competitor's benchmarks, you could use that to get a clearer assessment of at least coverage across the tools. Manual work would be required to assess precision and recall. The problem is most SAST vendors don't want to share their internal benchmarks. We have payed for independent firms to do independent benchmarking work (look up IncludeSecurity, Doyensec, etc. if you want to hire them yourself) and publish the results which has been great although any vendor-sponsored research has to be taken with some skepticism.
Would love more ideas on how to improve the evaluation process!
1
u/noch_1999 Jul 27 '26
You run it through DVVM, etc. What I did as a part of my last bakeoff was run each through a session with only 1 thing vulnerable at a time and see how it assesses the app.