Foundry security testing: forge tests and a QuillShield audit

Foundry security testing means writing tests that try to break your contracts: unit tests, fuzz tests and invariant tests, where forge test runs random sequences of calls and checks your invariants after each one. QuillShield adds a review of the same Foundry project for the bugs your tests don't describe: it audits the Solidity in scope, full audits come with proofs of concept, and it can then check every pull request against that audit.

Last updated . 5 minute read. By the QuillAudits Team.

What does security testing in Foundry cover?

Forge runs the tests you write. Unit tests check the cases you thought of. Foundry's invariant testing guide describes invariant tests as checks of properties that should always hold, whatever the order of actions: forge runs random sequences of function calls, checks the invariants after each call, and fuzzes the time or block distance between calls as well. In foundry.toml, the [invariant] section's runs sets how many sequences run and depth how many calls each one makes, and the [fuzz] section has a runs setting too, as Foundry's testing config page shows.

Those tests check the properties you wrote down. A missing invariant, or an access rule nobody stated, is never checked, however many runs you set. A review looks for those gaps, which is why a full audit and your forge tests answer different questions.

Layer What it checks Who writes it
Unit tests in forge test The cases you wrote, one at a time You
Fuzz tests Your test functions with inputs forge generates You write the property
Invariant tests Properties that must hold after random sequences of calls You write the invariants
QuillShield full audit The Solidity in scope as one system: a security graph, the invariants the code must keep, findings a separate reviewer agent tried to disprove, and proofs of concept QuillShield
QuillShield pull request check Each change against the security graph from the last full audit QuillShield, on GitHub or GitLab.com
Manual audit The code and the design, reviewed by people An audit firm, such as QuillAudits

What does QuillShield need from a Foundry project?

  • Solidity in a Foundry project, which is what QuillShield supports today.
  • The code as a GitHub or GitLab.com repository, a git URL with a branch, tag or commit, a Foundry .zip of up to 50 MiB, a folder or a single .sol file.
  • A GitHub or GitLab.com repository if you want pull request checks later. An upload gets a full audit and no checks.
  • A scope, the .sol files to audit. Tests, lib/, mocks, scripts and generated folders are left out by default, and the price comes from the lines of Solidity in scope, not counting comments and blank lines.
  • Context if you have it: the whitepaper, trust assumptions, privileged roles and previous audit reports, attached before the audit.
  • The admin or owner role in your QuillShield organization, which creating a project needs.

A full audit's artifacts may include invariants.md, a list of the invariants QuillShield found the code must keep. Each one is a candidate for a forge invariant test, so the audit can feed your own test suite after it ends.

How do I run QuillShield on a Foundry project?

  1. Check that forge build and forge test pass from a clean clone of the commit you want audited, so the code QuillShield reviews is a commit that builds and passes its own tests.
  2. Sign up for QuillShield, open Projects and click New project. Choose Git import for a GitHub or GitLab.com repository or a git URL, or upload a Foundry .zip, a folder or one .sol file.
  3. On Scope, keep the contracts that ship, usually the .sol files in src/. Tests, lib/, mocks and scripts start out of scope.
  4. On Docs, attach the whitepaper, trust assumptions or earlier audit reports, or skip the step.
  5. Review the quote and pay. You see the exact price before anything is charged, and the audit starts when the order is paid.
  6. Read the findings once the audit is complete. On a GitHub or GitLab.com project, turn on pull request checks with the QuillShield GitHub App or your GitLab.com connection.

Build and test the Foundry project, then quote a QuillShield audit of the repository from the CLI terminal

# in a clean clone of the commit you want audited
forge build
forge test

# QuillShield CLI 0.2.3 or later, with Node.js 18 or later
npm install -g @quillaudits/cli
qs init
qs audit https://github.com/your-org/your-repo --ref main --no-pay

qs init asks for a qs_live_ key, which an owner or admin creates at Settings, API keys. With --no-pay, qs audit stops after the quote, and qs pay <quote-id> --watch pays it and follows the audit. The QuillShield CLI page lists every command. An agent in Claude Code or Cursor can do the same through the QuillShield MCP server, and the Create a project and Scope and documentation pages in the QuillShield docs cover each step in the dashboard.

What should a Foundry project have before the audit?

  • forge build passes from a clean clone of the commit you will audit
  • forge test passes on that commit, with no tests skipped or commented out
  • Invariant tests for the properties the protocol depends on, such as a vault never owing its holders more than it holds
  • A list of the files that ship, so the scope matches what you deploy
  • Notes on trust assumptions and privileged roles, ready to attach as docs
  • The repository on GitHub or GitLab.com, if you want pull request checks after the audit

When the audit is done, our guide How to review smart contract changes since your last audit shows how to test the paths a later change touches with Foundry, and the vulnerability library explains how to test several of the bug classes a review looks for, such as access control and rounding, in Foundry.

What are the limits?

  • QuillShield supports Solidity in Foundry projects today. For code in other languages, request a manual audit from QuillAudits.
  • A zip upload can be up to 50 MiB, and it gets a full audit and no pull request checks.
  • Scopes above 40,000 lines of Solidity are quoted by hand.
  • Findings show once an audit is complete.
  • QuillShield does not replace a manual audit. It reviews every change between audits.

If you would rather not run it yourself, talk to an auditor, and QuillAudits auditors run QuillShield on your code.

FAQ

Do I need Foundry to use QuillShield?

Yes. QuillShield supports Solidity in Foundry projects today. For code QuillShield doesn't cover, you can request a manual audit from QuillAudits.

Are my test files part of the audit price?

Not by default. You choose the files in scope, and tests, lib/, mocks, scripts and generated folders start out of scope. The price comes from the lines of Solidity in scope, not counting comments and blank lines.

How is an invariant test different from a QuillShield audit?

An invariant test checks a property you wrote, after random sequences of calls. A QuillShield audit reviews the Solidity in scope as a whole, lists the invariants the code must keep and tests its findings with proofs of concept, so it can point at properties you haven't written yet. Run both.

Can I audit a Foundry project that isn't on GitHub?

Yes. Upload a Foundry .zip of up to 50 MiB, a folder or a single .sol file, or give a git URL. Pull request checks need a GitHub or GitLab.com repository.

What does a full audit of a Foundry project cost?

It is priced from the lines of Solidity in scope and starts at $49. As of November 2026, 1,000 lines cost $379 and 5,000 lines $1,169. Sign-up is free, and new accounts get $50 in credit, good for up to half of an order.

Sources

QuillShield is building the security layer between AI and money, so you can keep shipping between audits.

Sign-up is free, and new accounts get $50 in credit, good for up to half of an order.

  1. 1Sign up and import a repo
  2. 2See the exact price before anything is charged
  3. 3Approve it, and the audit starts