Skip to content

create fortify parser V2 - prefer true line#15228

Open
paulOsinski wants to merge 3 commits into
DefectDojo:bugfixfrom
paulOsinski:fortify-fpr-true-line
Open

create fortify parser V2 - prefer true line#15228
paulOsinski wants to merge 3 commits into
DefectDojo:bugfixfrom
paulOsinski:fortify-fpr-true-line

Conversation

@paulOsinski

@paulOsinski paulOsinski commented Jul 13, 2026

Copy link
Copy Markdown
Contributor
  • For .fpr imports, compute_line() preferred the snippet's StartLine over the vulnerability's SourceLocation line. Fortify writes snippets with 3 lines of leading context, so every finding's line (and title) was off by −3 from the line Fortify actually reports (less near the top of a file, where the snippet clamps to line 1). The true line was only preserved as SourceLocationLine: text in the description.

Since line feeds hash-code deduplication, findings imported via FPR could never dedupe against the same findings from other parsers configured on File Path + Line Number. The XML report parser is unaffected — it already uses the issue's LineStart.

Fix
compute_line() now prefers SourceLocation's line attribute and falls back to the snippet start only when it's missing.

Tests

  • New regression test test_fortify_fpr_uses_true_source_location_line, confirmed failing before the fix (222 != 219), including the clamped-snippet case showing the offset isn't constant.
  • Updated existing FPR test assertions that had encoded the snippet-start lines (219→222, 104→107, 5→8, 13→16, 1→3).

re: V2
many users are using the original parser, so v2 was created to avoid finding churn

@paulOsinski paulOsinski changed the base branch from master to bugfix July 13, 2026 18:18
@paulOsinski paulOsinski requested a review from mtesauro as a code owner July 13, 2026 18:18
@paulOsinski paulOsinski marked this pull request as draft July 13, 2026 18:22
@github-actions github-actions Bot added the docs label Jul 14, 2026
@paulOsinski paulOsinski marked this pull request as ready for review July 14, 2026 14:18
@paulOsinski paulOsinski changed the title change fortify parser to prefer true line create fortify parser V2 - prefer true line Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant