What we were looking at
This app manages sensitive patient health data entirely on the user’s device—no cloud backend, no remote database. Records sync across devices through the platform’s built-in cloud service. Users import medical records from hospitals and clinics, scan paper documents with AI-powered extraction, and manage conditions, medications, and care team members.
The app includes an on-device AI feature for clinical queries, an integration point for external AI tools, and multiple entry points: the main app, URL scheme links, a document sharing extension, and an AI tool interface that accepts commands over a local connection.
The architecture is well-structured—clean separation of models, views, and services with a solid design system. The question wasn’t whether the app worked. It was whether it was safe to ship when it handles real patient health data.
Not everything was broken
Domain modeling is excellent
The data schema accurately represents clinical relationships with proper entity separation. The audit trail captures category, source, and per-entity change records.
Medical record import pipeline
The import system handles industry-standard health data bundles with resource partitioning, patient matching heuristics, and a well-designed deduplication system.
On-device AI architecture
The AI integration for clinical entity extraction, including a hallucination detection sentinel and a search pipeline for clinical queries, all runs without sending health data to cloud services.
Clean secrets and dependencies
The entire codebase is clean of hardcoded API keys, tokens, and credentials. All dependencies are actively maintained and pinned at stable versions. No abandoned libraries.
This wasn’t a case of sloppy code. The app had strong foundations, a solid design system, and thoughtful architecture. The problems were at the edges—where external input enters the app and where sensitive data leaves the protected database.
What would have caused real damage
The app’s URL scheme for importing medical records accepts any remote URL without user confirmation or domain restrictions. A specially crafted link can fetch data from any server on the internet and write it directly to the patient file—silently, with no UI, no notification, and no log entry. Corrupted data would sync to all devices via cloud sync.
remoteURL = URL(string: urlValue) // accepts any URL, no domain check
// when silent=true, no notification, no UI, no log to user
Never honor silent mode for remote imports. Add a domain allowlist for trusted medical record sources. Always require user confirmation before writing imported data.
The app exposes an interface that lets external AI tools read and write patient data. This interface accepts connections from any local process with no login, no token, and no permission check. Any app on the device could silently add medications, create diagnoses, or modify clinical records—and the user would have no way to know it happened.
// No auth check before handling commands
// Writes bypass the activity audit trail
The audit also found: debug commands compiled into the production app (five developer-only routes accessible to any app or website), biometric auth silently bypassed on failure (the app falls back to open access instead of prompting for a passcode), a full plaintext dump of all AI-extracted health data written to disk on every document import, and a screen reader blocker in the onboarding flow that prevented VoiceOver users from completing setup.
Where sensitive data leaks
The app’s database is properly secured. But condition names, medication names, and medical codes were leaking into system logs, debug dump files, event logs, and a concentrated personal data table—all outside the database’s protections. Any backup tool, diagnostic utility, or process with container access could read them.
Beyond security
Plus 23 more findings across security, performance, code quality, architecture, and scalability. Each with severity, code evidence, a suggested approach, and an effort estimate.
Production readiness roadmap
Close all critical security vulnerabilities. Auth on every entry point, remove debug routes from production, fix biometric bypass, delete the plaintext health data dump.
Seal data leaks in logs and event files. Add database indexes. Fix delete confirmation UX. Hide developer tools. Add security tests.
Adopt design system tokens consistently, add repository abstraction layer, optimize AI query pipeline, enforce data protection classes.
Full accessibility compliance, complete design token adoption, CI lint rules for security patterns, archive file validation.
This app had strong engineering. The domain modeling, the AI architecture, the import pipeline—all well-built. The audit found the gaps at trust boundaries that are invisible during normal development: where external input enters, where sensitive data leaves the protected database, and where developer conveniences ship to production. 35 unknowns became a prioritized, actionable roadmap.