โ† Back to Dashboard

๐ŸŽฏ What It Does

The Cloudflare Access Policy Analyzer is an automated tool that helps organizations audit, analyze, and clean up their Cloudflare Access policies efficiently. It eliminates the manual, time-consuming process of reviewing policies one-by-one.

โš ๏ธ
The Problem: Organizations accumulate hundreds of Access policies over time. Manual audits take 4+ hours and it's nearly impossible to know which policies are actually being used without checking logs individually.
โœ…
The Solution: This tool automatically analyzes all policies, cross-references them with actual traffic data from logs, and categorizes them into actionable groups with 95% confidence in cleanup recommendations.
~4hrs Time Saved Per Audit
95% Cleanup Confidence
4 Policy Categories
2 Versions Available

โœจ Key Features

๐Ÿ” Traffic Analysis

Analyzes actual Access logs to determine which policies are being hit by real traffic

๐Ÿงน Smart Categorization

Groups policies into 4 categories: Truly Unused, Zombie, Orphaned Active, and Active Properly

๐Ÿšจ Issue Detection

Identifies critical problems like orphaned active policies and zombie policies

๐Ÿ“Š Visual Dashboard

Interactive HTML dashboard with charts, filters, and detailed policy breakdowns

โฑ๏ธ Time-Based Filtering

Analyze policy usage over 30, 60, or 90-day periods

๐ŸŽฏ Duplicate Detection

Finds duplicate policies and unused applications automatically

โš™๏ธ How It Works

Fetch Policies
โ†’
Fetch Applications
โ†’
Analyze Logs
โ†’
Categorize
โ†’
Display Results

Process Flow:

  1. Data Collection: Fetches all Access policies and applications from Cloudflare API
  2. Log Analysis: Processes Access logs from R2/S3 to identify which policies received traffic hits
  3. Structural Analysis: Determines which policies should theoretically match traffic based on application configuration
  4. Classification: Categorizes each policy based on both structural analysis and actual log hits
  5. Visualization: Presents results in an interactive dashboard with actionable insights

๐Ÿ“‹ The 4 Policy Categories

1. Truly Unused (Safe to Delete)

What it means: No structural match + No log hits

These policies don't appear to match any traffic structurally AND have no recorded hits in logs. Safe to delete with 95% confidence.

2. Zombie Policies (Review Required)

What it means: Structural match + No log hits

These policies look like they should match traffic but have no hits. May indicate stale policies or logging issues.

3. Orphaned Active (Critical Issue)

What it means: No structural match + Has log hits

These policies have traffic hits but no structural match. Indicates configuration issues or legacy policies still in use.

4. Active Properly (Keep)

What it means: Structural match + Has log hits

These policies are functioning correctly - they match traffic structurally and have recorded hits.

๐Ÿ”ง How It Was Built

Architecture

The solution is built as a serverless application using Cloudflare's infrastructure:

Cloudflare Workers Backend API & Logic
JavaScript Core Language
HTML/CSS Dashboard Interface
R2/S3 Log Storage
Cloudflare API Policy Data Source

Components

Backend Worker

  • Handles API requests
  • Fetches policies and applications
  • Processes Access logs
  • Performs analysis and categorization
  • Returns JSON results

Enhanced: ~2,156 lines
Simplified: ~650 lines

Frontend Dashboard

  • Interactive visualizations
  • Policy filtering and search
  • Category breakdowns
  • Time-based analysis
  • Export capabilities

Enhanced: ~2,571 lines
Simplified: ~850 lines

Key Technical Decisions

  • Serverless Architecture: Uses Cloudflare Workers for zero-maintenance, scalable deployment
  • Log-Based Analysis: Leverages existing Access logs rather than requiring additional instrumentation
  • Client-Side Rendering: Dashboard is static HTML with JavaScript, no backend rendering required
  • API-First Design: Worker exposes clean REST API that can be used by other tools
  • Two Version Strategy: Simplified version for quick starts, Enhanced for comprehensive analysis

๐Ÿ“Š Data Sources

Cloudflare API

  • Access Policies: All policies configured across the account
  • Access Applications: Application details including domains and paths

Access Logs (Enhanced Version Only)

  • Source: Cloudflare Access logs stored in R2 or S3 via Logpush
  • Data Points: Policy IDs, timestamps, user emails, decisions (allow/deny)
  • Time Range: Configurable (30/60/90 days)
  • Processing: Aggregates hits per policy and identifies usage patterns

๐Ÿ”€ Two Versions Available

Enhanced Version

For organizations with Access logs enabled

  • Full 4-category classification
  • Traffic-based hit analysis
  • Zombie policy detection
  • 95% cleanup confidence
  • Historical trends
  • Time-based filtering

Requirements: Access logs + Logpush to R2/S3

Simplified Version

For quick deployment without logs

  • Structural policy analysis
  • Configuration validation
  • Duplicate detection
  • Unused app identification
  • Fast deployment (<15 min)
  • No log infrastructure needed

Requirements: Cloudflare API access only

๐Ÿš€ Deployment

Quick Setup (Simplified Version)

1. Create Cloudflare Worker 2. Add environment variables: - CLOUDFLARE_ACCOUNT_ID - CLOUDFLARE_API_TOKEN 3. Deploy worker code 4. Deploy dashboard HTML 5. Access dashboard and run analysis

Full Setup (Enhanced Version)

1. Enable Cloudflare Access logs 2. Configure Logpush to R2 or S3 3. Wait 7-30 days for log accumulation 4. Create Cloudflare Worker 5. Add environment variables: - CLOUDFLARE_ACCOUNT_ID - CLOUDFLARE_API_TOKEN - R2_BUCKET_NAME (or S3 credentials) 6. Deploy worker code 7. Deploy dashboard HTML 8. Access dashboard and run analysis

๐ŸŽฏ Use Cases

Security Audits

Regular policy audits to ensure security posture and remove unused access points

Policy Cleanup

Identify and safely remove unused policies to reduce complexity

Compliance

Document which policies are active and demonstrate regular access reviews

Troubleshooting

Identify configuration issues like orphaned active policies

Migration Planning

Understand policy usage before restructuring or migrating applications

Cost Optimization

Reduce policy count and simplify infrastructure

๐Ÿ’ก Benefits

  • Time Savings: ~4 hours saved per audit compared to manual review
  • High Confidence: 95% certainty in cleanup recommendations using traffic data
  • Automated Analysis: No manual log parsing or policy cross-referencing needed
  • Visual Insights: Clear dashboard makes it easy to understand policy landscape
  • Risk Reduction: Identifies critical issues like orphaned active policies
  • Scalable: Works with hundreds of policies without performance degradation
  • Production-Ready: Built on Cloudflare's infrastructure, no additional servers needed

๐Ÿ“ฆ What's Included

Worker Code

Complete backend logic with API endpoints and analysis engine

Dashboard

Interactive HTML dashboard with visualizations and filtering

Setup Guide

Step-by-step deployment instructions

API Documentation

Complete API reference for integration

Examples

Configuration examples and use case scenarios

Version Guide

Comparison and migration documentation

๐Ÿ“‹
Summary: The Cloudflare Access Policy Analyzer automates the tedious process of auditing Access policies by analyzing both policy structure and actual traffic logs. It categorizes policies into 4 groups with 95% confidence, saving approximately 4 hours per audit. Built on Cloudflare Workers with two versions available - Enhanced (with logs) for comprehensive analysis, and Simplified (without logs) for quick deployment.