Safeguard
Security Guides•

What should a health app log to detect abuse of patient records?

Log access and authentication events, not content. A list of events to record in a health app, with detection ideas, based on OWASP's logging guidance.

Safeguard Security Team
3 min read

A health app should log authentication events, access control failures, record access by who and when, administrative actions and input validation failures, with enough context to spot abuse, and keep content out. Then alert on patterns. Logging without monitoring finds nothing until after an incident.

The failure OWASP describes

The OWASP Top 10 2017 entry on insufficient logging and monitoring says attackers rely on the lack of monitoring and timely response. Its examples of failure include not logging logins, failed logins and high-value transactions, logs that are stored only locally, no alerting thresholds, and applications that cannot detect active attacks in near real time. It also warns that logging or alert details shown to users or attackers can leak information.

For a health app, the high-value transaction is reading or exporting a patient record.

Events to record

EventFieldsWhy
Login success and failureAccount ID, time, source networkCredential attacks
Access control denialAccount ID, resource type, timeProbing
Record viewed or exportedAccount ID, opaque record ID, timeSnooping, bulk export
Permission or role changeActor, target, changePrivilege abuse
Admin and support accessActor, reason, record IDInsider risk
Input validation failuresEndpoint, countInjection attempts

None of these needs record contents. The HIPAA audit controls standard in 45 CFR 164.312 asks for mechanisms to record and review activity in systems with electronic PHI, which matches the purpose here. General information only, not legal advice.

Detections worth writing first

  1. One account viewing many different patients in a short period.
  2. A user viewing a record with no appointment or care relationship, where your data model can tell.
  3. Repeated access denials followed by a success.
  4. A large export outside normal hours.
  5. A new admin role granted and used within minutes.
  6. Login success from a new location right after many failures.

Start with two or three. Tune them with real data before adding more.

Make the logs trustworthy

OWASP recommends audit trails with integrity controls against tampering, such as append-only tables, and shipping logs off the host so an attacker on one machine cannot erase them. Format logs so a central system can read them.

Close the loop

Decide who receives each alert, how fast they respond and where the response is recorded. An alert with no owner is the same as no alert. Test the pipeline: perform a test action and confirm the alert fires.

Where Safeguard fits

Safeguard focuses on software supply chain and application security, such as dependency scanning, zero-day discovery and continuous monitoring of your components. Runtime access detection belongs in your application and log tooling. A free scan is available at gold.safeguard.sh/scan.

Quick check

Do we log the record contents to prove what was viewed?

No. Log the opaque record ID and the action. Contents belong in the record system.

How long should these logs be kept?

Follow your documented retention rule and legal advice. OWASP says to keep them for the required period and not beyond it.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.