thomabig
10/09/2025, 8:49 PMcody
10/10/2025, 1:10 AMMedplumClient stores tokens in localStorage by default. This is a deliberate design choice that balances security with implementation complexity, and aligns with practices used by many major platforms including Auth0, Okta, and AWS Amplify when configured for static SPAs.
Regarding the GDPR/HIPAA concern: It's important to clarify that the risk to patient data comes from the XSS vulnerability itself, not the token storage location. If an attacker can execute JavaScript in your application:
* They can make API calls as the user regardless of token storage location
* They can capture any data the user enters or views
* They can modify the application UI to phish credentials
* Even with httpOnly cookies, they can still perform actions on behalf of the user while they're active
HIPAA's Security Rule requires "reasonable and appropriate" technical safeguards but does not prescribe specific implementation details like token storage methods. The key requirements are around access controls, encryption in transit, and audit logging - all of which Medplum provides regardless of token storage location.
The real HIPAA/GDPR risk here is XSS itself, not localStorage. An XSS vulnerability that allows access to patient data is the compliance issue, regardless of how authentication tokens are stored. Once an attacker has JavaScript execution in your application context, they have session-level access to PHI whether or not they can persist tokens.
Medplum does support httpOnly cookie authentication for customers who require it. This involves:
* Setting up a backend proxy service
* Configuring CORS and CSRF protections
* Managing secure cookie settings
* Implementing proper session handling
We typically help enterprise customers implement this more complex configuration. For your current setup, we recommend focusing on XSS prevention:
* Implement strict Content Security Policy headers
* Ensure all user input is properly sanitized
* Keep dependencies updated
* Use Medplum's built-in CORS configuration correctly
If moving to cookie-based auth is a requirement from your pentest, we can discuss the implementation requirements and what tier of support would include assistance with that configuration.
This is a complicated topic. Please let me know if you would like to discuss more offline.thomabig
10/10/2025, 8:29 AMchiron
10/11/2025, 5:40 PMthomabig
10/13/2025, 9:26 AMthomabig
05/27/2026, 5:50 PMthomabig
05/27/2026, 7:10 PMthomabig
06/02/2026, 2:29 PMthomabig
06/04/2026, 7:54 AM