CM-68446: Render unmaintained package detections in SCA output - #523
CM-68446: Render unmaintained package detections in SCA output#523AradTraub wants to merge 13 commits into
Conversation
| table.add_cell(LICENSE_COLUMN, detection_details.get('license')) | ||
|
|
||
| ossf_score = get_ossf_score(detection_details) | ||
| table.add_cell(OSSF_SCORE_COLUMN, 'N/A' if ossf_score is None else str(ossf_score)) |
There was a problem hiding this comment.
Is this the overall ossf score or the maintained check's score?
There was a problem hiding this comment.
The overall score.
| 'report': ctx.obj.get('report'), | ||
| 'package_vulnerabilities': ctx.obj.get('package-vulnerabilities'), | ||
| 'license_compliance': ctx.obj.get('license-compliance'), | ||
| 'maintainability': ctx.obj.get('unmaintained-packages'), |
There was a problem hiding this comment.
overall might be worth checking:
What happens if the policy is off and the user specified they want to scan unmaintained-packages specifically?
There was a problem hiding this comment.
they will get 0 detections. as the policy is close and this the maintainability will be align, there will be no detection found as the rest of the detection will be filtered out and maintainability will skipped due to the fact that the policy is close
The text printer fell through to the license branch for unmaintained package detections, printing a License row instead of the score. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The unmaintained policy decides on the scorecard's Maintained check, so showing the aggregate as the only number was misleading: a package flagged as unmaintained could display a healthy-looking 4.1. The Maintained score now leads and the aggregate stays as context. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1e259ba to
2284682
Compare
| maintained_score = get_maintained_score(detection_details) | ||
| table.add_cell(MAINTAINED_SCORE_COLUMN, 'N/A' if maintained_score is None else str(maintained_score)) |
There was a problem hiding this comment.
Please put this being policy gate (score is irrelevant for other policies
| if detection.detection_type_id == consts.UNMAINTAINED_PACKAGE_POLICY_ID: | ||
| maintained_score = get_maintained_score(detection_details) | ||
| ossf_score = get_ossf_score(detection_details) | ||
| details_table.add_row('Maintained score', 'N/A' if maintained_score is None else str(maintained_score)) | ||
| details_table.add_row('OSSF Scorecard score', 'N/A' if ossf_score is None else str(ossf_score)) | ||
| details_table.add_row('Scorecard report', get_ossf_report_url(detection_details) or 'N/A') | ||
| elif not detection.has_alert: |
There was a problem hiding this comment.
should this actually be conditional?
| if detection.detection_type_id == consts.UNMAINTAINED_PACKAGE_POLICY_ID: | ||
| maintained_score = get_maintained_score(detection.detection_details) | ||
| ossf_score = get_ossf_score(detection.detection_details) | ||
| maintained = 'N/A' if maintained_score is None else maintained_score | ||
| score = 'N/A' if ossf_score is None else ossf_score | ||
| report_url = get_ossf_report_url(detection.detection_details) or 'N/A' | ||
|
|
||
| summary_lines.append(f'Maintained score: [cyan]{maintained}[/]\n') | ||
| summary_lines.append(f'OSSF Scorecard score: [cyan]{score}[/]\n') | ||
| summary_lines.append(f'Scorecard report: [cyan]{report_url}[/]\n') | ||
| elif detection.has_alert: |
There was a problem hiding this comment.
should this actually be conditional?
Summary
Renders unmaintained-package findings (OpenSSF Scorecard score <= 2) in local SCA scan output. Until now they arrived with an unrecognised policy id and fell through to a table titled "Unknown" with vulnerability-shaped columns.
ossfdetection detail (ossf.score,ossf.scorecard_report_url); the flatossf_scorecard_scorefield no longer exists.No new CLI flag. Whether the policy runs is decided entirely by the tenant's policy state, resolved server-side in dependency-collector — the CLI neither sends nor needs a scan parameter for it. An earlier revision of this branch added a
--sca-scan unmaintained-packagesvalue; it was reverted once the gate moved to the policy, so this PR is rendering only.Testing
ruff check+ruff format --checkclean.pytest: 999 passed, 1 skipped, including new tests for the printer's title, its exact column set and order, and the score fallback when no scorecard is present.