Safeguard
Security Guides•

What can a custom static analysis rule not find, and what covers it?

Rules find patterns in code. They struggle with access control, business logic and runtime configuration. Learn the gaps and what to pair with rules.

Safeguard Security Team
4 min read

A custom rule finds patterns that can be described in code structure, such as a banned call or a missing argument. It struggles with access control logic, business rules, runtime configuration and anything that depends on how components behave together. Pair rules with tests, review and runtime testing for those.

What rules are good at

OWASP's source code analysis page lists strengths of static tools: they scale, can run repeatedly in continuous integration, identify certain well known vulnerabilities such as buffer overflows and SQL injection flaws, and point developers to the file, line and code snippet. Custom rules extend that with checks for your own APIs and conventions.

What they struggle with

The same page lists weaknesses. It says some types of vulnerability are difficult to find by automated search, including authentication problems, access control issues and insecure use of cryptography. It also says static tools frequently cannot find configuration issues because those are not represented in the code, that it is hard to prove a reported issue is a real vulnerability, and that many tools have difficulty analyzing code that cannot be compiled.

Gap table

ConcernWhy a rule strugglesBetter partner
Broken authorizationThe rule would need to know who may do whatAutomated tests of access per role, code review
Business logic flawsIntent is not in the syntaxDesign review, abuse case tests
Runtime configurationLives in environment, not codeConfiguration scanning and runtime checks
Behavior of a running appStatic view onlyDynamic testing
Vulnerable dependenciesThe flaw is in code you did not writeDependency scanning with reachability
Secrets in historyRules see the current treeSecret scanning over history
Cross service data flowA single rule sees one codebaseThreat modeling, integration tests

How to fit a rule into a wider plan

  1. Write down the risk, not the rule. "Users can read other users' invoices" is a risk.
  2. Ask what would catch it. Often it is a test that logs in as user A and requests user B's data.
  3. Use a rule only where a pattern truly captures the risk, such as "every route handler calls the authorization helper".
  4. Accept that some risks are covered by process, such as design review.

A useful middle ground

Some rules check that a protective step is present, not that it is correct. "Every handler calls the check" does not prove the check is right, but it removes the case where someone forgot to call it, and that is a common bug. Combine it with tests of the check itself.

Read a clean result carefully

A clean run means no match for the patterns you wrote. It does not mean absence of the risk. Say so in your documentation: each rule's page should include a short "does not cover" line.

Try it yourself

Click through it at your own pace, or open it full screen.

This demo tests a running application. Look at what it can observe that a source pattern cannot.

Quick check

Can a rule detect missing authorization checks?

Only in limited forms, such as confirming a helper is called. Whether the check is correct usually needs tests or review.

Does a clean static analysis run mean the code is secure?

No. It means the patterns you checked were not found.

Safeguard's scanning covers dependencies and SBOMs, and its reachability analysis helps show which findings your code can actually call. You can run a free scan on a repository.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.