How to Configure Policy-based Security
Policy based security controls who can use your systems and what actions they can run. You set it up by writing clear rules that match user roles to specific resources. Instead of giving broad rights to individual users, you group permissions into shared rules. When a person or app tries to log in, the system checks these rules first. If the request matches an allowed rule, the action goes through right away. If it does not match, the system blocks the request and writes an alert log. How pol
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
Policy based security controls who can use your systems and what actions they can run. You set it up by writing clear rules that match user roles to specific resources.
Instead of giving broad rights to individual users, you group permissions into shared rules. When a person or app tries to log in, the system checks these rules first. If the request matches an allowed rule, the action goes through right away. If it does not match, the system blocks the request and writes an alert log.
How policy based security works in practice
Every rule needs three main parts to work well. First, you define the principal, which is the user, team, or workload making the call. Second, you name the resource, such as a database, server, or cloud bucket. Third, you list the allowed actions, like read, write, or delete.
You can also add conditions to make your rules tighter. A condition might check the time of day or the user location. It can also check if the user logged in with a second factor. This setup affects both human engineers and automated apps that run background jobs.
When you build your rule set, always start with a deny-all default. This means nobody can touch any system unless a rule says they can. Grant only the exact rights a team needs to do their daily work. Separate your production rules from your test rules so mistakes stay contained. Store your rule files in version control so your team can review every change.
Step-by-step setup for your teams
Start by listing all the databases, servers, and apps your company runs today. Group these systems by how sensitive their data is. Next, list your teams and the main jobs they do each day. Map each job to the minimum actions needed on each system group.
Write your rules in a central identity tool or cloud control plane. Test each new rule in a dry-run mode before you turn it on. Dry-run mode logs what would happen without blocking real work. Check the logs with the team to fix any missing permissions before enforcing the rule.
End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Checking rules and closing session gaps
Once your rules are live, you must check them on a regular schedule. Teams change roles, and old projects shut down over time. Run a review every quarter to delete rules that nobody uses anymore. Check your system logs each week to spot failed login attempts or blocked actions.
Still, static login rules have a big blind spot once a session starts. Standard cloud rules only check identity at the moment a user logs in. After the database or server opens the session, the initial rule step is done. The system cannot see individual queries or commands inside that open session.
If an engineer has read rights to a database, they can query any table inside it. Static login rules cannot rewrite sensitive fields like emails, phone numbers, or card numbers in results. They also cannot stop a single bad command if the overall role allows write actions. To control what happens inside a live session, you need runtime checks on every command.
Govern statements and responses across databases and APIs
Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.
First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.
Frequently asked questions
What is the difference between role rules and attribute rules?
Role rules grant rights based on a static job title, like database admin. Attribute rules check dynamic facts, like time of day, device status, or ticket approval.
How often should teams review their security rules?
You should review critical production rules at least once every three months. You should also trigger a review whenever an engineer changes teams or leaves the company.
Can static rules protect sensitive data inside a database table?
No, standard login rules only decide if a user can open the database session. Protecting specific columns like national IDs or card numbers requires runtime query checks and masking.
Related guides
In this post