How to Configure Conditional Access Policy Engine

Published
Length
3 min read

Luis Felipe Dias

All posts

A conditional access policy engine checks user identity and context before allowing a login. You set it up by writing rules that match user groups, devices, and locations. Static login checks only look at a username and a password. A context engine looks at many signals at the exact time of login. It checks who the user is and what machine they use. It also checks where they sit and what app they want to open. If the signals look safe, the user gets in right away. If a signal looks odd, the eng

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.

A conditional access policy engine checks user identity and context before allowing a login. You set it up by writing rules that match user groups, devices, and locations.

Static login checks only look at a username and a password. A context engine looks at many signals at the exact time of login. It checks who the user is and what machine they use. It also checks where they sit and what app they want to open. If the signals look safe, the user gets in right away. If a signal looks odd, the engine asks for a second factor. If the risk is too high, the engine blocks the login right there.

How a conditional access policy engine works

Every rule in a conditional access policy engine has two main parts. The first part lists the signals to check during a login attempt. The second part states the action to take when those signals match. Signals include user roles, network addresses, device health status, and login risk scores. Actions allow the login, ask for extra checks, or deny the request.

These rules apply to human users and automated workloads across your team. You can group engineers, support staff, and service accounts into distinct roles. Each role gets its own set of rules based on what it needs. An admin role needs stricter checks than a read-only viewer role. Service accounts often need location rules that lock them to known server networks.

Start your setup with a safe default rule that blocks unknown sources. Always leave at least two emergency admin accounts outside of your strict rules. If a bad rule locks out your whole team, those accounts save you. Store the keys for these emergency accounts in a safe offline place. Alert your security team every time someone uses an emergency account to log in.

Setting up rules and safe defaults

Build your rules in small steps so you do not break daily work. Most identity tools let you run a new rule in a test mode. In test mode, the engine logs what it would do without blocking anyone. Run your new rules in test mode for at least one full week. Read the logs to see if any normal users would get locked out.

Once the logs look clean, turn the rule on for a small pilot group. Pick a few engineers who can give fast feedback if something breaks. Watch their login logs for a few days to catch any strange edge cases. When the pilot group works well, roll the rule out to the whole team. Keep watching the logs after rollout to spot new devices or travel patterns.

Conditional Access Policies + Customer Support Access to Production: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Make sure your rules check device health before allowing access to core systems. An unmanaged laptop should not reach production databases or internal admin tools. Require a managed device that passes disk encryption and screen lock checks. If a user logs in from a home computer, block access to sensitive apps.

Testing rules and what login checks miss

Audit your rule logs every month to make sure they still fit your team. People change roles, teams add new apps, and old networks go away. Look for rules that never trigger and remove them to keep things clean. Check for failed login spikes that might show a brute force attack. Good logs tell you which specific rule blocked or allowed each login attempt.

Still, a login rule only checks the user at the front door. Once the session starts, the identity engine steps out of the way. It cannot see what queries an engineer runs inside a database session. It cannot stop someone from running a bad drop command on a table. It also cannot rewrite sensitive fields like emails or card numbers in query results. To control what happens inside a session, you need deeper runtime controls.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.

Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.

Frequently asked questions

What signals can a policy engine check at login?

It checks user role, group membership, device health, location, IP address, and target app. Many engines also check real-time risk scores based on past login habits.

How do you avoid locking out admins when testing new rules?

Create two emergency admin accounts and exclude them from all conditional rules. Test every new rule in report-only mode before you turn on active blocks.

Does a login policy engine control commands inside a database session?

No, it only approves or blocks the initial login to the identity provider. Once the user logs in, the identity engine does not inspect database queries.

The query runs. The emails stay hidden.