DPDP Reasonable Security Safeguards for a Production Database: A Control-by-Control Implementation Guide
A control-by-control guide to implementing DPDP reasonable security safeguards on production Postgres and MySQL. Config, logging, access control and evidence.
Team Qarbix · · 8 min read
Security & Compliance

Every law firm in India has now published a summary of the Digital Personal Data Protection Rules, 2025. Almost none of them tell you what to type into postgresql.conf or my.cnf.
That gap matters. The DPDP Act requires a Data Fiduciary to protect personal data by taking reasonable security safeguards to prevent a personal data breach. The Rules, notified by MeitY on 13 November 2025, give that phrase operational shape: encryption or equivalent protection, controls on access, logs and monitoring that let you detect and investigate unauthorised access, and measures that survive the failure of any single component. Full compliance is required by 13 May 2027, with the enforcement and penalty framework switching on from 13 November 2026.
This guide translates each safeguard into concrete database configuration. It assumes a relational database you control — PostgreSQL or MySQL/MariaDB are the common cases — which is the situation for most Indian SaaS companies, fintechs and healthcare platforms. Where the two engines differ, both are called out.
Safeguard 1: Encryption, obfuscation, masking or the use of virtual tokens
The Rules name four alternatives, not one mandate. Teams read the word encryption and stop there, which produces a common failure: the disk is encrypted, the connection is encrypted, and every support engineer can still run SELECT * FROM customers and read forty thousand phone numbers in plain text.
Encryption at rest defends against a stolen disk. It does nothing against an authorised session. The Rules list masking and tokenisation alongside encryption precisely because the threat model includes people who already hold valid credentials.
What to implement
At rest: LUKS or cloud provider volume encryption, plus column-level encryption for the highest-sensitivity fields — pgcrypto in PostgreSQL, the AES_ENCRYPT functions or InnoDB tablespace encryption with the keyring plugin in MySQL — or application-layer encryption above the database entirely.
In transit: TLS enforced at the server, not merely offered. In PostgreSQL, set ssl = on and use hostssl entries in pg_hba.conf. In MySQL, set require_secure_transport = ON and require encryption per account with ALTER USER ... REQUIRE SSL. In either engine, reject non-TLS connections rather than allowing silent fallback.
In use: this is the layer most teams have not built. Column-level masking so that a support engineer querying the same table sees XXXXXX7821 where a billing administrator sees the full number.
Neither engine gives you this for free. PostgreSQL can approximate in-use protection with row-level security and security barrier views, but both require you to route every consumer through the right role and to maintain policies as the schema evolves. MySQL Community Edition has no native dynamic masking at all; MySQL Enterprise Edition does, at enterprise pricing. In practice most teams on either engine end up building masked views by hand and then discovering that a new analyst was granted direct table access and bypassed all of it.
Safeguard 2: Control over access to computer resources
Access control under DPDP is not simply having authentication. It is being able to demonstrate that access was appropriate, scoped, approved and revoked.
The pattern that fails an audit looks like this: a shared read-only role, credentials in a password manager, permanent grants that were issued for a 2023 incident and never withdrawn, and no record connecting any query to a named human. It authenticates fine. It cannot answer who accessed customer data last quarter, which is the question you will actually be asked.
The controls that hold up
Named identity end to end. Every database session traceable to a person, not a service account shared by eleven engineers. Federate to your IdP so that offboarding in Google Workspace or Okta removes database access the same hour.
Least privilege by role, expressed against real job functions. Support, analytics, billing and on-call engineering need different column visibility, not different passwords to the same view.
Time-bound elevation. Standing production write access is the single most common finding in access reviews. Replace it with just-in-time grants that expire automatically.
Approval before sensitive access, recorded at the moment of the request rather than reconstructed afterwards.
Safeguard 3: Logs, monitoring and review
The Rules require logs and monitoring capable of detecting unauthorised access, together with the ability to investigate and remediate. Retention periods are specified; confirm the current requirement against the gazette text before you set your retention policy, because several secondary sources disagree on the figure.
The engineering question is what your logs contain. Connection logs prove someone connected. They do not prove what they read. If a breach report requires you to state which data principals were affected, connection logs are useless and you will be estimating under oath.
Minimum viable database audit trail
Statement-level capture: pgAudit for PostgreSQL, and the Percona Audit Log or MariaDB Audit Plugin for MySQL. Native MySQL Community logging — and the default PostgreSQL log — is not sufficient on its own.
Identity binding: the named human, not the pooled connection user. Connection poolers such as PgBouncer for PostgreSQL or ProxySQL for MySQL collapse identity by design; if you use one, you need identity propagated at a layer above it.
Result metadata: at minimum the row count returned and the tables and columns touched. This is what converts a log into breach evidence.
Tamper resistance: ship logs off the database host to append-only storage. A log an administrator can edit is not evidence.
Actual review. Logs nobody reads satisfy the letter and fail the intent. Schedule the review and record that it happened.
Safeguard 4: Continuity, backups and the obligations they create
Backups are required for continuity and they quietly create a second compliance problem. Personal data lives in every backup, every read replica, every WAL or binlog archive and every analytics copy. Each is in scope for the same safeguards, and each becomes a problem again when an erasure request arrives.
Encrypt backups with keys held separately from the backup store, restrict restore rights to a role distinct from ordinary database administration, and maintain an inventory of every location a copy of personal data lands. Most organisations cannot produce that inventory on request, which is itself a finding.
Safeguard 5: Contractual flow-down to processors
If you use a managed database, a BI vendor, an offshore support partner or a monitoring tool that ingests query text, your safeguards must extend contractually to them. The Data Fiduciary remains accountable. Review whether your observability stack is quietly logging query parameters that contain personal data into a third-party SaaS platform, because that is a live exposure in a large number of Indian engineering teams right now.
Building the evidence pack
Compliance is judged on evidence, not intention. For each safeguard above, decide now what artefact demonstrates it: a configuration export, an access review report, a sample of the audit trail, a signed processor agreement. Collecting these continuously is straightforward. Reconstructing eighteen months of them in the week before an audit is not.
How Qarbix DataGuard helps
DataGuard is a self-hosted database access governance layer that sits between users and production databases. It was built for exactly this problem: the safeguards above are individually achievable and collectively very hard to maintain by hand across multiple databases and a changing team. It works the same way whether the database behind it is PostgreSQL, MySQL or MariaDB.
Sensitive data classification identifies which columns hold personal data, so masking policy is applied to the right fields rather than the ones someone remembered.
Dynamic masking enforces column-level visibility per role at query time, addressing the in-use gap that encryption at rest does not cover — and closing the gap where MySQL Community has no native masking and PostgreSQL masking must be hand-maintained.
Role-based access control maps visibility to real job functions across databases from one policy surface.
Query-level audit logging records the named human, the statement and the scope of what was returned, producing the evidence a breach report or access review actually requires.
Approval workflows capture authorisation for sensitive access at the moment it is granted.
Because DataGuard is self-hosted, your data and your audit trail never leave your infrastructure, which removes the cross-border and processor questions that vendor-cloud governance tools introduce.
Frequently asked questions
Does DPDP require database encryption specifically?
The Rules require reasonable security safeguards and list encryption, obfuscation, masking and tokenisation as means of protecting personal data. Encryption alone is one option among several and does not by itself address access by authorised users.
Is row-level security or a restricted view enough for DPDP compliance?
It is a useful control but not a complete answer. In PostgreSQL, row-level security restricts rows, not columns, requires disciplined role management, and is bypassed by superusers and by any consumer granted direct table access. MySQL has no native row-level security at all, so teams approximate it with restricted views, which carry the same gaps and are equally easy to bypass with a direct grant. On either engine the mechanism produces no audit evidence on its own.
When do these obligations become enforceable?
The DPDP Rules were notified on 13 November 2025. The enforcement and penalty framework begins from 13 November 2026, and full compliance with the core obligations is required by 13 May 2027.
Do these safeguards apply if we are a data processor rather than a fiduciary?
Processors carry obligations through their contract with the fiduciary, and in practice customers are already writing these controls into procurement questionnaires and data processing agreements.
Tags
#database governance
Written by Team Qarbix, the engineers who build CloudLens and DataGuard.