skip to content

In Cloudflare Access, how do the Allow, Block, Bypass and Service Auth actions differ, and in what order are an application's policies evaluated?

level: middleimportance: must knowfreq 45%

answer

  1. deny by default
  2. one action per policy
  3. Include OR, Require AND, Exclude NOT
  4. Bypass and Service Auth go first
  5. first Allow or Block match decides

basics

~20 s

Allow admits matching users, Block refuses them, Bypass switches Access off for matching traffic without logging it, and Service Auth admits service tokens or client certificates without an identity provider login. Bypass and Service Auth run first, then Allow and Block in order.

solid answer

~50 s

Each Access policy has exactly one action plus rules built from selectors. Include rules act as OR and every policy needs at least one, Require rules act as AND, and Exclude rules remove anyone they match. Access is deny by default: a user who matches no Allow policy is refused, so Block exists to carve exceptions out of an Allow. Bypass turns enforcement off for matching traffic, cannot use identity selectors such as Emails, and writes no Access log, so it suits only a genuinely public path. Service Auth admits non-browser callers that present a service token or a valid client certificate, with no identity provider login, and keeps logging. Access evaluates Bypass and Service Auth policies first, top to bottom, then Allow and Block in their order, and the first Allow or Block that matches decides.

go deeper

for a junior

Know the four actions by name and that Access refuses anyone who matches no Allow policy. Recall that Include is OR, Require is AND and Exclude is NOT.

for a middle

Explain the two-pass order, why a Block below a matching Allow never fires, and why Bypass loses both identity checks and logging. Show the rule group fix for OR inside Require.

for a senior

Spot the policies that silently open an application: Include Everyone, Include Login Methods One-time PIN, a broad Bypass path. Explain which selectors are re-checked on each request.

for a principal

Treat Bypass as a reviewed exception with an owner, and prefer Service Auth for machines, so every way into an application stays authenticated and visible in the logs.

## The four actions An **Access policy** combines one **action** with rules made of **selectors** (the attribute checked, such as Emails ending in, Country or Service Token) and **values** (such as `@example.com`). An application can carry several policies. | Action | What it does | Identity selectors? | Logged? | |---|---|---|---| | Allow | Admits users who match | Yes | Yes | | Block | Refuses users who match | Yes | Yes | | Bypass | Turns Access enforcement off for matching traffic | No | No | | Service Auth | Admits a service token or client certificate without an identity provider login | Not needed | Yes | Access is **deny by default**. A user who matches no Allow policy is refused even if no Block policy exists, so Block is a way to carve exceptions out of a broad Allow, such as refusing one country inside an employee policy. **Bypass** is the dangerous one. It does not enforce any Access control, it cannot use identity-based selectors such as Emails, and requests that match it are not logged. When Bypass applies, the zone's ordinary security settings take over. Cloudflare's guidance is to test Bypass before production and to prefer Service Auth when the goal is a machine caller, since Service Auth still authenticates and still logs. ## Rule types: Include, Require, Exclude - **Include** works like OR. Every policy needs at least one; it defines the starting pool of eligible users. - **Require** works like AND. A user must meet every Require rule, and several values typed into one Require rule are also ANDed. - **Exclude** works like NOT. Anyone matching an Exclude rule is refused by that policy. For the company wiki, a sensible Allow policy looks like this: | Action | Rule type | Selector | Value | |---|---|---|---| | Allow | Include | Emails ending in | `@example.com` | | | Require | Country | `Portugal` | | | Exclude | Emails | `[email protected]` | The classic trap is putting two countries in one Require rule: the user would have to be in both at once, so nobody gets in. The fix is a **rule group** that Includes either country, then a Require rule on that group. ## Order of evaluation Access does not simply read policies top to bottom. It runs two passes: 1. Bypass and Service Auth policies, in their order from top to bottom. 2. Allow and Block policies, in their order from top to bottom. With policies listed as Allow A, Block B, Service Auth C, Bypass D and Allow E, the order is C, D, A, B, E. Once an Allow or Block policy matches, evaluation stops, and no later policy can override it. So a Block placed below a broad Allow never fires for users the Allow already admitted; put the Block first. ## Misconfigurations that open an application - **Include Everyone** in an Allow policy admits anyone on the internet. - **Include Login Methods: One-time PIN** in an Allow policy admits anyone who can receive a PIN, which is anyone with an email address. - **A Bypass policy on a broad path**, such as everything under `/api/` of the HR portal, removes authentication and logging for that path at once. - **A Block-only application** blocks the listed users and everyone else, because nothing allows anyone. ## Selectors checked at login and continuously Identity selectors such as Emails, Emails ending in, Login Methods and Identity provider group are checked when the user logs in. Non-identity selectors such as IP ranges, Country, Valid Certificate, Service Token and Device posture are re-evaluated on each new request during the session. So a policy that requires the office IP range stops a user who moves to a café on the next request. Identity selectors, by contrast, are judged against the identity Access stored at login: a group removed in the identity provider is noticed when the user next signs in there, unless SCIM provisioning forces a re-check sooner. ## Putting it together for the wiki and the HR portal - The wiki: one Allow policy for employees from the company identity provider. - The HR portal: an Allow policy requiring an HR group, with a Block policy above it for any region the company does not operate in. - The nightly reporting job: a Service Auth policy on the HR export path, never a Bypass.

  • Why does a Require rule listing two countries and two email domains admit nobody?
    Values inside one Require rule are joined by AND, so a user would need to be in both countries and hold both email domains at once. The fix is a rule group that Includes either country, then a Require rule on that group, with the email domains in an Include rule where they act as OR.
  • When would you choose Service Auth over Bypass for a non-browser caller?
    Almost always. Service Auth still authenticates the caller with a service token or client certificate and records it in Access logs; Bypass lets anyone matching the rule through, cannot use identity selectors, and logs nothing. Bypass is meant for content that should be public, not for a script you trust.
  • Which Access selectors are re-checked during a session, and which only at login?
    Non-identity selectors such as IP ranges, Country, Valid Certificate, Service Token and Device posture are evaluated on each new request. Identity selectors such as Emails, Login Methods and Identity provider group are checked at login against what the identity provider returned; a change there shows up at the next identity provider login, or sooner with SCIM.

  • A Block policy is needed to stop everyone who was not explicitly allowed.
  • Access policies always run strictly top to bottom, whatever their action.
  • Bypass still logs who came through, so it is fine for internal tools.
  • Several values in one Require rule mean matching any one of them is enough.
  • An Allow that includes the One-time PIN login method limits access to employees.