Skip to content

Fixing a corner case of falsely calling remediated. - #1184

Open
umadevis1 wants to merge 1 commit into
feat/v3.x/aviator/27.1from
p/umadevis1/cornercaseremediated
Open

umadevis1 wants to merge 1 commit into
feat/v3.x/aviator/27.1from
p/umadevis1/cornercaseremediated

Conversation

@umadevis1

Copy link
Copy Markdown
Contributor

Problem

The server reports supersededIssueIds to say a wider fix contains an earlier issue's fix. fcli trusted that by issue ID alone, and a superseded issue gets no fix entry of its own in remediations.xml. Take an earlier fix that changed A.java and B.java, and a later fix that changes only A.java and was declared to supersede it. fcli would drop the whole earlier fix, so its B.java change was lost. The issue was still counted as remediated.

Change

In SupersedeGraph.resolveDirectSupersededBy, fcli now accepts a supersede only if the superseding fix contains every change of the superseded fix, on every file.

  • Containment per change: each change of the superseded fix must lie fully inside some change of the superseding fix. That means the same file and a line range that includes it.
  • Rejected declaration: fcli logs a warning and the superseded issue keeps its own fix entry. Nothing is lost.
  • Path spelling: it matches the server's rule, so separators, surrounding blanks and a leading ./ don't make a different file.
  • Unreadable ranges: they count as not contained, which keeps the fix instead of dropping it.
  • Chains: each link is checked on its own.

This is a second check behind the server's own fix for the same bug (the server now compares all changes of the prior fix). It also protects against older servers that still send the label.

Tests

  • New SupersedeGraphTest (6):
    • a two-file fix fully contained by a wider two-file fix is superseded;
    • a one-file fix that leaves B.java uncovered is not;
    • a fix that covers both files but not the whole range on one of them is not;
    • different spellings of a path match;
    • an unreadable range does not supersede;
    • a chain is checked link by link.
  • Updated one existing test: testAuditCommentsNameTheFixThatIsWrittenWhenTheWiderFixCannotBeWritten made its wider fix unwritable by pointing it at a missing file, so the fix no longer contained the narrower one. It now uses a character XML doesn't allow, which keeps the original intent.

When does it happen?

It needs three things together: a multi-file fix, a later finding whose request lacks one of those files, and a model that declares the supersede. This is uncommon, but when it happens the vulnerability stays unfixed while the report says it is remediated.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants