-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: show most severe vulnerability action is displayed (#402)
Signed-off-by: Bastian Doetsch <[email protected]>
- Loading branch information
1 parent
274027a
commit 44c0e41
Showing
3 changed files
with
39 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import marked from 'marked'; | ||
import { Issue, OssIssueData } from '../../common/languageServer/types'; | ||
import { OssIssueCommandArg } from '../interfaces'; | ||
|
||
export function getOssIssueCommandArg( | ||
vuln: Issue<OssIssueData>, | ||
folderPath: string, | ||
filteredVulns: Issue<OssIssueData>[], | ||
): OssIssueCommandArg { | ||
const matchingIdVulnerabilities = filteredVulns.filter(v => v.id === vuln.id); | ||
let overviewHtml = ''; | ||
|
||
try { | ||
// TODO: marked.parse does not sanitize the HTML. See: https://marked.js.org/#usage | ||
overviewHtml = marked.parse(vuln.additionalData.description); | ||
} catch (error) { | ||
overviewHtml = '<p>There was a problem rendering the vulnerability overview</p>'; | ||
} | ||
|
||
return { | ||
...vuln, | ||
matchingIdVulnerabilities, | ||
overviewHtml, | ||
folderPath, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters