The Limits of Basic Zero Trust

Most discussions around Zero Trust stop at the point where a user successfully authenticates. This is a superficial view. The real challenges emerge in the nuances: how group memberships are evaluated, the impact of ungranted admin consent, and the precise logic of conditional access policies like the 'one country rule.' These are the points where integrations often fail, not at the initial login.

To move beyond theory, a fully Terraform-managed demonstration environment was constructed. This setup uses Microsoft Entra ID to drive Cloudflare Access authorization. It supports both OIDC and SAML protocols, testing the same three users against identical policies. Crucially, the identity verification is proven at the origin, ensuring it's not merely echoed by an intermediary.

Terraform code snippet showing Entra ID and Cloudflare Access resource provisioning

The Technical Setup: Terraform as the Orchestrator

The entire infrastructure is provisioned and managed via Terraform. This includes the necessary Entra ID application registrations, the creation of demo users and groups, and the explicit granting of admin consent. On the Cloudflare side, both identity providers (for OIDC and SAML) are configured, alongside a dedicated tunnel providing secure, managed ingress. DNS resolution is also handled within this managed environment.

The demo focuses on a common enterprise scenario: asserting identity information from a central identity provider (Entra ID) into an application access layer (Cloudflare Access). The goal is to ensure that the identity attributes passed are not only present but also accurately reflect the security posture and authorization rules defined in Entra ID. This level of verification is critical for robust Zero Trust implementation.

Testing Authentication Protocols: OIDC vs. SAML

The demonstration rigorously tests two primary authentication protocols: OpenID Connect (OIDC) and Security Assertion Markup Language (SAML). Both protocols are configured to use Entra ID as the identity provider, federated with Cloudflare Access. This dual-protocol testing is essential because many organizations still operate with a mix of legacy SAML applications and newer OIDC-based services.

OIDC, built on OAuth 2.0, offers a more modern and often simpler integration path, particularly for web and mobile applications. SAML, while older, remains a cornerstone for enterprise single sign-on (SSO) and is widely supported by SaaS applications. By testing both, the demo highlights potential differences in how identity attributes, such as group memberships or custom claims, are passed and interpreted by Cloudflare Access. This comparison is vital for understanding protocol-specific limitations or strengths in a Zero Trust context.

Simulating Failure Modes for Robustness

The core value of this demonstration lies in its ability to surface common failure points that are often overlooked in simpler Zero Trust setups. The demo simulates several critical scenarios:

  • Group Membership Discrepancies: Policies are configured to grant access based on specific Entra ID group memberships. The test verifies that Cloudflare Access correctly interprets these memberships, even when they are complex or involve nested groups. It also checks what happens when a user is *almost* in the right group, but not quite, exposing potential edge cases in attribute mapping.
  • Admin Consent Issues: The demo explicitly includes scenarios where admin consent for application permissions might be pending or incorrectly granted. The first real sign-in attempt is designed to reveal whether the application's required permissions have been properly approved, preventing silent failures or unexpected access denials later on.
  • Policy Logic Ambiguities: A common pitfall is the misinterpretation of logical operators within access policies. The 'one country rule' example, often intended as an OR condition (access from country A OR country B), can sometimes be implemented as an AND (access only if in country A AND country B, which is rarely the intent). The demo tests these specific policy interpretations to ensure they align with security requirements.

By actively provoking these failure modes within a controlled environment, developers and security professionals can gain confidence that their Zero Trust policies are not just theoretically sound but practically resilient.

Verifying Identity at the Origin

A critical aspect of this demonstration is the verification of identity at the origin. Many solutions provide a secure access gateway (like Cloudflare Access) that asserts user identity. However, for true Zero Trust, the origin server itself must be able to validate these assertions. This prevents scenarios where an attacker could potentially spoof or tamper with the identity token between the gateway and the application.

The demo leverages Cloudflare Tunnel to establish a secure, outbound-only connection from the origin server to Cloudflare's edge. This ensures that all traffic is proxied and inspected. Furthermore, the origin application is configured to validate the identity tokens (either OIDC ID tokens or SAML assertions) presented by Cloudflare. This involves checking the token's signature, issuer, audience, and expiration, as well as evaluating specific claims (like group memberships) against the application's access control list. This end-to-end verification provides a provable guarantee of the user's identity and authorization, forming the backbone of a robust Zero Trust architecture.

The Value Proposition: Moving Beyond Theoretical Zero Trust

This practical, code-driven approach moves Zero Trust implementation from abstract principles to concrete, testable reality. By automating the setup with Terraform and systematically testing common failure points across OIDC and SAML, organizations can:

  • Reduce Integration Risk: Identify and fix configuration errors before they impact production users.
  • Improve Policy Enforcement: Ensure that complex access policies are correctly interpreted and enforced by both the access gateway and the origin application.
  • Strengthen Security Posture: Gain confidence that identity assertions are valid and protected end-to-end.

What remains to be seen is how easily such detailed, automated verification processes can be integrated into standard CI/CD pipelines for continuous security assurance. The current demo provides a blueprint, but its adoption hinges on seamless integration into developer workflows.