Skip to content

Commit 7d58fe8

Browse files
authored
Updated version (#72)
1 parent 7435826 commit 7d58fe8

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

Diff for: socketsecurity/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
__author__ = 'socket.dev'
2-
__version__ = '2.0.40'
2+
__version__ = '2.0.41'
33

Diff for: socketsecurity/core/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,6 @@ def add_package_alerts_to_collection(self, package: Package, alerts_collection:
801801
alert = Alert(**alert_item)
802802
props = getattr(self.config.all_issues, alert.type, default_props)
803803
introduced_by = self.get_source_data(package, packages)
804-
805804
issue_alert = Issue(
806805
pkg_type=package.type,
807806
pkg_name=package.name,

Diff for: socketsecurity/core/messages.py

+15-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import re
44
from pathlib import Path
55

6+
from docutils.nodes import title
67
from mdutils import MdUtils
78
from prettytable import PrettyTable
89

@@ -233,10 +234,21 @@ def create_security_comment_sarif(diff) -> dict:
233234
# Create a unique rule id and name by appending the manifest file.
234235
unique_rule_id = f"{base_rule_id} ({mf})"
235236
rule_name = f"Alert {base_rule_id} ({mf})"
236-
237-
short_desc = (f"{alert.props.get('note', '')}<br/><br/>Suggested Action:<br/>{alert.suggestion}"
237+
props = {}
238+
if hasattr(alert, 'props'):
239+
props = alert.props
240+
suggestion = ''
241+
if hasattr(alert, 'suggestion'):
242+
suggestion = alert.suggestion
243+
alert_title = ''
244+
if hasattr(alert, 'title'):
245+
alert_title = alert.title
246+
description = ''
247+
if hasattr(alert, 'description'):
248+
description = alert.description
249+
short_desc = (f"{props.get('note', '')}<br/><br/>Suggested Action:<br/>{suggestion}"
238250
f"<br/><a href=\"{socket_url}\">{socket_url}</a>")
239-
full_desc = "{} - {}".format(alert.title, alert.description.replace('\r\n', '<br/>'))
251+
full_desc = "{} - {}".format(alert_title, description.replace('\r\n', '<br/>'))
240252

241253
if unique_rule_id not in rules_map:
242254
rules_map[unique_rule_id] = {

0 commit comments

Comments
 (0)