Skip to content

fix(vulns): correct Exposure over-count + native GHSA parity; window & cleanup fixes - #107

Merged
msitarzewski merged 1 commit into
mainfrom
fix/vuln-exposure-parity-ghsa
Jun 22, 2026
Merged

msitarzewski merged 1 commit into
mainfrom
fix/vuln-exposure-parity-ghsa

Conversation

@msitarzewski

Copy link
Copy Markdown
Owner

A batch of vulnerability/Exposure and Storage-card fixes, plus a window-state fix.

Exposure over-count (the headline bug)

The Tauri Exposure card reported 33 findings / 13 packages while the raw brew vulns --quiet --json (and the native shell) reported 17 / 12. Root cause: commands/vulns.rs::scan_all wrote each result into the persistent vulns cache via put() and then returned the entire accumulated cache — keyed by (kind, name, version) and never pruned — so stale records (old versions, packages OSV no longer flags) piled up across scans.

Fix: VulnsCache::replace_full_scan — a full brew vulns run is authoritative for the whole install, so it now clears + replaces the cache (mirrors the native shell's wholesale replace). Both shells now match the raw command. (+1 regression test reproducing the stale-entry accumulation.)

Native GHSA enrichment parity

New VulnsEnrich.swift — a faithful Swift port of src-tauri/src/vulns/enrich.rs: GET api.github.com/advisories/{id}, shared ghsa_cache.json (7-day TTL, LRU, fail-soft), merge summary/details/fixed-in/references (never severity), gated on the GitHub master toggle, wired into scanAllVulns. This also makes the native Settings line "…enriched from api.github.com" actually true. (+16 unit tests mirroring the Rust suite.)

Exposure card parity

Native now tracks scan source (live/cache) and shows the label; both shells unified to "N findings across M of T installed packages · source: X".

Window geometry (#17)

Saves on a debounced resize/move (400ms) in addition to clean exit, so size/position survive dev hot-reloads, force-quits, and crashes — not just a graceful Cmd-Q. (A stale 2700×1892 had been restored with no way to tell it was stale.)

Cleanup estimate refresh

The Storage card's "frees ~X GB" hint now refreshes after a cleanup regardless of exit status, decoupled from the (fallible) disk re-measure so a probe error can't leave a stale number.

Tests

cargo 658 · swift 161 (+16) · vitest 35 · svelte-check 0 errors.

🤖 Generated with Claude Code

…& cleanup fixes

The Tauri Exposure card over-reported (33 findings / 13 packages vs the real
17 / 12 from `brew vulns`). Root cause: `scan_all` wrote results into the
persistent vulns cache via `put()` then returned the ENTIRE accumulated cache —
keyed by (kind, name, version) and never pruned — so stale records (old
versions, packages OSV no longer flags) piled up across scans. Added
`VulnsCache::replace_full_scan`: a full `brew vulns` run is authoritative for
the whole install, so it now REPLACES the cache (mirrors the native shell's
wholesale `vulnFindings = findings`). Both shells now match the raw command.

Native GHSA enrichment parity (new VulnsEnrich.swift): faithful port of
`vulns/enrich.rs` — GET api.github.com/advisories/{id}, shared 7-day
ghsa_cache.json (LRU, fail-soft), merge summary/details/fixed-in/references
(never severity), gated on the GitHub master toggle; wired into scanAllVulns.
Makes the native Settings "enriched from api.github.com" claim true.

Exposure card: native now tracks scan source (live/cache) + shows the label;
both shells unified to "N findings across M of T installed packages · source: X".

Window geometry (#17): debounced save on resize/move (400ms) in addition to
clean exit, so size/position survive dev reloads, force-quits, and crashes.

Cleanup estimate: the Storage card "frees ~X" hint now refreshes after a
cleanup regardless of exit status, decoupled from the (fallible) disk
re-measure so a probe error can't leave a stale number.

Tests: cargo 658, swift 161 (+16 VulnsEnrich), vitest 35, svelte-check clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@msitarzewski
msitarzewski merged commit 6355c90 into main Jun 22, 2026
@msitarzewski
msitarzewski deleted the fix/vuln-exposure-parity-ghsa branch June 22, 2026 00:26
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.

1 participant