Commit Graph

372 Commits

Author SHA1 Message Date
Jordan Ramos
8d82245c86 Update CHANGELOG for v2.0.0 release 2026-05-26 14:10:42 -06:00
Jordan Ramos
37c0970102 Fix Clear Completed button failing on queue items with Jira ticket links
The DELETE /completed endpoint failed with a FK violation when completed
queue items had associated rows in jira_ticket_queue_items. Replaced the
bare DELETE query with a transaction that removes junction table references
before deleting the queue items themselves.

Transaction sequence: BEGIN → SELECT completed IDs → DELETE junction rows →
DELETE queue items → COMMIT, with ROLLBACK on error and client release in
finally block.
2026-05-26 14:07:15 -06:00
Jordan Ramos
dd6fc394ea Show compliant/total counts on metric summary cards
Display raw counts alongside percentages in the compliance metric health
cards, e.g. '67% (4/6)' instead of just '67%'. Data was already available
in the summary JSON (compliant, total fields) — just not rendered.

Closes #16
2026-05-26 11:48:53 -06:00
Jordan Ramos
bfd1c4986f Fix env sourcing for CI test runner
GitLab CI runs each script line in a separate shell context, so sourcing
.env on one line doesn't carry to the next. Use export $(grep ...) on the
same line as jest to ensure DATABASE_URL is in the process environment.
2026-05-26 11:26:44 -06:00
Jordan Ramos
7f6f458949 Fix migration integration test for CI runner
Source DATABASE_URL from /home/cve-dashboard/backend/.env in test-backend job
so the integration test can connect to the local Postgres instance.

The test now skips gracefully via describe.skip when DATABASE_URL is unavailable
(defensive fallback), but with the env sourced it will run and validate migrations.
2026-05-26 11:22:39 -06:00
Jordan Ramos
caf6ca4008 Add per-metric remediation plans and improve CI pipeline
Per-metric remediation plan scoping (GitLab issue #19):
- Add metric_id column to compliance_item_history table (migration)
- Extend PATCH /items/:hostname/metadata to accept metric_id/metric_ids
  for targeting specific metrics instead of all active items
- Add MetricChipSelector UI in detail panel for choosing which metrics
  to apply resolution_date and remediation_plan changes to
- Display per-metric labels (MetricChip or 'All metrics') on history entries
- Backward compatible: omitting metric_ids preserves hostname-level behavior

CI/CD pipeline improvements:
- Add migration idempotency integration test (runs against real Postgres)
- Add post-deploy smoke tests for compliance and VCL endpoints
- Bump lint --max-warnings from 10 to 25
- Configure varsIgnorePattern for _ prefix convention on unused vars

Closes #19
2026-05-26 11:16:28 -06:00
Jordan Ramos
33e449f520 Add Jira Tickets, CCP Metrics, and Remediation Status export cards
New export cards on the Exports page:

- Jira Tickets: All tickets, open/active only, by-CVE multi-sheet
- CCP Compliance Metrics: Current snapshot, non-compliant devices,
  trend history, full multi-sheet report
- Remediation Status: Cross-domain report combining CVEs, Jira tickets,
  Archer exceptions, and Ivanti findings into a per-CVE progress view
2026-05-22 14:15:06 -06:00
Jordan Ramos
e2fae896dc Fix status badge background making text invisible
The badge() style function used rgb-to-rgba string replacement for
the background, which doesn't work with hex colors. Hex colors passed
through unchanged as opaque backgrounds, hiding the text. Use hex
alpha notation (color + '26' = ~15% opacity) instead.
2026-05-22 13:59:20 -06:00
Jordan Ramos
fd144966b7 Strengthen migration registration hook to postToolUse/write
The fileCreated hook was not reliably enforced. Switch to postToolUse
on write operations so the check fires inline immediately after any
file write, making it impossible to skip. The prompt self-filters to
only act when the written file is in backend/migrations/.
2026-05-22 13:55:20 -06:00
Jordan Ramos
392e4917b6 Register drop_jira_status_check_constraint in run-all.js 2026-05-22 13:52:51 -06:00
Jordan Ramos
c19d549ae8 Show raw Jira status everywhere instead of mapping to Open/In Progress/Closed
- Drop CHECK constraint on jira_tickets.status to allow any status string
- Store raw Jira status directly in status column during sync (remove mapJiraStatusToLocal)
- Remove VALID_TICKET_STATUSES validation on create/update endpoints
- Remove separate Jira Status column from table (status IS the Jira status now)
- Update frontend status badges to color-code dynamically based on status category
- Update Open Tickets widget and CVE detail view to use isClosedStatus() helper
- Make filter dropdown dynamic based on actual ticket statuses
- Add migration script for dropping the constraint on other deployments
2026-05-22 13:44:25 -06:00
Jordan Ramos
2edf6228ff Fix calendar SLA dates not highlighting after Postgres migration
PostgreSQL DATE columns return JS Date objects which serialize to ISO
timestamps (e.g. 2025-05-22T00:00:00.000Z). The CalendarWidget expects
plain YYYY-MM-DD strings for its date key lookup. Added formatDate()
helper to normalize due_date and last_found_on before sending the
API response.
2026-05-22 13:13:54 -06:00
Jordan Ramos
8f42f9d9c3 Remove unused API_HOST variable to fix ESLint warning count 2026-05-22 12:59:58 -06:00
Jordan Ramos
8788b1e91a Fix document View link using localhost instead of relative URL
The View button for documents was constructing the href as
API_HOST + file_path which resolved to http://localhost:3001/...
Since the frontend is served from the same Express server, this
should be a relative path. Users' browsers don't have localhost:3001
running, so the link was broken for anyone not on the server itself.
2026-05-22 12:56:45 -06:00
Jordan Ramos
60bb86f2ea Validate library doc file types before sending to Ivanti API
Library documents from the knowledge base were not checked against
the allowed file extensions before being sent to Ivanti. If a doc
had an unsupported type (e.g. .msg, .eml), Ivanti would reject the
entire workflow with a 400. Now validates library docs the same way
as local uploads and returns a clear error naming the offending file.

Allowed: .pdf, .png, .jpg, .jpeg, .gif, .doc, .docx, .xlsx, .csv, .txt, .zip
2026-05-22 12:40:54 -06:00
Jordan Ramos
19b5009010 Improve FP workflow error messages — include Ivanti API response body
When the Ivanti API returns a non-success status, the error message
now includes the actual response body from Ivanti instead of just
the HTTP status code. This makes troubleshooting much easier since
you can see what Ivanti rejected (e.g. invalid field, too many
attachments, malformed request).
2026-05-22 11:51:10 -06:00
Jordan Ramos
de4ff3f084 Add success toast after consolidated Jira ticket creation
Shows a notification with the ticket key (e.g. STEAM-2672) as a
clickable link to the Jira issue. Auto-dismisses after 8 seconds.
Errors are already shown inline in the ConsolidationModal.
2026-05-22 11:42:02 -06:00
Jordan Ramos
c9f93a2a9b Wire ConsolidationModal into QueuePanel slide-out on Reporting page
The multi-select consolidated Jira ticket feature was built into a
standalone page that doesn't exist. This wires it into the actual
QueuePanel slide-out where users work. Adds a '+ Jira (N)' button
to the footer action bar that opens the ConsolidationModal when 2+
items are selected, or the single-item Jira modal for 1 item.
2026-05-22 11:29:09 -06:00
Jordan Ramos
76667f65c6 Fix ESLint react-hooks/exhaustive-deps warning in ConsolidationModal 2026-05-22 11:19:46 -06:00
Jordan Ramos
6b805ee633 Add multi-item Jira ticket creation from Ivanti Queue
Select multiple queue items and create a single consolidated Jira ticket
with aggregated summary and description. Adds multi-select mode with
checkboxes, floating action bar, consolidation modal, and junction table
to track which queue items contributed to each ticket.

- Migration: jira_ticket_queue_items junction table
- POST /api/jira-tickets/:id/queue-items endpoint
- GET /api/ivanti/todo-queue/ticket-links endpoint
- ConsolidationModal component with aggregation logic
- IvantiTodoQueuePage with selection mode and ticket link badges
- Pure utility functions for summary/description generation
- 34 tests passing (backend + frontend)
2026-05-22 11:12:45 -06:00
Jordan Ramos
704432788c Add missing jira_tickets sync columns migration and improve error messages
- Add add_jira_sync_columns_pg.js migration (jira_id, jira_status, last_synced_at, created_by)
- Register in run-all.js before the flexible creation migration
- Replace all generic 'Internal server error' with actual err.message in jiraTickets routes
- Users and admins can now see the real failure reason instead of a useless generic message
2026-05-22 10:12:35 -06:00
Jordan Ramos
e86dd8be15 Improve Jira lookup error messages and make local POST cve_id/vendor optional
- Pass through actual Jira error details instead of generic 'Jira API error'
- Parse errorMessages and errors from Jira response for human-readable display
- Make cve_id and vendor optional on local POST /api/jira-tickets (for Save to Dashboard)
- Update getIssue comment for clarity (logic unchanged — JQL search per compliance spec)
2026-05-22 09:55:14 -06:00
Jordan Ramos
6148f06a95 Add VCL metric calculations guide and clean up CCPMetricsPage
- Add docs/guides/vcl-metric-calculations.md with full metric formula reference
- Simplify CCPMetricsPage component (remove unused code)
2026-05-22 09:42:11 -06:00
Jordan Ramos
758a300f67 Add issue type dropdown and Save to Dashboard from lookup
- Replace issue type text input with dropdown of STEAM project types (Story default)
- Add Save to Dashboard button on lookup results to link existing Jira tickets locally
- Make cve_id and vendor optional on local POST /api/jira-tickets endpoint
- Fix: use normalized values in local ticket INSERT query
2026-05-21 16:01:31 -06:00
Jordan Ramos
dff1fa3cc9 Add flexible Jira ticket creation — CVE/Vendor optional, source context tracking
Make CVE ID and Vendor optional when creating Jira tickets. Add source_context
field to track ticket origin (cve, archer, ivanti_queue, email, manual).

- Migration: drop NOT NULL on cve_id/vendor, add source_context column with CHECK
- Backend: update create/update/get endpoints for optional fields and source_context
- Frontend: update creation modal with optional labels and source context dropdown
- Add Create Jira Ticket action from Ivanti queue (pre-populates from finding)
- Add Create Jira Ticket action from Archer detail view (pre-populates from ticket)
- Add source context badge column, filter dropdown, and search to ticket list
2026-05-21 15:07:32 -06:00
Jordan Ramos
940cb3251c Fix forecast chart bar order and snapshot month derivation
Flip stacked bar chart so non-compliant (orange) renders on top and
compliant (blue) on bottom for better visual emphasis.

Use the file's report_date for compliance_snapshots month instead of
the current date, so historical uploads land in the correct monthly
bucket. Also fix rollback to delete the correct month's snapshot.

Remove cve-frontend systemd service ( Express serves theredundant
built frontend on port 3001).
2026-05-21 12:22:52 -06:00
Jordan Ramos
ae2b7e0433 Fix forecast deduplication for multi-vertical metrics
Devices appearing in multiple verticals were counted multiple times,
causing non_compliant > totalAssets and negative compliance percentages.
Deduplicate by hostname before passing to the forecast helper.
2026-05-20 17:53:29 -06:00
Jordan Ramos
e45deccdb7 Fix forecast burndown chart data issues
- Fix Date object handling for resolution_date from PostgreSQL
- Fix totalAssets using per-metric summary (vcl_multi_vertical_summary)
  instead of vertical-level compliance_snapshots total_devices
- Fix duplicate current month in chart (forecast starts from next month)
- Fix multi-vertical metrics summing across all relevant verticals
- Fix bar stacking: orange (non-compliant) on bottom, blue (compliant)
  on top, both sharing same baseline (stacked to total)
- Add fill props to Bar components for correct legend colors
- Backfill historical snapshots with per-metric totalAssets
2026-05-20 17:28:20 -06:00
Jordan Ramos
f9770872ba Add Jira production UAT test script, update CHANGELOG
- Jira UAT test script for production API validation (all 10 use cases)
- CHANGELOG updates for recent features and fixes
2026-05-20 16:15:37 -06:00
Jordan Ramos
f9b96e9040 Add per-metric forecast burndown chart to CCP Metrics page
New feature: combined historical + forecast burndown chart with metric
selector on the CCP Metrics page. Shows stacked bars (total assets vs
non-compliant) with a compliance percentage trend line. A bold divider
separates actual historical data from projected future remediation.
Forecast assumes constant asset count and on-schedule remediation plans.

Backend:
- computeMetricForecastBurndown helper in vclHelpers.js (pure function)
- GET /api/compliance/vcl-multi/metrics-list endpoint
- GET /api/compliance/vcl-multi/metric/:metricId/forecast-burndown endpoint

Frontend:
- MetricSelector dropdown with device counts per metric
- ForecastBurndownChart using recharts ComposedChart (Bar + Line + ReferenceLine)
- Forecast bars render at 50% opacity to distinguish from actuals
- Race condition handling for rapid metric switching
- Queue panel width increased from 420px to 600px

Closes #18
2026-05-20 16:15:21 -06:00
Jordan Ramos
df31cc3c79 Update JQL property test to reflect cross-project sync fix
The project filter was intentionally removed from searchIssuesByKeys() to
fix cross-project ticket sync. Update the property test to no longer assert
the presence of 'project =' in the generated JQL.
2026-05-20 14:01:28 -06:00
Jordan Ramos
ddc3af9147 Fix lint warnings (eslint-disable for unused legacy components) 2026-05-20 13:58:51 -06:00
Jordan Ramos
56bd5ca148 Restructure CCP Metrics to metric-first hierarchy, fix Jira cross-project sync
CCP Metrics View Restructure:
- Add GET /metrics endpoint (aggregated across verticals)
- Add GET /metric/:id/verticals endpoint (per-vertical breakdown)
- Replace VerticalTable with MetricTable on overview (one row per metric)
- Add MetricDetailView for metric-first drill-down
- Restructure navigation: Metric → Vertical → Subteam → Devices
- Remove By Vertical table from AggregatedBurndownChart

Jira Sync Fix:
- Remove hardcoded project filter from getIssue() and searchIssuesByKeys()
- Issue keys are globally unique; project filter broke cross-project tickets
- Fixes 502 Bad Gateway when syncing tickets from non-STEAM projects
2026-05-20 13:30:22 -06:00
Jordan Ramos
64d5e0cb40 Fix CCP Metrics page crash for non-Admin users
CCPMetricsPage called isEditor() which does not exist in AuthContext.
Admin users were unaffected due to JS short-circuit evaluation on
isAdmin() || isEditor(). Standard_User accounts hit TypeError because
isEditor was undefined.

Replaced isEditor() with canWrite() which is the correct auth helper
for write-capable users (Admin + Standard_User).

Closes #15
2026-05-20 11:41:40 -06:00
Jordan Ramos
0c99420f17 Fix CCP Metrics crash when donut chart has zero non-compliant devices
Recharts PieChart throws internally when all data segments are zero.
Guard against this by rendering a friendly message instead of passing
all-zero data to the chart component.

Affects users whose vertical data has no non-compliant items.
2026-05-19 14:59:08 -06:00
Jordan Ramos
f00a1ce7bb Replace Webex bot with in-app notification system
Org blocks external Webex bots, so replaced the DM approach with an in-app
notification bell. GitLab webhook still fires on issue close, but now writes
to a notifications table instead of calling Webex API.

- New: notifications table + migration
- New: GET/PATCH/POST /api/notifications endpoints
- New: NotificationBell component (bell icon + badge + dropdown)
- Removed: backend/helpers/webexBot.js (org-blocked)
- Removed: WEBEX_BOT_TOKEN from .env
2026-05-18 17:15:05 -06:00
Jordan Ramos
00bf92a2a1 Add screenshot uploads to feedback modal, Webex bot DM on issue close
- Feedback modal now supports up to 3 image attachments (PNG/JPG/GIF/WebP, 5MB
  each) with thumbnail previews. Images are uploaded to GitLab project uploads
  and embedded as markdown in the issue description.
- New webhook endpoint (POST /api/webhooks/gitlab) receives issue close events,
  parses the submitter from the description, looks up their email, and sends a
  Webex DM via the Patches O'Houlihan bot.
- New helper: backend/helpers/webexBot.js (fire-and-forget DM sender).
- Requires WEBEX_BOT_TOKEN and GITLAB_WEBHOOK_SECRET in backend/.env.
2026-05-18 16:54:00 -06:00
Jordan Ramos
520f50fbbf Fix duplicate failing metrics on same asset across compliance endpoints
Deduplicate (hostname, metric_id) rows across verticals using DISTINCT ON in
GET /items, GET /items/:hostname, GET /vcl/stats (heavy-hitters + forecast),
GET /mttr, and persistUpload() snapshot block. Add defensive groupByHostname
Set and hostname_status CTE for snapshot classification.

Includes 38 property-based tests (11 exploration + 27 preservation) covering
all six affected sites.

Closes #13
2026-05-18 15:57:10 -06:00
Jordan Ramos
da5505bd27 Add pipeline-to-issue traceability via after_script comments
deploy-staging and deploy-production now parse #N references from the commit
message and post a deployment comment on each referenced GitLab issue with a
link to the pipeline. Requires GITLAB_PAT CI/CD variable (see steering docs).
2026-05-18 15:18:12 -06:00
Jordan Ramos
3814de5845 Fix duplicate chart entries on compliance page when multiple verticals share a report_date
Aggregate /trends, /top-recurring, /category-trend by report_date instead of
per-upload row. Add sibling-upload disclosure to /summary. Filter persistUpload
snapshot query by the upload's vertical to prevent cross-vertical contamination.

Fixes GitLab #12 (reported by nkapur — STEAM active findings chart showed 3
entries for 5/11 after uploading three vertical data sets for that date).

Includes 30 property-based tests covering bug condition and preservation.
2026-05-18 15:00:53 -06:00
Jordan Ramos
487489e26c Add unified setup script (configure.js) merging deploy + config wizard
Single-file Node.js CLI that orchestrates the full setup lifecycle:
- Interactive env var configuration with validation and smart defaults
- Postgres provisioning via Docker Compose with readiness polling
- Schema initialization (psql with docker exec fallback)
- npm dependency installation with 120s timeout
- Optional SQLite-to-Postgres data migration with retry logic
- Frontend build with smart skip on reconfiguration

Includes 84 tests: 50 property-based (fast-check) covering 19 correctness
properties, and 34 integration tests for filesystem and parsing flows.
2026-05-18 11:58:21 -06:00
Jordan Ramos
3643c123b4 Fix requeue inserting Postgres array literal instead of JSON into cves_json 2026-05-15 17:41:38 -06:00
Jordan Ramos
be1d357692 Fix todo queue crash on malformed cves_json data 2026-05-15 17:31:19 -06:00
Jordan Ramos
492780fd90 Add aggregated burndown forecast to CCP Metrics overview page 2026-05-15 17:08:55 -06:00
Jordan Ramos
4d255209fd Group history entries together, remove (optional) from change reason
1. History entries saved at the same time by the same user now display
   as a single grouped entry (resolution date + remediation plan together)
2. Removed '(optional)' from the change reason placeholder — engineers
   should treat it as expected, even though the backend allows empty
3. Save button now saves both resolution date AND remediation plan in one
   call (removed the onBlur auto-save on the date field) so they share
   a timestamp and group correctly in history
2026-05-15 15:31:56 -06:00
Jordan Ramos
1fe6c1f84c Add remediation plan and resolution date history tracking
New table compliance_item_history stores an append-only audit trail of
changes to resolution_date and remediation_plan. The current values remain
on compliance_items for fast VCL reporting queries (no double-counting).

Backend:
- Migration: creates compliance_item_history with indexes
- PATCH /items/:hostname/metadata: records old→new in history before updating,
  accepts optional change_reason field (max 500 chars)
- GET /items/:hostname: returns history array (last 10 entries, newest first)
- POST /vcl/bulk-commit: records history for each changed field per hostname

Frontend:
- ComplianceDetailPanel: added change reason input below Save button
- Added Change History section showing field changes with timestamps,
  usernames, old→new values, and reasons
- Re-fetches detail after save to show updated history immediately

Tests updated to match new transaction-based PATCH flow.
2026-05-15 10:53:14 -06:00
Jordan Ramos
97e5d68d8e Fix AEO compliance page not showing metric health cards on dev
The /summary endpoint was fetching the most recent upload regardless of
vertical, which on dev was a PRDCT_VSO multi-vertical upload. Now it
looks for AEO uploads (vertical IS NULL) first, then falls back to the
NTS_AEO multi-vertical upload.

The /items endpoint now includes items from both vertical IS NULL and
vertical = 'NTS_AEO' so the AEO compliance page shows devices uploaded
through either flow.
2026-05-14 15:39:25 -06:00
Jordan Ramos
b808d0e38e Color metric card percentage green/yellow/red based on target, keep NC count always red 2026-05-14 15:30:43 -06:00
Jordan Ramos
a72300475b Clean up metric breakdown panel — compact grid, top 8 with show-all toggle
Replaced the large flex-wrap button cards with a tight CSS grid of compact
cells (130px min). Each cell shows metric ID, current %, and NC count only.
Category text and target removed to reduce noise.

Capped to top 8 metrics by default with a 'Show all N' toggle for the rest.
Removes visual clutter while keeping the data accessible.
2026-05-14 15:29:20 -06:00
Jordan Ramos
7577ab1219 Make Non-Compliant stat clickable — reveals metric breakdown buttons
Clicking the Non-Compliant card on the CCP Metrics overview now toggles a
panel of metric buttons below it, each showing the metric ID, category,
non-compliant count, and compliance % vs target. Styled like the compliance
page's MetricHealthCard pattern.

Backend: added metric_breakdown to the /stats response — aggregated
cross-vertical metric totals (ALL: rows only, grouped by metric_id).

Also updated tech steering file to document the single-port Express
architecture and the requirement to run npm run build after frontend changes.
2026-05-14 15:24:10 -06:00