Zero trust architecture
Zero trust architecture (ZTA, or Zero Trust) is an approach to designing software systems centered on not trusting any user or component by default, even when authenticated in a network or previously verified.
While it’s a broad security design concept, Zero Trust is highly applicable to data protection. Specifically, Zero Trust dictates that every data access request undergoes authentication and adheres to the principle of least privilege.
Applying Zero Trust eliminates implicit trust between application components as they communicate with one another.
Why is this important? Consider the worst-case scenario: an attacker gains the ability to execute arbitrary code on your web server through remote code execution (RCE) or a SQL injection vulnerability.
Typically, developers configure a single SQL user with permissions to execute any query, including reading, writing, or deleting data from the database. This creates strong implicit trust between the web application and the database, allowing the database to fulfill any request without preventing malicious actions.
Mitigating data theft with zero trust architecture
Servers receiving client inputs are inherently vulnerable. Client-side code can always be tampered with, enabling malicious requests to be sent to the server. A compromised server puts customer data at significant risk. Zero trust architecture helps address these challenges.
For any database operation the server can perform, let’s ask ourselves: could a compromised server lead to data exposure?
Here are some practical tips aligned with Zero Trust principles to strengthen the relationship between the database and the web application and improve data protection:
- Personalize security with JWT tokens. Use JWT tokens to ensure the web application can only access rows associated with the authenticated user. This mitigates the entire class of insecure direct object reference (IDOR) vulnerabilities.
- Use application-level encryption. This works atop any database or data warehouse, protecting data even when accessed directly. Encryption keys must be securely isolated, typically in a vault.
- Employ data tokenization. Even if stolen, tokenized data remains unusable.
- Tighten access controls. Harden the connection between a web application and a database by limiting access control lists (ACLs) and permissions. Specify exactly which operations the database user needs to perform. Remove deletion permissions and restrict access to unnecessary tables.
- Implement row-level security to restrict which rows the web application can access, per user or per tenant. Reducing data exposure is always a good practice.
- Avoid selecting all rows in a table. Queries like
where 1=1
are overly permissive, enabling attackers to exfiltrate all data at once. Instead, use pagination and monitor for unusual or risky SQL queries. - Enable audit logs to monitor for suspicious activity and facilitate post-incident analysis.
By adhering to these zero trust architecture practices, you significantly reduce the risk of data breaches and improve overall security.