Implement HIPAA technical safeguards for electronic protected health information. Covers access controls, audit logging, encryption at rest and in transit, data backup, integrity controls, and the patterns that make healthcare software HIPAA-compliant.
HIPAA Engineering Controls are the technical safeguards that ensure the confidentiality, integrity, and availability of electronic protected health information (ePHI) across systems, networks, and data stores. These controls are mandatory under the HIPAA Security Rule, and their implementation must be precise, auditable, and enforceable—especially during inspections, audits, and incident investigations. They are most critical during system onboarding, security incident response, and annual compliance reviews.
To satisfy HIPAA’s encryption requirements, systems must protect ePHI both while stored and while being transmitted. The core requirement is that all ePHI must be encrypted at rest and in transit using industry-standard algorithms.
For encryption at rest, a system must ensure that every database, file storage, and backup medium contains ePHI in encrypted form. This includes:
pgcrypto extension and use pg_encrypt with AES-256 for sensitive columns. CREATE EXTENSION IF NOT EXISTS pgcrypto;
ALTER TABLE patients ALTER COLUMN ssn TYPE bytea USING pg_encrypt(ssn, 'AES-256');
LUKS for full-disk encryption on Linux servers. sudo cryptsetup luksFormat /dev/sdb
sudo cryptsetup open /dev/sdb encrypted_data
sudo mount /dev/mapper/encrypted_data /mnt/data
{
"Rules": [
{
"ApplyServerSideEncryptionByDefault": {
"SSEAlgorithm": "AES256"
}
}
]
}
For encryption in transit, all network communications involving ePHI must be secured using TLS 1.2 or higher.
server {
listen 443 ssl http2;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512;
ssl_prefer_server_ciphers on;
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
# ...
}
Common failure modes include:
HSTS header, leading to downgrade attacks.pgcrypto: pg_encrypt columns are not indexed, leading to full-table scans on queries.All access to systems handling ePHI must be governed by strong access control policies. This includes user authentication, role-based access, and session management.
Google Authenticator with tfa middleware: {
"users": [
{
"id": "u-123",
"name": "Dr. Alice Chen",
"email": "[email protected]",
"mfa_secret": "JBSWY3DPEHPK3PXP",
"mfa_enabled": true
}
]
}
# Set session with 2-hour timeout
SET session:u-123:active "true" EX 7200
# Set inactivity timer
SET session:u-123:timestamp "$(date +%s)" EX 900
# On activity: update timestamp
SET session:u-123:timestamp "$(date +%s)" EX 900
Patient, Clinician, Admin, and Auditor, each with granular permissions. {
"roles": {
"Clinician": {
"permissions": [
"read:patients",
"create:appointments",
"write:notes",
"read:medications"
],
"access": {
"data": ["demographics", "vitals", "diagnoses"],
"systems": ["ehr", "scheduling", "laboratory"]
}
},
"Auditor": {
"permissions": [
"read:all",
"export:audit-logs",
"review:compliance"
],
"access": {
"data": ["all"],
"systems": ["all"]
}
}
}
}
Critical edge cases:
Senior Clinician role includes Clinician permissions but does not automatically grant read:medications—a subtle gap missed in audits.Systems must maintain a complete audit trail of all access and actions on ePHI. The audit trail must include:
The audit trail must be immutable, retention-based, and searchable.
{
"event_id": "evt-45678",
"timestamp": "2024-03-15T10:32:14Z",
"actor": {
"user_id": "u-123",
"role": "Clinician",
"ip_address": "192.168.1.10",
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15"
},
"action": "update",
"resource": {
"type": "patient",
"id": "p-789",
"name": "John Doe",
"version": 3
},
"details": {
"fields_changed": [
{
"field": "primary_diagnosis",
"old_value": "Hypertension",
"new_value": "Type 2 Diabetes"
},
{
"field": "medication",
"old_value": ["Lisinopril"],
"new_value": ["Lisinopril", "Metformin"]
}
],
"source": "web-ui",
"transaction_id": "txn-9901"
}
}
{
"Rules": [
{
"ID": "audit-log-rotation",
"Prefix": "audit-logs/",
"Status": "Enabled",
"Transitions": [
{
"Days": 90,
"StorageClass": "GLACIER"
}
],
"Expiration": {
"Days": 3650
}
}
]
}
Common pitfalls:
create actions are logged, but delete and import are missing.timestamp and user_id, but no support for field_changed or resource.id.ePHI must be protected against loss, corruption, and tampering. Systems must implement regular backups and integrity checks.
borg for incremental backups: # Full backup
borg create /backup/health::$(date +%Y-%m-%d) /data/ehr /data/patients
# Incremental backup
borg create --timestamp $(date +%Y-%m-%d) /backup/health::$(date +%Y-%m-%d) /data/ehr /data/patients
borg check and log the result. borg check --verify-data /backup/health
psql -c "SELECT md5(string_agg(oid::text, '')) FROM patients;" -t
# Extract latest backup
borg extract /backup/health::2024-03-15 /tmp/restore
# Run integrity check
psql -d test_db -f /tmp/restore/verify.sql
# Validate data
curl -X POST http://test-api/health-check -d '{"test": "restore-validation"}'
Key failure modes:
borg check is run; corrupted data goes unnoticed.Network and system-level controls ensure that ePHI is protected from external and internal threats.
iptables rule to allow only HTTPS and internal API traffic: iptables -A INPUT -p tcp --dport 443 -j ACCEPT
iptables -A INPUT -p tcp --dport 8080 -j ACCEPT
iptables -A INPUT -s 10.0.0.0/8 -j ACCEPT
iptables -A INPUT -j DROP
Suricata or Snort to detect suspicious traffic. rule:
name: "SQL Injection Attempt"
priority: 1
metadata:
tags: [ "web", "sql", "injection" ]
detection:
flow: { to_server: true }
content: [ "SELECT", "FROM", "WHERE" ]
pcre: [ "/\b(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP)\b.*?(\bFROM\b|\bWHERE\b|\bJOIN\b)/i" ]
threshold: { type: "packet", count: 5, within: 30 }
systemctl-based update script: # Update all packages
sudo apt update && sudo apt upgrade -y
# Reboot if kernel or critical service changed
if grep -q "linux-image" /var/log/apt/history.log; then
sudo reboot
fi
Critical oversights:
To maintain ongoing compliance, systems must validate HIPAA controls continuously.
All reports must be exportable in PDF and JSON formats for audits.
Failure to run these checks leads to unverified compliance: controls are assumed to be in place but are not proven.
This page was rewritten on 18 October 2026. It replaced a templated version that was not specific to its own title. How these pages are written and checked. If anything here is wrong, tell us at [email protected] and we will correct it.
We use cookies for analytics (Google Analytics) and advertising (Google AdSense) to improve your experience and support free content. Privacy Policy