Skip to content

feat(analytics): add vulnerability trend analysis endpoint#792

Open
Shreeya1207 wants to merge 1 commit into
utksh1:mainfrom
Shreeya1207:feat/vulnerability-trend-analysis
Open

feat(analytics): add vulnerability trend analysis endpoint#792
Shreeya1207 wants to merge 1 commit into
utksh1:mainfrom
Shreeya1207:feat/vulnerability-trend-analysis

Conversation

@Shreeya1207

Copy link
Copy Markdown
Contributor

Description

This PR introduces the foundation for vulnerability trend analysis and predictive modeling by adding a dedicated analytics endpoint and frontend API support.

Changes Made

Backend

  • Added a new endpoint:
GET /analytics/vulnerability-trends
  • Aggregates vulnerability findings by day using discovered_at

  • Returns the last 30 days of vulnerability activity

  • Includes severity breakdowns:

    • Critical
    • High
    • Medium
    • Low
    • Info
  • Calculates average daily risk score

  • Generates a lightweight forecast using historical findings data

  • Detects trend direction:

    • Increasing
    • Decreasing
    • Stable
    • Insufficient data

Frontend

  • Added TypeScript types for vulnerability trend analytics
  • Added getVulnerabilityTrends() API helper
  • Prepared the frontend for future dashboard visualizations and forecasting widgets

Why

SecuScan currently provides current-state vulnerability metrics but lacks historical visibility into how findings evolve over time.

This enhancement establishes the analytics foundation required for:

  • Vulnerability trend monitoring
  • Historical security posture analysis
  • Forecasting future vulnerability growth
  • More informed remediation prioritization

Validation

  • ✅ TypeScript typecheck passed
  • ✅ Production build passed
  • ✅ Backend route implemented using existing project patterns
  • ✅ No new dependencies added

Future Extensions

  • Dashboard trend charts
  • Historical risk-score visualization
  • Severity trend breakdowns
  • Advanced predictive analytics

@utksh1 utksh1 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for the PR. This needs tests before it can merge.\n\nBlocking issues:\n- The new backend contract has no route coverage. Please add backend tests that seed findings for the current owner and another owner, verify the 30-day filtering, severity buckets, average risk score, forecast fields, and owner isolation.\n- Please cover the empty-data response as well, so the frontend can rely on the and shape.\n\nThe implementation is small and CI is green, but this is a new user-facing analytics endpoint and needs contract coverage before merge.

@utksh1 utksh1 added level:intermediate 35 pts difficulty label for moderate contributor PRs type:feature Feature work category bonus label area:backend Backend API, database, or service work area:frontend Frontend React/UI work labels Jun 12, 2026
@utksh1

utksh1 commented Jun 12, 2026

Copy link
Copy Markdown
Owner

Correction to the review text above: the new GET /analytics/vulnerability-trends backend contract needs route coverage. Please also verify the daily and forecast response shape in tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:backend Backend API, database, or service work area:frontend Frontend React/UI work level:intermediate 35 pts difficulty label for moderate contributor PRs type:feature Feature work category bonus label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants