Skip to content

[CSM Portal] add product vulnerabilities list and detail view - #967

Merged
Rashmika998 merged 1 commit into
wso2-open-operations:v2from
rksk:csm-portal-vulnerabilities-tab
Jun 28, 2026
Merged

Rashmika998 merged 1 commit into
wso2-open-operations:v2from
rksk:csm-portal-vulnerabilities-tab

Conversation

@rksk

@rksk rksk commented Jun 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Builds out the Security Center Vulnerabilities tab (previously a "coming soon" placeholder) against the now-available product-vulnerabilities endpoints. FE-only.

  • Replaces the placeholder with a searchable, paginated vulnerabilities list (POST /products/vulnerabilities/search): debounced text search, priority filter, and columns for CVE / vulnerability id, component, product, priority, type, and update level.
  • Row click opens a detail view (GET /products/vulnerabilities/{id}) at security-center/vulnerabilities/:id showing the scalar fields plus use case / justification / resolution when present.

Implementation

  • Be* vulnerability types in src/api/backend/types.ts; reuses the existing PRODUCT_VULNERABILITIES_SEARCH / PRODUCT_VULNERABILITY query keys.
  • Search + detail hooks mirror the change-requests hook conventions (keepPreviousData, null-on-missing).
  • Priority chip colour mapping in a small utils/vulnerabilities.ts; the priority field is an upstream label, so the colour lookup is case-insensitive.
  • The Security Center page now drives tab selection from the URL (?tab=vulnerabilities) so the detail page's back button lands on the right tab.

Notes

  • useCase / justification / resolution are rendered as plain (pre-wrapped) text since the spec types them as plain strings; if they turn out to carry ServiceNow rich-text HTML, that's a small follow-up to sanitize + render as HTML.

Test plan

  • pnpm build passes
  • pnpm lint clean (one pre-existing unrelated warning)
  • pnpm test — 104 passing
  • Manual: search/filter vulnerabilities, open a detail view, use the back button

Summary by CodeRabbit

  • New Features

    • Added a Vulnerabilities tab in Security Center with searchable, paginated results.
    • Added a vulnerability detail page with back navigation, loading, error, and empty states.
    • Enabled direct navigation to vulnerability details from the list.
    • Updated tab switching to use the URL, making the active tab shareable and persistent.
  • Bug Fixes

    • Added priority labels and color handling so vulnerability severity is displayed more clearly and consistently.

@coderabbitai

coderabbitai Bot commented Jun 28, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@rksk, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 39 minutes and 15 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6238e1d1-4c4f-4466-a024-2df4c2225c2d

📥 Commits

Reviewing files that changed from the base of the PR and between 4bab7ac and d244329.

📒 Files selected for processing (8)
  • apps/csm-portal/webapp/src/App.tsx
  • apps/csm-portal/webapp/src/api/backend/types.ts
  • apps/csm-portal/webapp/src/features/csm-security-center/api/useGetProductVulnerability.ts
  • apps/csm-portal/webapp/src/features/csm-security-center/api/useSearchProductVulnerabilities.ts
  • apps/csm-portal/webapp/src/features/csm-security-center/components/ProductVulnerabilitiesTab.tsx
  • apps/csm-portal/webapp/src/features/csm-security-center/pages/CsmSecurityCenterPage.tsx
  • apps/csm-portal/webapp/src/features/csm-security-center/pages/ProductVulnerabilityDetailPage.tsx
  • apps/csm-portal/webapp/src/features/csm-security-center/utils/vulnerabilities.ts
📝 Walkthrough

Walkthrough

Adds a product vulnerabilities feature to the Security Center: new backend DTOs for vulnerabilities and deployed products, two React Query hooks (single-fetch and search), a searchable/paginated ProductVulnerabilitiesTab, a ProductVulnerabilityDetailPage, URL-driven tab state in CsmSecurityCenterPage, and a new authenticated route /security-center/vulnerabilities/:id.

Security Center Vulnerabilities Feature

Layer / File(s) Summary
Backend DTOs and priority utilities
src/api/backend/types.ts, src/features/csm-security-center/utils/vulnerabilities.ts
Adds deployed-product create/update DTOs and product vulnerability DTOs (BeVulnerabilityPriority, BeProductVulnerabilityView, search payload/response). Adds vulnerabilityPriorityLabel, vulnerabilityPriorityColor, and VULNERABILITY_PRIORITIES utilities.
React Query data-fetching hooks
src/features/csm-security-center/api/useGetProductVulnerability.ts, .../useSearchProductVulnerabilities.ts
useGetProductVulnerability fetches a single vulnerability via GET /products/vulnerabilities/{id} (disabled when id absent). useSearchProductVulnerabilities posts to /products/vulnerabilities/search with keepPreviousData for smooth pagination.
ProductVulnerabilitiesTab component
src/features/csm-security-center/components/ProductVulnerabilitiesTab.tsx
Debounced search input, priority filter, memoized server-side payload, paginated table with loading/error/empty states, and row-click navigation to the detail route.
ProductVulnerabilityDetailPage
src/features/csm-security-center/pages/ProductVulnerabilityDetailPage.tsx
Reads id from route params, fetches vulnerability, renders skeleton/error/not-found guards, then displays heading with priority chip, an Overview card, and a conditional Details card for long-form text fields.
Route and tab wiring
src/App.tsx, src/features/csm-security-center/pages/CsmSecurityCenterPage.tsx
Registers lazy-loaded ProductVulnerabilityDetailPage at security-center/vulnerabilities/:id. Replaces local tab state with useSearchParams-driven ?tab= URL handling; replaces the coming-soon placeholder with ProductVulnerabilitiesTab.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • wso2-open-operations/cs-tools#951: Adds the base /security-center and /security-center/reports/new routes; this PR extends the same routing block with the new vulnerabilities detail route.
  • wso2-open-operations/cs-tools#963: Adds the backend endpoints (GET /products/vulnerabilities/{id} and the search endpoint) that the new hooks in this PR call.

Suggested reviewers

  • cloby99
  • Rashmika998

🐇 A table of vulns, now clickable and bright,
With chips of red, orange, and soft yellow light.
The tab reads the URL, no useState in sight,
Skeletons shimmer while data takes flight—
Hop to the detail page, everything's right! 🎉

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the feature and test results, but it misses most required template sections such as Purpose, Goals, Release note, Documentation, and Security checks. Add the missing template sections or explicitly mark them N/A, including Purpose, Goals, Approach, User stories, Release note, Documentation, Certification, Security checks, and Test environment.
Docstring Coverage ⚠️ Warning Docstring coverage is 70.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: adding the Security Center product vulnerabilities list and detail view.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@rksk rksk added App/CSM Portal Area/Frontend Type/New Feature Represents a request or task for a new feature labels Jun 28, 2026
@rksk

rksk commented Jun 28, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jun 28, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/csm-portal/webapp/src/api/backend/types.ts`:
- Around line 864-869: BeDeployedProductDetailUpdatePayload currently allows an
empty object even though the PATCH contract requires at least one of cores, tps,
or description. Update this type in types.ts to encode a non-empty/at-least-one
constraint using a union or utility type around
BeDeployedProductDetailUpdatePayload so that {} is rejected at compile time
while preserving the existing field types and active?: never exclusion.

In
`@apps/csm-portal/webapp/src/features/csm-security-center/components/ProductVulnerabilitiesTab.tsx`:
- Around line 135-169: The empty-state branch in ProductVulnerabilitiesTab
should not render when the query fails, because `isError` leaves
`vulnerabilities` empty and incorrectly shows “No vulnerabilities found.” Update
the conditional rendering around the `TableBody`/error alert so the error state
takes precedence and the empty-state row only appears when the query succeeded
with zero results. Also ensure the `total` used for pagination is derived from
successful data only, not from an error fallback.
- Around line 172-176: The TableRow click target in ProductVulnerabilitiesTab is
mouse-only, so keyboard users cannot open the vulnerability detail page. Update
the row interaction around the
navigate(`/security-center/vulnerabilities/${vuln.id}`) handler to use proper
link/button semantics via the TableRow or an inner interactive element, or add
focusability plus Enter/Space key handling if the row must remain clickable.
Ensure the interactive target is discoverable and operable from the keyboard
without changing the navigation behavior.
- Line 175: The navigation in ProductVulnerabilitiesTab’s onClick is using
vuln.id directly in the route, which can break for IDs containing reserved URL
characters. Update the route construction to URL-encode vuln.id before passing
it to navigate, and keep the client route segment aligned with the detail flow
that already encodes the backend path.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: db097e63-a466-4e9b-8151-d74f46d662df

📥 Commits

Reviewing files that changed from the base of the PR and between 266dcd0 and 4bab7ac.

📒 Files selected for processing (8)
  • apps/csm-portal/webapp/src/App.tsx
  • apps/csm-portal/webapp/src/api/backend/types.ts
  • apps/csm-portal/webapp/src/features/csm-security-center/api/useGetProductVulnerability.ts
  • apps/csm-portal/webapp/src/features/csm-security-center/api/useSearchProductVulnerabilities.ts
  • apps/csm-portal/webapp/src/features/csm-security-center/components/ProductVulnerabilitiesTab.tsx
  • apps/csm-portal/webapp/src/features/csm-security-center/pages/CsmSecurityCenterPage.tsx
  • apps/csm-portal/webapp/src/features/csm-security-center/pages/ProductVulnerabilityDetailPage.tsx
  • apps/csm-portal/webapp/src/features/csm-security-center/utils/vulnerabilities.ts

Comment thread apps/csm-portal/webapp/src/api/backend/types.ts Outdated
@rksk
rksk force-pushed the csm-portal-vulnerabilities-tab branch from 4bab7ac to ae4d543 Compare June 28, 2026 15:56
Wire up the Vulnerabilities tab in Security Center (previously "coming
soon") with a server-side-paginated table (search + priority filter) and
a read-only detail page. Adds Be* types for the three new schemas, two
react-query hooks against the existing POST /products/vulnerabilities/search
and GET /products/vulnerabilities/{id} endpoints, priority colour/label
utils, and a lazy-loaded route under security-center/vulnerabilities/:id.
Migrates the tab selection to URL search params (?tab=) so the detail
page back-link lands on the correct tab.
@rksk
rksk force-pushed the csm-portal-vulnerabilities-tab branch from ae4d543 to d244329 Compare June 28, 2026 16:07
@Rashmika998
Rashmika998 merged commit 26f3e91 into wso2-open-operations:v2 Jun 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

App/CSM Portal Area/Frontend Type/New Feature Represents a request or task for a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants