Back to Home
Data Security - Deep Technical Breakdown
Data security means protecting data through its entire lifecycle.
This is critical for CRM (customer data), HRMS (salary, payroll, ID proof), WhatsApp workflow systems (PII + conversations),
and DevOps tools (secrets + infrastructure configs).
What Is Data Security?
Data security ensures confidentiality, integrity, and availability of data across all platforms and flows.
- Only authorized users access data (Confidentiality)
- Data cannot be modified improperly (Integrity)
- Data is available when required (Availability)
Scope includes databases, files, logs, backups, APIs, in-transit data, at-rest data, in-memory data, and log data.
Data Lifecycle Security (Critical)
Data must be secured in every state. One weak state can still cause a full breach.
| State | Example | Risk |
| At Rest | Stored in DB | DB dump |
| In Transit | API call | MITM |
| In Use | Loaded in memory | Memory scraping |
| In Backup | Backup file | Ransomware / leak |
1) Data at Rest Security
Protect stored data in DBs, disks, and object storage.
Encryption at Rest
- AES-256 encryption
- Database native encryption
- Disk encryption
- Cloud storage encryption
If an attacker steals a DB file, encryption makes data unreadable without keys.
Key Management (Very Important)
- Do not store keys on same server as encrypted data.
- Do not hardcode keys.
- Use KMS, key rotation, and strict key access policies.
2) Data in Transit Security
Protect data moving between browser, APIs, services, and DB.
TLS / HTTPS
- Enforce HTTPS only
- Use HSTS
- Use secure cookies
Without TLS, attackers can sniff JWTs, capture passwords, and replay requests.
mTLS (Advanced)
Use certificate-based service-to-service authentication in Kubernetes/microservices/zero-trust setups.
3) Data in Use Security (Often Ignored)
Data in memory is still vulnerable during processing.
- Memory dump attacks
- Debug logs exposing sensitive fields
- Temporary file leakage
Best Practices
- Mask sensitive logs
- Avoid logging tokens/passwords
- Clear sensitive variables after use
- Restrict debug mode in production
4) Backup Security
Many systems secure primary DBs but ignore backup paths.
- Encrypted backups
- Immutable backups
- Offline backups
- Restore drills
Backups are not useful if restore is not tested.
Data Classification (Enterprise)
Not all data needs the same controls.
| Level | Example |
| Public | Marketing content |
| Internal | Business docs |
| Confidential | Customer emails |
| Highly Sensitive | Salary, national ID, passport |
Apply stricter controls as sensitivity increases.
Common Data Breach Causes
- Broken access control
- Public storage buckets
- SQL injection
- Stolen credentials
- Insider misuse
- Misconfigured cloud storage
- PII leakage through logs
Field-Level Protection
In HRMS/CRM, encrypt sensitive columns, not just storage media.
salary -> encrypted
bank_account -> encrypted
Even if DB is dumped, sensitive fields remain unreadable.
Tokenization vs Encryption
Encryption
Reversible with correct key.
Tokenization
Replaces sensitive value with token. Real value is stored separately.
Tokenization is common in payment systems and PCI-focused workflows.
Data Access Control (Very Critical)
Encrypted data still needs strict access control and tenant isolation.
WHERE tenant_id = user.tenant_id
Never trust frontend-sent tenantId.
Data Minimization (Underrated)
Store only what is necessary. Less stored data means lower breach impact.
- Avoid collecting full DOB if not required
- Avoid collecting full national ID if not required
- Avoid collecting full card number unless mandated
Logging and Audit Trails
Track who accessed data, when, from where, and what changed.
This supports integrity checks, insider-threat investigations, and legal defense.
Data Masking
Mask sensitive output in logs/UI:
Bank: 123456789012
Bank: ******9012
- Use partial masking
- Use role-based visibility
Compliance and Regulations
- GDPR (Europe)
- HIPAA (Healthcare)
- PCI-DSS (Payments)
- India DPDP Act
Non-compliance can lead to fines, legal issues, and product shutdown risk.
Real Example Mapping
BigBasket-type breach
- DB exposed, password hashes leaked
- Failure in data at rest and access control
- Potential weak hashing
Capital One-type breach
- Cloud misconfiguration and excess IAM permissions
- Failure in data access control and cloud posture
Production-Ready Data Security Checklist
Encryption
- TLS everywhere
- AES at rest
- Key rotation enabled
Access Control
- RBAC enforced
- Tenant isolation
- No wildcard policies
Secrets
- Secret manager
- No hardcoded credentials
- Regular rotation
Monitoring
- Audit logs enabled
- Alert on mass data access
- Monitor unusual export/download
Backup
- Encrypted
- Immutable
- Restore tested