Secure bulk retrieval challenge
The primary security challenge with both SQL and NoSQL databases is the risk of secure bulk retrieval (or record-dumping) queries, such as a “SELECT *” request. When combined with SQL injection or GraphQL injection vulnerabilities, attackers can exploit these queries to dump entire database in a matter of seconds. A malicious actor can access your sensitive records even if a database encryption solution is implemented. To address this threat, the original version of Databunker Pro was designed to retrieve user records only when specific user details were provided. This approach significantly limited attackers’ ability to enumerate users stored in Databunker. Even if an attacker managed to obtain a Databunker Pro access token, they would still need to provide specific details like the user’s email, phone number, or UUID to access any information. From a security perspective, this design was robust and highly effective.The Usability Dilemma
Despite the strong security model, we began losing business. Companies provided feedback that they needed a way to list all users as part of their application’s admin interface. Initially, we firmly opposed introducing any API that allowed bulk user retrieval, as it conflicted with our strict security principles. However, this resistance came at a cost. While our security model remained robust, our product’s usability suffered, which negatively impacted our business. We realized we needed a solution that could balance these conflicting requirements: maintaining high security while providing admins with essential functionality.Iteration 1: Adding Basic Controls for Bulk Access
Our initial attempt to balance usability and security introduced a two-step approach:- Configuration Setting: Admins could enable or disable the ability to dump user records entirely.
- POST Request Requirement: A bulk data dump required a POST request, ensuring the action couldn’t be triggered by a simple GET request.
Iteration 2: Secure Unlock Mechanism
Over time, we developed a more secure solution:- Unlock Request: A special API unlock request must be submited, specifying whether they want to unlock all users or a specific group of users.
- Temporary Token: The unlock request generates a temporary token with a short expiration window (e.g., a few minutes).
- Token Validation: During the token’s validity period, user records can only be dumped if the token is included in the API request.
- It expires automatically after a few seconds
- It must be included when retrieving records for any group of users
- A new UUID must be requested for subsequent bulk operations
Iteration 3: Fine-Grained Access Control with Policy Engine
Our latest iteration introduces a powerful policy engine that provides granular control over bulk operations and user listing capabilities. This enhancement allows organizations to:- Control Bulk Operations Access: Define exactly who has the right to perform bulk unlock API requests
- Group-Specific Access: Restrict user listing to specific groups or departments
- Field-Level Security: Control which user fields are visible in bulk operations
- Role-Based Controls: Implement role-based access patterns for different admin types
- Limited Actions: The manager role can only perform specific actions (
UserGetandBulkListGroupUsers) - Field Restrictions: Access is limited to specific fields (name, phone, group)
- Group Isolation: Managers can only access members of their own group
- Automatic Data Masking: Other sensitive fields are automatically masked
- Allow HR managers to list only their department members
- Restrict sensitive field access in bulk operations
- Implement hierarchical access patterns
- Maintain audit trails of all bulk access operations