Skip to content

Harden dependency audit gate, assignment attribution, and CSP - #8

Merged
zerox80 merged 1 commit into
mainfrom
harden/audit-identity-csp
Jul 1, 2026
Merged

Harden dependency audit gate, assignment attribution, and CSP#8
zerox80 merged 1 commit into
mainfrom
harden/audit-identity-csp

Conversation

@zerox80

@zerox80 zerox80 commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Summary

Follow-up to a full hardening review of HardView (rated 9/10). Closes the three remaining gaps found there:

  • cargo audit was a soft gate. It only fails CI on Vulnerability-class findings, not unmaintained/unsound warnings — 18 of the latter (incl. RUSTSEC-2026-0190, unsoundness in anyhow::Error::downcast_mut(), published days before the review) were passing silently. anyhow is bumped 1.0.102 → 1.0.103 (transitive via tauri, fixes the advisory outright); the remaining 17 are Linux-only GTK bindings, a build-time-only proc-macro crate, and unmaintained Unicode helpers — none reachable on this Windows-only target — now explicitly documented and ignored in app/src-tauri/.cargo/audit.toml. CI now runs cargo audit --deny warnings, so any future advisory not on that curated list fails the build instead of riding along.
  • Assignment audit trail was spoofable. confirmedBy/updatedBy in assignments.json was sourced from %USERNAME%/%USERDOMAIN% env vars, which anything can set before launching the app. Now sourced from the OS-authenticated identity via GetUserNameExW/GetComputerNameExW (windows-sys, already transitively resolved through tauri's own dependency tree — no new supply-chain surface), with the previous env-var logic kept as a per-field fallback for robustness.
  • CSP carried unneeded unsafe-inline. Added object-src 'none' and base-uri 'self'. Dropped style-src 'unsafe-inline' — verified no code relies on the style attribute/setAttribute('style', ...)/cssText; all dynamic styling goes through per-property CSSOM assignment, which CSP's style-src doesn't gate.

Test plan

  • cargo fmt --all -- --check
  • cargo clippy --all-targets -- -D warnings
  • cargo test --all (25/25, incl. a new smoke test for the identity lookup)
  • cargo audit --deny warnings (clean)
  • npm run check / npm test (5/5)
  • Manually launched the real tauri dev build with sample data: dashboard status dots, RAM bars, and avatar backgrounds (all inline-styled) render correctly; sidebar now shows the real authenticated Windows identity/domain instead of the previous env-var-derived value.

🤖 Generated with Claude Code

Closes out the remaining gaps from the hardening review: cargo-audit
previously only failed on Vulnerability-class findings, so an unsound
anyhow advisory (RUSTSEC-2026-0190) rode along silently. The assignment
audit trail (confirmedBy/updatedBy) was sourced from %USERNAME%-style
env vars, which anything can set before launching the app. And the CSP
carried unsafe-inline for styles that the renderer never actually needs.

- Bump transitive anyhow 1.0.102 -> 1.0.103 (fixes RUSTSEC-2026-0190);
  add .cargo/audit.toml documenting the remaining inapplicable/unmaintained
  advisories (Linux-only GTK bindings, build-time-only proc-macro,
  unmaintained Unicode helper crates); tighten CI to
  `cargo audit --deny warnings` so future advisories can't ride along
  unnoticed.
- Replace env-var-derived assignment attribution with the OS-authenticated
  identity via GetUserNameExW/GetComputerNameExW (windows-sys, already
  transitively resolved through tauri's stack), with the previous env-var
  logic kept as a per-field fallback. Verified live: sidebar now shows the
  real logged-in identity and domain instead of a spoofable env var.
- Add object-src 'none' and base-uri 'self' to the CSP; drop the now-
  unnecessary style-src 'unsafe-inline' (all dynamic styling goes through
  CSSOM property assignment, which CSP's style-src doesn't gate). Verified
  live via a real tauri dev build that the dashboard's colored bars,
  avatars, and status dots still render correctly.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@zerox80
zerox80 merged commit 6592a3c into main Jul 1, 2026
9 checks passed
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