A built-in SAST rule is a general check designed to catch widely applicable security issues across many codebases. A custom rule encodes organisation-specific logic, such as approved sanitisation patterns, banned functions, or internal policy requirements. That makes custom rules better for enforcing local standards, while built-in rules provide broad baseline coverage.
How the two rule types differ in practice
A built-in sast rule is the vendor or tool’s prepackaged detection logic for common weaknesses, so it gives you broad baseline coverage with little setup. A custom rule is authored by your team to encode local coding standards, sanctioned libraries, approved sanitisation, or banned patterns that the generic rule set cannot know about. The practical difference is scope: built-in rules look for universal issues, while custom rules enforce organisation-specific intent.
That distinction matters because SAST is only useful when the rule set reflects both common vulnerability classes and the ways your own codebase actually works. A built-in rule may flag an issue that is broadly unsafe, but it will not always understand a house standard, a wrapper function, or a domain-specific exception. A custom rule closes that gap by turning internal policy into static analysis logic.
Built-in rules are usually easier to trust as a starting point because they are maintained by the tool vendor or community and are designed to apply across many projects. Custom rules demand more governance, because they can drift, become inconsistent across teams, or reflect old policy after the codebase changes. If the rule logic is too narrow, it creates blind spots; if it is too broad, it creates noisy alerts that engineers start ignoring.
When to rely on built-in rules versus write your own
Use built-in rules when you want immediate coverage for well-known defects such as injection, insecure deserialisation, unsafe cryptography usage, or obvious input-validation problems. They are the fastest way to establish a common security floor across repositories, especially when teams are still maturing their secure coding practices.
Use custom rules when the question is not “is this pattern generally risky?” but “is this pattern acceptable in our environment?” That is where organisation-specific sanitisation functions, approved abstractions, internal allowlists, and prohibited APIs become relevant. Custom rules also help when a framework or library is safe only if used in a particular way, because the generic rule may not recognise the approved usage pattern.
A useful way to decide is to ask whether the detection logic should be portable across most codebases or whether it depends on your internal design decisions. If it is portable, built-in rules should usually handle it. If it depends on your own coding standard, custom logic is justified because the value is in encoding policy, not just identifying a common weakness.
Risk and Threat Considerations
Rule selection changes the exposure profile of the pipeline. Built-in rules tend to reduce baseline vulnerability risk, while custom rules reduce the risk of missing organisation-specific misuse that the generic checks never knew to look for. The main failure mode is overreliance on one type of rule, which leaves either common defects or local policy violations undetected.
Failure mechanism: Teams assume the built-in rule set is complete, so they never encode internal coding standards, approved wrappers, or exception handling patterns. The reverse can also happen, where custom rules become the only focus and common security classes are under-covered.
Impact: In the first case, code can pass analysis while still violating internal security requirements or bypassing approved safeguards. In the second case, teams get a false sense of control from policy checks while classic vulnerabilities continue to reach production.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
CIS Controls v8 and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| CIS Controls v8 | CIS Control 4 — Secure Configuration of Enterprise Assets and Software | Custom SAST rules help enforce approved secure coding and configuration patterns. |
| CIS Control 16 — Application Software Security | SAST rules directly support application security testing and defect detection. | |
| Recommendation — Encode approved code patterns as enforceable secure configuration checks in the pipeline. Use SAST rules to find insecure code patterns before release. | ||
| NIST CSF 2.0 | PR.IP-1 — Configuration Management | Custom rules encode approved internal standards that should be managed as controlled policy. |
| PR.DS-6 — Integrity Checking Mechanisms | SAST findings support integrity-focused review of source code before deployment. | |
| Recommendation — Manage custom analysis rules as controlled security policy artifacts. Use static analysis results to confirm source changes do not introduce unsafe behaviour. | ||
Practitioner Guidance
What to prioritise: Start with built-in rules as the minimum security baseline, then add custom rules only where they enforce a clearly defined local standard or prevent a known misuse pattern in your own codebase.
What to verify: Each custom rule should map to a documented internal policy or an approved secure coding pattern, and teams should be able to explain exactly what unsafe behaviour it blocks. If that explanation is vague, the rule is usually too speculative to keep.
Common mistake: Treating custom rules as a substitute for vendor coverage. They are complementary, not interchangeable, and the most effective SAST programmes keep baseline rules broad while making custom logic precise and low-noise.
Practitioner takeaway: Built-in rules give you breadth, custom rules give you local correctness, and a strong SAST programme needs both without letting either category hide the gaps of the other.
Related resources from NHI Mgmt Group
- What is the difference between built-in IAM and custom authentication?
- What is the difference between an MCP gateway and a custom-built agent orchestration layer?
- What is the difference between a pre-built investigation agent and a custom agent running on an MCP Server?
- What is the difference between built-in MongoDB roles and custom roles?
Deepen Your Knowledge
Reviewed and updated by the NHIMG editorial team on September 19, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org