The HIPAA Checklist for AI-Generated Code: 8 Checks Before Patient Data Goes In
Yes, HIPAA applies to code an AI assistant wrote. Eight checks tied to the Security Rule, what Claude Code, Cursor and Lovable leave out, and what an independent review reads before patient data goes in.
HIPAA binds the organization that holds patient data. It makes no difference whether a developer or an AI assistant typed the code.
The Security Rule never mentions AI. The same standards in 45 CFR 164.308 and 164.312 apply: access control, audit controls, integrity, authentication, transmission security.
Adding patient data to an app that held none is an operational change, and 164.308(a)(8) asks for an evaluation when one happens.
Employment records a healthcare employer holds about its own staff are outside the definition of protected health information. A resident or patient census with names is inside it.
A tool's Business Associate Agreement covers the tool. It says nothing about the app the tool wrote.
Yes, HIPAA applies to code an AI assistant wrote. The rule binds the organization that holds patient data, and the Security Rule doesn't care who typed the code. An app built with Claude Code, Cursor or Lovable has to meet the same standards as any other: access control, audit controls, integrity, authentication and transmission security. Below are eight checks to run before the first patient record goes in, each tied to its section of the rule.
Rule text read on 23 November 2026 in 45 CFR Parts 160 and 164 (164.312, 164.308). Penalty amounts from 45 CFR 102.3. This is an engineering checklist and it is no substitute for legal advice.
0
mentions of AI in the Security Rule. The standards apply to the system, whoever wrote it.
8
checks below, each tied to a section of 45 CFR 164.308 or 164.312.
1.7x
more issues per pull request in AI co-authored code than in human-only code, in CodeRabbit's study of 470 pull requests.
6 years
is how long the rule asks you to keep the documentation behind every one of these decisions.
Two teams this is written for
A startup with a healthcare prototype built in Lovable, Bolt or Cursor
The demo works and a clinic has asked where the audit log is. Start at check 1. Most of your gaps are in checks 2, 3 and 7.
A healthcare operator whose own team built an internal tool with Claude Code
It holds finance or operations data today and patient data is next. Read before patient data goes in first, then the checklist.
A founder or manager who has to hire someone to check the app
An AI assistant builds what you ask for. Ask for a patient list and you get a patient list that works. You didn't ask who is allowed to open it, where the record of that access is kept, or what ends up in the error log, so none of that was built. The gaps are things nobody requested.
The volume makes it worse. CodeRabbit compared 320 AI co-authored pull requests with 150 human-only ones in December 2025 and counted 10.83 issues per pull request against 6.45, with security issues up to 2.74 times higher. Its authors note that they inferred AI authorship from commit signals. The study is small, and it matches what we see when we open these repositories. Source: CodeRabbit, 17 December 2025.
The best known public case is CVE-2025-48757. The record describes an insufficient row-level security policy in Lovable that let unauthenticated attackers read or write arbitrary database tables of generated sites. Lovable disputes it and says each customer is responsible for protecting their own application's data, and under HIPAA that responsibility does sit with the customer. Source: NVD.
The demo proves the first box. A review reads the four in the middle.
The checklist: eight checks and the rule behind each
Each row names the check, the section of the Security Rule it comes from, and what AI assistants usually leave out. "Addressable" in the rule means you assess the measure and either implement it or document an equivalent. It doesn't mean optional.
Check
Rule
What AI-written code usually leaves out
1. Every user has their own login
164.312(a)(2)(i) Unique user identification, required
Shared admin accounts, a seeded test user left in production, an API key that stands in for a person.
2. Access is checked on the server, per role and per record
164.312(a)(1) Access control; 164.308(a)(4) Information access management
The menu hides a page, and the endpoint behind it still answers anyone who is signed in. Change the id in the address and another facility's data comes back.
3. A record of who opened which patient record
164.312(b) Audit controls
No access log at all, or one the application itself can edit and delete.
4. Sign-in proves the person
164.312(d) Person or entity authentication
No second factor, password reset links that never expire, sessions that stay valid for weeks.
5. Sessions end on their own
164.312(a)(2)(iii) Automatic logoff, addressable
A browser left open at a nurses' station stays signed in until someone closes it.
6. Data is encrypted stored and in transit
164.312(a)(2)(iv) and 164.312(e)(2)(ii), addressable
Storage buckets and backups left at defaults, an internal service called over plain HTTP, keys kept in the repository.
7. No patient data in logs, emails, addresses or prompts
164.312(c)(1) Integrity; 164.306(a)
A full record dumped to the error tracker on every exception, a name in an email subject, a patient id in a URL, a record pasted into an AI prompt.
8. An agreement with every vendor that touches the data
164.308(b)(1) Business associate contracts
Email, error tracking, analytics and AI services added one prompt at a time, with nobody keeping the list.
Section numbers from 45 CFR Part 164 Subpart C as published on 23 November 2026. HHS proposed an update to the Security Rule in January 2025 that would tighten several of these, among them encryption and multi-factor authentication. We found no final rule as of this date, so the table shows the rule in force. The proposal.
How to run check 2 yourself in ten minutes
Create two users in different roles, or in different facilities. Sign in as the first, open a record and copy the address. Sign in as the second and paste it. Then do the same with the request the page makes in the background, which your browser's network tab shows. If either one returns the record, access is enforced in the screen only. We find this in most AI-built apps we open, and it is the one finding an auditor or a curious employee will reach first.
What "audit controls" means in practice
The rule asks for mechanisms that "record and examine activity in information systems that contain or use electronic protected health information." A table of logins isn't enough for that. You need a row for each read of a patient record with the user, the record, the time and the source, stored where the application can add rows and can't change them. Then somebody has to look at it on a schedule, because the rule says examine.
Checks 2 and 3 take two people an afternoon. They are also the two an AI assistant almost never builds unasked.
Before patient data goes in
An app that holds finance, payroll or scheduling data is mostly outside HIPAA. The day a table with patient or resident names goes in, the whole Security Rule applies to it, and 45 CFR 164.308(a)(8) asks for an evaluation when a change like that happens.
The definition of protected health information in 45 CFR 160.103 leaves out "employment records held by a covered entity in its role as employer." So payroll, timesheets and staffing data about your own employees aren't protected health information, and neither are financial statements that name no patient. A census that lists residents by name is, and so is a billing table with payer and diagnosis, because each ties a person to care or to payment for care.
The evaluation standard asks for a "periodic technical and nontechnical evaluation" done "in response to environmental or operational changes affecting the security of electronic protected health information." Connecting the clinical records system to an app your finance team built is that kind of change. The rule doesn't name who has to do the evaluation. It can be your own people. Teams bring in an outside reviewer when the people who wrote the app would otherwise be the only ones checking it.
Order matters Review first, patient data second. Before the data is in, a gap costs a code change. After, the same gap is a disclosure you may have to report, and the reviewer needs an agreement with you before opening the database.
What an independent review of AI-built code reads
If you are hiring someone to check the app, this is the scope to hold them to. It is small on purpose. A full risk analysis and a penetration test are separate, larger pieces of work.
1
Sign-in and access setup
The identity provider, multi-factor settings, who is an administrator in the cloud account, and which service accounts can read the database.
2
The code that guards data
Every route that returns a record, the checks in front of it, the queries behind it, secrets, logging and what the error handler sends out.
3
A live test across roles
One role tries to reach another role's data on the running site, through the screens and through the requests behind them.
4
A written report and one recheck
Findings ranked by severity, each with the file and the change that closes it. Your team makes the changes, and the reviewer checks them once.
Three kinds of firms do this work and they are easy to mix up. A software firm that builds regulated applications reads the code and the cloud setup. A penetration tester attacks the running application from outside. A compliance firm writes the risk analysis and the policies. We are the first kind. If you need the Security Rule risk analysis itself, hire a compliance firm for it and give them the code report.
Built it with an AI assistant and patient data is next?
We read the sign-in setup and the code, test one role against another on the live site, and send a written report ranked by severity. Your team makes the fixes. How the review works.
A Business Associate Agreement is the contract a vendor signs when it holds patient data for you. Whether one exists depends on the vendor and on the plan you bought. Microsoft includes its agreement by default for in-scope Azure services. Vercel signs on Pro with a paid add-on and on Enterprise. Supabase signs on Team and above with an add-on. Lovable's terms have customers agree not to provide patient data on any plan. The table of every plan we have checked has the sources and the dates.
The AI coding tool is on that list only if patient data can reach it. If development runs on synthetic data and the assistant never reads a production database, log or export, it never touches the data. Is Claude Code HIPAA compliant? covers the routes where it does.
The agreement covers the vendor Microsoft says it plainly: "Microsoft doesn't inspect, approve, or monitor your applications deployed on Azure." A signed agreement with your cloud says nothing about checks 1 to 7 in your own code. Source: Microsoft.
Two builds, two routes
Fixed after the fact
A federal compliance platform
The first version demoed well and had no reliable record of who did what. We rebuilt access by role and by facility and added an audit trail the application can't edit. It shipped in 8 weeks and passed its DEA audit. How a rescue works.
Built in from the start
A HIPAA case platform
Client, broker and admin portals with role-based access, an audit log and no patient data in email, designed that way before the first screen. It went live in 8 weeks and passed its audit. The case study.
The second route took less work, because nothing had to be built twice. If your app is already written, the first route is the one you have, and a review tells you how much of it stays.
What a violation costs
Level of fault
Minimum per violation
Maximum per violation
Did not know, and could not have known with reasonable care
$145
$73,011
Reasonable cause
$1,461
$73,011
Willful neglect, corrected within 30 days
$14,602
$73,011
Willful neglect, not corrected
$73,011
$2,190,294
Civil penalties under 42 U.S.C. 1320d-5 as adjusted for 2025 in 45 CFR 102.3. The cap for identical violations in a calendar year is $2,190,294 at every level. HHS made no further adjustment for 2026.
The table has no column for who wrote the code. A breach affecting patients has to be reported to them "without unreasonable delay and in no case later than 60 calendar days after discovery" under 45 CFR 164.404, and to the media when more than 500 residents of a state are involved.
Frequently asked questions
Does HIPAA apply to AI-generated code?
Yes. HIPAA binds the covered entity or business associate that holds electronic protected health information, and the Security Rule applies to the system whoever wrote it. The rule doesn't mention AI at all. An app written with Claude Code, Cursor or Lovable has to meet the same standards in 45 CFR 164.308 and 164.312 as one written by hand.
Can AI-generated code be HIPAA compliant?
The code can sit inside a compliant system once someone has checked it against the Security Rule and fixed what is missing. Code is one part. The organization also needs a risk analysis, agreements with every vendor that touches patient data, and documentation kept for six years.
Who can audit AI-generated code for HIPAA?
Three kinds of firms, and they do different jobs. A software firm that builds regulated applications reads the code and the cloud setup and tells you what to fix. A penetration tester attacks the running application from outside. A compliance firm writes the Security Rule risk analysis and the policies. Most teams with an AI-built app need the first before the other two, because it finds the access and logging gaps while they are still cheap to close.
Do we need a review before adding patient data to an internal app?
The Security Rule asks for one. 45 CFR 164.308(a)(8) requires a periodic technical and nontechnical evaluation, including in response to environmental or operational changes affecting the security of electronic protected health information. Moving patient or resident data into an app that held only financial data is that kind of change. The rule doesn't say who must do the evaluation, so it can be your own team or an outside reviewer.
Is payroll or financial data protected health information?
Usually not. The definition of protected health information in 45 CFR 160.103 excludes employment records held by a covered entity in its role as employer, and plain financial statements identify no patient. A census or billing table that names residents or patients is protected health information, because it ties a person to care or to payment for care.
Do I need a BAA with the AI coding tool?
Only if patient data can reach the tool, for example through a production database, a log file or a test fixture the assistant reads. If development runs on synthetic data, the tool never sees patient data and no agreement is needed for it. Coverage differs by tool and by plan; our Claude Code post lists the routes.
What are the penalties for a HIPAA violation?
Civil penalties under 45 CFR 102.3 start at $145 per violation where the organization did not know, and reach $2,190,294 per violation for willful neglect that was not corrected. The cap for identical violations in one calendar year is $2,190,294. Those are the 2025 inflation-adjusted amounts. Who wrote the code is not a factor.
Co-Founder and Technical Lead at Oktopeak. Builds regulated software for legal and healthcare teams, and leads the rescues of codebases other vendors left half-finished.
Claude Code is covered by Anthropic's BAA on two routes: an Enterprise account with the HIPAA configuration applied, or a Console key with zero data retention. Bedrock, Vertex, Foundry and the IDE extensions are not.
Claude can be used with PHI on two surfaces: Claude Enterprise with HIPAA turned on by the Primary Owner, and the first-party API in a HIPAA-ready organization. Free, Pro, Max and Team are not HIPAA-ready plans. Cowork and Claude Code in local mode are covered once the Primary Owner applies the HIPAA configuration; Cowork in the cloud, the Console, Skills, connectors and the beta features are not. Plan by plan, re-checked against Anthropic's BAA articles on 15 October 2026.
The default Lovable and Bolt setup has no path to a BAA: Lovable's DPA bars PHI, and the Supabase and Vercel plans a prototype starts on sign none. Here's what's missing from vibecoded healthcare apps, which plans do sign a BAA, and the path to production.