Skip to content

audit F6 [quality]: service-worker registration swallows all errors silently #606

@intendednull

Description

@intendednull

File: crates/web/src/main.rs:17
Severity: quality
Obvious? yes

navigator.serviceWorker.register('/sw.js').catch(function() {}) discards every failure mode: HTTPS misconfiguration, MIME-type mismatch (trunk serving sw.js as text/plain), parse error, or scope violation. Result: notifications and offline cache silently never work, no console output, no telemetry.

Fix: replace the catch with a tracing::warn! (passing the e argument) or at minimum console.warn. The js_sys::eval form here also evades CSP script-src enforcement; consider porting to web_sys::ServiceWorkerContainer::register() so the failure surfaces through proper error handling and the codebase can drop one more 'unsafe-eval' user (per the CSP comment in index.html referencing #171 / #425).


Filed by /general-audit @ 88498a5 (2026-05-04). master: #600.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions