@@ -9,6 +9,7 @@ import { fetchSupportedScanFileNames } from './fetch-supported-scan-file-names.m
99import { finalizeTier1Scan } from './finalize-tier1-scan.mts'
1010import { handlePrDiffScan } from './handle-diff-scan.mts'
1111import { handleScanReport } from './handle-scan-report.mts'
12+ import { isSlackNotificationConfigured } from './notifications/slack-webhook.mts'
1213import { outputCreateNewScan } from './output-create-new-scan.mts'
1314import { performReachabilityAnalysis } from './perform-reachability-analysis.mts'
1415import {
@@ -576,6 +577,27 @@ async function createNewScan(
576577
577578 // A scan without --reach would upload a leftover report as an SBOM with
578579 // stale reachability results; a failed scan keeps it for debugging.
580+ const reachabilityEnabled =
581+ reach . runReachabilityAnalysis && ! reachabilityFallback
582+ let notificationReachabilityFacts : unknown
583+ if (
584+ report &&
585+ fullScanCResult . ok &&
586+ reachabilityEnabled &&
587+ reachabilityReport &&
588+ isSlackNotificationConfigured ( )
589+ ) {
590+ try {
591+ notificationReachabilityFacts = JSON . parse (
592+ await fs . readFile ( path . resolve ( cwd , reachabilityReport ) , 'utf8' ) ,
593+ ) as unknown
594+ } catch {
595+ logger . warn (
596+ 'Reachability facts could not be read for Slack notifications; findings will be marked unclassified.' ,
597+ )
598+ }
599+ }
600+
579601 if (
580602 fullScanCResult . ok &&
581603 scanId &&
@@ -604,7 +626,12 @@ async function createNewScan(
604626 outputKind,
605627 pythonJsonFormat,
606628 pythonJsonContext,
607- notificationContext : { repository : repoName , branch : branchName } ,
629+ notificationContext : {
630+ repository : repoName ,
631+ branch : branchName ,
632+ reachabilityEnabled,
633+ reachabilityFacts : notificationReachabilityFacts ,
634+ } ,
608635 } )
609636 } else {
610637 await handleScanReport ( {
@@ -616,7 +643,12 @@ async function createNewScan(
616643 reportLevel,
617644 scanId,
618645 short : false ,
619- notificationContext : { repository : repoName , branch : branchName } ,
646+ notificationContext : {
647+ repository : repoName ,
648+ branch : branchName ,
649+ reachabilityEnabled,
650+ reachabilityFacts : notificationReachabilityFacts ,
651+ } ,
620652 } )
621653 }
622654 } else {
0 commit comments