Skip to content

feat(security): US2 Unified report + cross-scanner consensus confidence (Spec 077) - #788

Closed
Dumbris wants to merge 3 commits into
077-us1-baselinefrom
077-us2-unified-report
Closed

Dumbris wants to merge 3 commits into
077-us1-baselinefrom
077-us2-unified-report

Conversation

@Dumbris

@Dumbris Dumbris commented Jul 1, 2026

Copy link
Copy Markdown
Member

Summary

Spec 077 US2 — one unified, readable report. Collapses the per-scanner
findings into a single deduplicated list, lets independent scanners that agree
on the same issue raise confidence and the risk score (instead of producing
duplicate entries), guarantees every finding carries a severity, and surfaces
source attribution in the Web UI.

Base is 077-us1-baseline — this PR is stacked on US1 (#786). Review/merge US1 first.

Per-task changes

  • T018 / T019 (test-first) internal/security/scanner/sarif_test.go — dedup
    by (rule_id, location) yields exactly one finding; two independent sources
    agreeing on (location, threat_type) boost confidence above single-source.
  • T021 sarif.go MergeFindings + engine.go AggregateReports — merge is
    run after classification; the merged entry's Sources lists every
    contributing scanner (union, sorted, deterministic). Findings with an empty
    rule_id are never merged.
  • T020 sarif.go CalculateRiskScore — matched external/Docker findings on
    (location, threat_type) now ADD to consensus: the issue is counted once,
    weighted by the number of agreeing sources, rather than each flattening to
    weight 1. The legacy per-(rule_id, location) dedup and detect Signals
    weighting are preserved for the empty-threat_type path, so all existing
    scoring tests are unchanged.
  • T022 sarif.go ClassifyThreat — backfills a user-readable severity from
    the classified threat level for external/legacy SARIF findings that arrive
    without one. An explicit severity is never overwritten.
  • T023 frontend/src/views/ScanReport.vue + types/api.ts — the single
    merged finding list now renders a severity badge, a Source(s) row, and a
    consensus xN badge when ≥2 scanners agreed. SecurityScanFinding gains the
    additive sources/tier/confidence/signals fields.

No new third-party dependency. The quarantine state machine
(internal/runtime/tool_quarantine.go) is untouched.

Verification (actual output)

  • go build ./... — clean (exit 0).
  • go test ./... — pass. The only failures were the internal/server
    TestBinary* / TestMCPProtocol* E2E cases, which require a pre-built
    mcpproxy binary (binary not found ... run: go build -o mcpproxy ./cmd/mcpproxy);
    after go build -o mcpproxy ./cmd/mcpproxy && cp mcpproxy internal/server/,
    go test ./internal/server/ passes (exit 0). All other packages green,
    including internal/security/scanner.
  • go run ./cmd/scan-eval --corpus specs/065-evaluation-foundation/datasets/detect_corpus_v1.json --gate --min-recall 0.90 --max-fp 0.05
    → GATE PASSED: recall=1.0000 (>=0.9000), fp=0.0000 (<=0.0500).
  • golangci-lint run --config .github/.golangci.yml ./... → 0 issues.
  • cd frontend && npm run build (vue-tsc && vite build) → built clean.

🤖 Generated with Claude Code

Dumbris added 2 commits July 1, 2026 10:24
Spec 077 US2 (T018-T022). Collapse the per-scanner findings into a single
unified report and let independent scanners agreeing on the same issue raise
confidence and the risk score instead of producing duplicate entries.

## Changes
- MergeFindings: dedup by (rule_id, location) into one entry whose Sources
  lists every contributing scanner; boost confidence when >=2 distinct sources
  agree on the same (location, threat_type) (T018/T019/T021).
- CalculateRiskScore: matched external/Docker findings on (location,
  threat_type) now ADD to consensus (counted once, weighted by the number of
  agreeing sources) instead of flattening to weight 1; legacy per-rule dedup and
  detect Signals weighting preserved for the empty-threat_type path (T020).
- AggregateReports: run MergeFindings after classification so the aggregated
  report carries populated Sources and consensus-boosted confidence (T021).
- ClassifyThreat: backfill a user-readable severity from the classified threat
  level for external/legacy SARIF findings that arrive without one (T022).

## Testing
- New: dedup-to-one, consensus-confidence-boost, cross-source-consensus-score,
  severity-backfill. Existing risk-score/dedup/aggregate tests unchanged.

Related: Spec 077 (specs/077-scanner-simplification)
Spec 077 US2 (T023). Surface the merged, deduplicated finding list in the scan
report: each finding shows its severity, its contributing source(s), and a
"consensus xN" badge when two or more scanners independently agreed. Adds the
additive `sources`/`tier`/`confidence`/`signals` fields to SecurityScanFinding.

## Changes
- api.ts: extend SecurityScanFinding with sources/tier/confidence/signals.
- ScanReport.vue: severity badge + consensus badge in the finding header;
  Source(s) row (falls back to the single scanner id for legacy findings).

## Testing
- vue-tsc + vite build clean.

Related: Spec 077 (specs/077-scanner-simplification)
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 1, 2026 •

Copy link
Copy Markdown

Deploying mcpproxy-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7a2f7e5
Status: ✅  Deploy successful!
Preview URL: https://c3a07ccc.mcpproxy-docs.pages.dev
Branch Preview URL: https://077-us2-unified-report.mcpproxy-docs.pages.dev

View logs

@codecov-commenter

codecov-commenter commented Jul 1, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 95.27027% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/security/scanner/sarif.go 95.23% 6 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@github-actions

github-actions Bot commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

📦 Build Artifacts

Workflow Run: View Run
Branch: 077-us2-unified-report

Available Artifacts

  • archive-darwin-amd64 (28 MB)
  • archive-darwin-arm64 (25 MB)
  • archive-linux-amd64 (16 MB)
  • archive-linux-arm64 (14 MB)
  • archive-windows-amd64 (28 MB)
  • archive-windows-arm64 (25 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (21 MB)
  • installer-dmg-darwin-arm64 (19 MB)

How to Download

Option 1: GitHub Web UI (easiest)

  1. Go to the workflow run page linked above
  2. Scroll to the bottom "Artifacts" section
  3. Click on the artifact you want to download

Option 2: GitHub CLI

gh run download 28503641176 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

…er fields on merge

CalculateRiskScore consensus branch now scores each (location, threat_type)
group at the most-severe threat category and the max per-finding weight among
all agreeing findings, instead of whichever finding was encountered first. For
severity-derived threat_types (supply_chain, uncategorized, malicious_code
fallback) agreeing findings can carry different threat_levels, so the previous
first-wins behavior made the score order-dependent and could drop a genuine
high/warning finding. Extracted a threatCategory helper and precompute the
group max in the existing consensus pass for determinism.

MergeFindings phase-1 dedup now absorbs the duplicate's stronger fields: it
takes max(Confidence), the more-severe Tier (hard > soft via tierRank), and the
union of Signals, so merging a hard/high-confidence finding with a same-
(rule_id, location) soft/low-confidence duplicate no longer discards the hard
tier and higher confidence.

Adds tests locking order-independent max-severity consensus scoring and
max-confidence + hard-tier-wins on merge.

Related: Spec 077
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.

2 participants