PWA example threat model

Note: This page shows an example threat model for a Progressive Web Application (PWA). CycleTracker is a menstrual cycle tracking PWA that stores only start and end dates in localStorage without third party or external scripts. It can be considered safer than many cloud‑based alternatives. However, even minimal cycle data can reveal sensitive reproductive information, so it makes sense to assess its security in a threat model.

For more information and guidance on how to create a threat model, see the threat modeling guide.

Overview

1. What are we working on?

undefined

Assumptions and scope

This threat model covers CycleTracker, a menstrual cycle tracking PWA that stores only start and end dates in localStorage without third party or external scripts.

Components

IDComponentDescription
C1PWA frontendHTML/CSS/JS
C2Local storageCycle data stored in browser
C3Service workerCaching static assets
C4PWA manifest + icons

Assets

IDAssetDescription
A1Cycle start dates
A2Cycle end dates
A3Derived cycle patternsInferred from A1/A2

Data flows

IDFlowDescription
F1Data submissionUser enters cycle dates which gets written to localStorage
F2App loadBrowser loads PWA assets over HTTPS or from a Service Worker

External dependencies

IDDependencyNotes
E1Web BrowserAssuming default security settings like sandboxing, storage isolation, etc.
E2DeviceAssuming updated OS, lock screen, malware protection
E3HostingAssuming safe guards, provide safeguards, such as DDoS protection

Stakeholders

IDStakeholderInterests / potential harm
S1Cycle tracking userAccount safety, data protection
S2DeveloperMaintainer of code base
S3Anonymous usersAnyone with physical access to the device

2. What can go wrong?

undefined

Identified threats

IDThreatAffected elementsDescription
T1Local device accessC2, A1–A3, F2, S3Someone with physical access to the device opens the PWA and views cycle data.
T2Shared browser profile exposureC2, A1–A3, E1, S1Another person using the same browser profile sees stored cycle data.
T3Browser/OS sync leakageC2, A1–A3, E2Browser or operating system sync or backup uploads localStorage to cloud accounts.
T4Malicious browser extensionsC2, A1–A3, E1Extensions with broad permissions read or modify localStorage.
T5XSSC1, C2, A1–A3, 1Injection vulnerability leading to data theft / attacker can read localStorage.
T6Compromised service workerC3, F2A malicious or tampered service worker exfiltrates data or alters app behavior.
T7Hosting compromiseC1, C3, A1-A3, E3Attacker modifies hosted JS to steal localStorage data.
T8Device malwareC2, A1–A3, E2Malware on the device reads storage.
T9Data corruptionC2, A1-A-3, F1localStorage becomes corrupted, losing cycle data.
T10Inference attacksA1–A3Even minimal data reveals missed periods or pregnancy likelihood.
T11Service worker DoSC3, F2Broken or malicious SW prevents app from loading offline.
T12Legal or forensic seizureA1–A3, S3Authorities accessing the device can read cycle data.
T13Lookalike malicious forksC1, C3, S1A forked version mimics the PWA but steals data.

3. What are we going to do about it?

undefined

Threat responses

ThreatResponse IDStrategyDescription
T1Local device accessReduceEncourage users to secure their device with a passcode/biometrics.
T1Local device accessReduceOptional app-level PIN or passphrase.
T2Shared browser profile exposureReduceProvide guidance to use private browsing or separate profiles.
T2Shared browser profile exposureReduceAdd "Delete all data" button.
T3Browser sync leakageReduceDocument that browser sync may upload data.
T4Malicious extensionsAcceptOutside app control; warn users about extension risks.
T5XSSReduceApply strict Content Security Policy.
T5XSSReduceAvoid inline scripts.
T5XSSReduceKeep code simple and auditable.
T6Compromised service workerReduceKeep SW minimal.
T6Compromised service workerReduceUse versioning and integrity checks.
T6Compromised service workerReduceAvoid dynamic script loading.
T7Hosting compromiseReduceUse HTTPS only hosting (required).
T7Hosting compromiseReduceMonitor repository integrity.
T7Hosting compromiseReduceEncourage users to code their own app or trust only official deployments.
T8Device malwareAcceptOutside our control; recommend OS updates and antivirus.
T9Data corruptionReduceValidate localStorage writes.
T9Data corruptionReduceProvide export/import functionality.
T10Inference attacksAcceptInherent to the nature of menstrual data.
T10Inference attacksAcceptMinimize collected data (already done).
T11Service worker DoSReduceProvide fallback logic if SW fails.
T11Service worker DoSReduceKeep SW logic simple.
T12Legal seizureAcceptOutside our control; warn users; delete data button.
T12Legal seizureAcceptOptional local encryption.
T13Malicious forksReduceDocument official URLs.
T13Malicious forksReduceEncourage code signing or integrity verification where possible.

4. Did we do a good enough job?

undefined

Review status

Follow-up actions

Notes

This threat model is intentionally incomplete and will evolve. Its purpose is to improve shared understanding and guide security decisions, not to guarantee the absence of vulnerabilities.

See also