Skip to main content
URL blocking rules prevent agents from navigating between specific domains or URLs during a session. This ensures sensitive context doesn’t leak across different websites.

Overview

ContextFort supports two types of URL blocking:
  1. Domain Blocking Rules - Block navigation between domains (e.g., prevent gmail.com → slack.com)
  2. URL Pair Blocking Rules - Block navigation between specific full URLs

Storage Structure

Domain Blocking Rules

Stored as an array of domain pairs in chrome.storage.local under urlBlockingRules:
Rule types:
  • ["domainA", "domainB"] - Blocks bidirectional navigation between domainA and domainB
  • ["domain", ""] - Blocks navigation FROM domain to ANY other domain
  • ["", "domain"] - Blocks agent mode entirely on domain (no agent access allowed)

URL Pair Blocking Rules

Stored as an array of full URL pairs in chrome.storage.local under urlPairBlockingRules:
These rules block navigation between exact URLs, providing more granular control than domain rules.

How It Works

Domain Matching

Domain matching supports subdomains:
background.js:1174-1177
Examples:
  • Pattern "example.com" matches:
    • example.com ✓
    • www.example.com ✓
    • api.example.com ✓
    • app.staging.example.com ✓
The extension checks navigation rules in three scenarios:
1

Agent Mode Disabled

When pattern is ["", "domain.com"], agent mode is completely blocked on that domain.
2

No Outbound Navigation

When pattern is ["domain.com", ""], agents can’t navigate away from domain.com to any other site.
3

Bidirectional Blocking

When pattern is ["domainA", "domainB"], agents can’t navigate between these domains in either direction.

Implementation

background.js:1179-1239
URL blocking is enforced at three points:

1. Agent Detection

When agent mode starts:
background.js:730-740

2. Before Navigation

Intercepts navigation before it happens:
background.js:1241-1268

3. Tab Updates

Monitors URL changes from tab updates:
background.js:1271-1312

Loading Rules

Rules are loaded on extension startup and updated via messages:
background.js:360-368

User Notifications

When navigation is blocked, users see:
  1. Badge notification - Red ⛔ icon on extension badge
  2. In-page notification - Toast notification explaining why navigation was blocked
  3. Agent stops - The stop button is automatically clicked to halt the agent
Blocked navigation automatically stops the agent. Users must manually restart agent mode after addressing the issue.

Example Configurations

Prevent Email-to-Slack Context Leakage

Agents can’t navigate from email to Slack or vice versa.

Block Agents on Admin Panels

Agent mode is completely disabled on these domains.

Isolate Internal Tools

Agents can access the internal tool but can’t navigate anywhere else from it.

Best Practices

  1. Start Broad: Use domain rules for general restrictions
  2. Be Specific: Use URL pair rules for page-level granularity
  3. Test Scenarios: Verify rules work for common agent workflows
  4. Document Rules: Keep notes on why each rule exists
  5. Monitor Sessions: Check visibility logs to see when rules trigger