Technical Tip: How FortiCNAPP code security handles exceptions across pull requests
| Description | This article describes how FortiCNAPP Code Security manages exceptions for vulnerabilities and weaknesses across pull requests. It explains the behavior of exceptions for Software Composition Analysis (SCA) vulnerabilities (CVEs) and Static Application Security Testing (SAST) code weaknesses, and clarifies how these exceptions apply to future scans and pull requests. |
| Scope | This article applies to FortiCNAPP Code Security users who manage vulnerability and weakness exceptions in development workflows, particularly when using pull requests. |
| Solution | Key concepts: FortiCNAPP Code Security supports several exception types:
Exceptions are scoped per repository. An exception created for one repository does not affect other repositories. SCA exceptions are tied to CVE identifiers within a given repository. SAST exceptions are tied to specific code weaknesses (rules/CWEs), and optionally file paths and locations. Once an exception is configured, matching findings are not included in subsequent scans for that repository, including scans triggered by new pull requests.
For additional background, refer to the Exception management.
Core behavior: If a new finding matches the scope of an existing exception (same repository and same exception criteria), it will not be reported again in future pull requests. If the new finding is outside the scope of that exception (different repository, different file, different weakness type, or different CVE), it will be reported as a new issue.
The behavior differs slightly between SCA vulnerabilities (CVEs) and SAST weaknesses.
Behavior for SCA Vulnerabilities (CVEs): SCA exceptions are per-repository and per-CVE-identifier. If an exception is created for a specific CVE in a repository (marked as Accepted risk, False positive, Compensating controls, or Patch incoming), any future occurrences of that same CVE in the same repository will be suppressed in subsequent scans, including new commits, branches, and pull requests. If the same CVE appears in a different repository, it will not be covered by the exception and will be reported.
Example:
SAST exceptions can be file path-based (all SAST findings in that file for the given scanner) or instance-based (a specific weakness at a specific location in the file). The exception applies if the repository and exception criteria match (file path and/or specific instance). The same weakness in another repository will not be affected by the exception and will be reported. If a specific weakness instance or file path is excluded in fileA, the same weakness pattern appearing in another file (e.g., fileB) is treated as a new issue and will be reported.
Exceptions are applied at the level of the specific weakness/rule, not all security issues in a file, unless a file path-based exception is created.
If an exception is created for a specific SAST finding (same file path, same rule/weakness, same code location), and a new pull request keeps or reintroduces that exact same code issue in that location, the exception will still match, and the issue will not be reported again.
If the same weakness type appears elsewhere in the same file, behavior depends on how the exception was defined:
Practical examples: Example 1 – SCA CVE across pull requests in the same repository.
Result: The CVE is not reported again in repo-a.
Example 2 – SAST weakness in a single file.
Result: The finding at line 120 remains suppressed in subsequent scans and pull requests. If another unsafe SQL query is added at line 200 in the same file:
Example 3 – Same weakness type, different file.
Result: The weakness in scripts/deploy.sh will be reported.
Common issues:
For further details, refer to Exception management.
Summary.
|
