Skip to content

Commit 756a8be

Browse files
committed
fix(core): fall back to humanized title for unmapped alert types
Resolves CUS2-2: gptDidYouMean and any future alert type without SDK metadata previously rendered as a blank Alert column in the CLI output table, SARIF report, and PR/security comments. Title resolution now falls back through an explicit override map and a generic humanizer.
1 parent e31ab9b commit 756a8be

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

socketsecurity/core/__init__.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,11 +1423,19 @@ def add_package_alerts_to_collection(self, package: Package, alerts_collection:
14231423
alert = Alert(**alert_item)
14241424
props = getattr(self.config.all_issues, alert.type, default_props)
14251425
introduced_by = self.get_source_data(package, packages)
1426-
1427-
# Handle special case for license policy violations
1426+
1427+
# Title resolution order:
1428+
# 1. SDK-provided title (props.title) if non-empty
1429+
# 2. Explicit override for known-but-unmapped alert types (e.g. gptDidYouMean)
1430+
# 3. Hard-coded special cases (e.g. licenseSpdxDisj)
1431+
# 4. Humanized alert.type as last-resort fallback
14281432
title = props.title
1429-
if alert.type == "licenseSpdxDisj" and not title:
1433+
if not title:
1434+
title = _ALERT_TYPE_TITLE_OVERRIDES.get(alert.type, "")
1435+
if not title and alert.type == "licenseSpdxDisj":
14301436
title = "License Policy Violation"
1437+
if not title:
1438+
title = _humanize_alert_type(alert.type)
14311439

14321440
issue_alert = Issue(
14331441
pkg_type=package.type,

0 commit comments

Comments
 (0)