Skip to content

RPM analysis UI and API#220

Merged
batzionb merged 1 commit into
RHEcosystemAppEng:mainfrom
batzionb:rpmapi
Jun 2, 2026
Merged

RPM analysis UI and API#220
batzionb merged 1 commit into
RHEcosystemAppEng:mainfrom
batzionb:rpmapi

Conversation

@batzionb
Copy link
Copy Markdown
Collaborator

@batzionb batzionb commented May 6, 2026

RPM package checker analysis (API, UI, reports)

Summary

Implements end-to-end RPM package checker support: users can submit standalone RPM analyses via POST /api/v1/reports/new-rpm-report, browse them on a dedicated reports experience, and open report detail UIs that branch on pipeline_mode === rpm_package_checker. The goal and behavior are specified in OpenSpec under openspec/specs/ (see Related specifications below).

Related specifications (OpenSpec)

Spec Path (repo root) What it covers
New RPM report API openspec/specs/new-rpm-report-api/spec.md POST /api/v1/reports/new-rpm-report, validation parity with upload-spdx-style field maps, Morpheus input.image (pipeline_mode, analysis_type, target_package), OpenAPI
Request Analysis — RPM fields openspec/specs/request-analysis-modal-rpm-fields/spec.md Modal: Package N-V-R + architecture, client parse/validate, useApi submit, 202 navigation
RPM package checker classification openspec/specs/rpm-package-checker-report/spec.md UI/list branching when report.input.image.pipeline_mode is rpm_package_checker
Reports inputType openspec/specs/reports-input-type/spec.md GET /api/v1/reports?inputType=repository|rpm; product-scoped reports excluded; pipeline mode filter
Repository / RPM reports table openspec/specs/repository-reports-table/spec.md RPM tab (/reports/rpm), Package / Architecture columns, rpmPackage literal substring filter, no git repo filter on RPM tab
Request Analysis shell openspec/specs/request-analysis-modal/spec.md Three-way mode toggle including RPM, private-repo suppressed in RPM mode

Supporting updates also appear in document-titles, reports-table, repository-report-page, and schema/template files under openspec/schemas/research-first/.

Backend

  • NewRpmReportRequest, TargetPackage, PipelineMode, CveIdRules: typed request + CVE validation aligned with existing upload flows.
  • RpmReportService: builds Morpheus-compatible input ( rpm_package_checker, analysis_type: source, target_package with ecosystem: rpm ), persists, and submits like POST /api/v1/reports/new.
  • ReportEndpoint: new RPM route; list reports gains inputType and rpmPackage query handling per specs.
  • ReportRepositoryService: list filters for standalone RPM vs repository rows; Mongo $regexMatch on concatenated N-V-R for literal rpmPackage substring (see unit tests).
  • Report, Image: API model extensions (rpmPackage, rpmArchitecture, target package on image) for list/detail consumers.
  • SbomReportService: small refactors where report creation paths are shared.

Frontend

  • Request Analysis: RPM mode (N-V-R field, architecture select), wiring in useAnalysisRequestForm, requestAnalysisRpm, modal components.
  • Reports: RPM tab / routing, inputType=rpm, Package toolbar search → rpmPackage, table columns for package NVR and arch.
  • Repository report / component views: RPM-specific detail sections and artifact cards (RpmAnalysisDetailsSection, RpmTargetPackageArtifactDetails, ContainerRepositoryArtifactDetails, etc.).
  • OpenAPI + regenerated client types/services for the new endpoint and report fields.

Tests & fixtures

  • NewRpmReportRestTest: HTTP contract for POST .../new-rpm-report (202, stored target_package, CVE under scan).
  • ReportListInputTypeRestTest: inputType + RPM tab behavior; seed row identified by rpmPackage NVR (aligned with rpm.json, not hardcoded scan UUID).
  • ReportRepositoryServiceTest: regex escaping for rpmPackage filter.
  • src/test/resources/devservices/reports/rpm.json: devservices seed for RPM checker UI/API tests.

Tooling

  • scripts/submit-rpm-report.sh: example curl helper for the new endpoint (optional for operators).

Test plan

  • Request Analysis: RPM mode — valid N-V-R + arch + CVE → 202, navigation to component report; invalid N-V-R / CVE blocked with field errors.
  • Request Analysis: switching modes clears RPM fields; private repo UI hidden in RPM mode.
  • Reports → RPM tab: rows are standalone RPM checker only; Package filter matches joined N-V-R substring; no repository-name filter.
  • Report detail for RPM checker shows target package / RPM-specific layout vs single-repo layout.
  • GET /api/v1/reports with invalid inputType400; inputType=repository excludes rpm_package_checker rows.
  • Run ./mvnw test (or CI) with Mongo available; spot-check OpenAPI UI for new-rpm-report.

Notes for reviewers

  • openspec/AGENTS.md removal and .cursor/commands/* deletions in the diff are ancillary to the RPM feature; skim if your review scope is product code only.

@batzionb
Copy link
Copy Markdown
Collaborator Author

batzionb commented May 7, 2026

@batzionb batzionb force-pushed the rpmapi branch 2 times, most recently from aaf2dbc to 112dd9e Compare May 7, 2026 11:24
@batzionb batzionb force-pushed the rpmapi branch 2 times, most recently from 544e801 to 551a44e Compare May 20, 2026 09:26
@batzionb batzionb force-pushed the rpmapi branch 7 times, most recently from 8527aa1 to cbf573f Compare May 25, 2026 15:32
@batzionb batzionb changed the title request RPM analysis API RPM analysis UI and API May 25, 2026
@batzionb batzionb marked this pull request as ready for review May 31, 2026 06:16
@batzionb
Copy link
Copy Markdown
Collaborator Author

/retest

@batzionb
Copy link
Copy Markdown
Collaborator Author

/re-test

@batzionb
Copy link
Copy Markdown
Collaborator Author

/retest

@zvigrinberg
Copy link
Copy Markdown
Collaborator

/test morpheus-client-on-pr

Copy link
Copy Markdown
Collaborator

@zvigrinberg zvigrinberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@batzionb LGTM
Just one minor comment, better coordinate the possible values of the architecture field , please coordinate with @RedTanny.
@RedTanny I Think also it's better to have an enum type of the architecture on the agent side. ( accepting also "blank" value means "all" architectures).

@Schema(required = true) String name,
@Schema(required = true) String version,
@Schema(required = true) String release,
@Schema(required = true) String arch,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@batzionb Better have it as enum or validated using hibernate validator' regex to be one of "x86_64", "amd64", "i686","i386", "aarch64", "arm64", "ppc64le", "s390x" , and also allow it to be blank as well.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zvigrinberg what do u mean "( accepting also "blank" value means "all" architectures)."
there can be only one Arch per test , a blank can mean we take the default arch

Copy link
Copy Markdown
Collaborator

@zvigrinberg zvigrinberg Jun 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@batzionb Empty can be default arch ( x86_64/amd64) for that purpose or means that we want it without arch ( architecture agnostic , most vulnerabilities are for all architectures by nature, as relatively only small parts of code are coupled only to a specific cpu arch)...
Anyway needs to be correlated with the agent behavior and logic
@RedTanny can you remind me, are you treating a blank value as some default ( e.g. amd64) or as all arches? ( arch agnostic), this is what i'm remembering from one of the iterations of the review i've made, and also saw this to confirm it:
https://github.com/RedTanny/vulnerability-analysis/blob/1941f95bd2b7fbce18de3c0d7e69a619cfbe8620/src/vuln_analysis/utils/rpm_checker_prompts.py#L97-L103
But maybe you're doing some pre-processing and this is not the assumption on the input.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zvigrinberg yes what you see in prompt is related to the cve info trying to figure out if the cve is tied to a specific Arch and if not mention we assume it is vulnerable for all arch

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the UI there's a dropdown to select architecture, the selected one by default is x86_64
I'll make the API force one of these values for now
We can change it later if need be

zvigrinberg
zvigrinberg previously approved these changes Jun 1, 2026
Copy link
Copy Markdown
Collaborator

@zvigrinberg zvigrinberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@batzionb OK Sounds good to me.
LGTM Approved.

* Allowed RPM target architectures for {@code POST /api/v1/reports/new-rpm-report}
* (aligned with Request Analysis RPM UI).
*/
public enum RpmArchitecture {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@batzionb Just don't forget to add RegisterForReflection annotation.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@batzionb
Copy link
Copy Markdown
Collaborator Author

batzionb commented Jun 1, 2026

@vbelouso
Can you please review the UI part?

@batzionb
Copy link
Copy Markdown
Collaborator Author

batzionb commented Jun 2, 2026

/test morpheus-client-on-pr

Copy link
Copy Markdown
Collaborator

@vbelouso vbelouso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@batzionb batzionb merged commit 23080a5 into RHEcosystemAppEng:main Jun 2, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants