Skip to main content
Action blocking prevents agents from clicking buttons, filling forms, or interacting with specific elements on web pages. This is useful for protecting sensitive controls like delete buttons, payment forms, or administrative actions.

Overview

Action blocking rules target specific elements based on their properties (tag, ID, class, text content, etc.) and prevent agent interactions with those elements. Supported action types:
  • click - Blocks clicking on buttons, links, and other clickable elements
  • input - Blocks typing into input fields and text areas
  • change - Blocks changing select dropdowns and other form controls

Storage Structure

Action blocking rules are stored in chrome.storage.local under the key blockedActions:

Rule Properties

All element properties must match for a block to trigger. Set properties to null to ignore them in matching.

Implementation

Loading Rules

Rules are loaded on page load and updated when storage changes:
content.js:516-529

Element Matching

The extension checks if an element matches a blocking rule:
content.js:531-547

Click Blocking

Checks element and all parent elements up to document.body:
content.js:549-572

Input Blocking

Similar logic for input and change events:
content.js:574-597

Event Listeners

Block events are registered when agent mode starts:
content.js:486-498

Blocking Behavior

When a blocked action is attempted:
content.js:608-622
1

Event Prevented

The click/input event is completely stopped using preventDefault() and stopImmediatePropagation().
2

Visual Feedback

The element briefly shows a red border to indicate it was blocked.
3

Agent Stopped

A message is sent to the background script, which stops the agent and shows a notification.

Visual Feedback

content.js:599-606

Background Script Handling

When the background script receives an ACTION_BLOCKED message:
background.js:243-262

How to Create Rules

1

Open Dashboard

Click the ContextFort extension icon to open the dashboard.
2

Navigate to Action Blocking

Go to the “Action Blocking” section in the dashboard.
3

Add Rule

Click “Add Rule” and fill in the element properties you want to block.
4

Test Rule

Start an agent session and attempt the blocked action to verify it works.

Example Configurations

Block Delete Buttons

Blocks clicking any button with text “Delete” on any page.

Block Credit Card Input

Prevents agents from typing into the credit card field on the checkout page.

Block All Submit Buttons on Admin Page

Blocks all submit button clicks on the admin page.

Parent Element Matching

The blocking logic checks parent elements, so if you block a <div>, clicking any child element inside that div will also be blocked. Example: If you block this div:
Clicking the <p> or <button> will also be blocked because they’re children of the blocked div.
Action blocking stops the agent but doesn’t prevent all interactions. Agents using browser automation tools might still interact with blocked elements through JavaScript execution.

Best Practices

  1. Be Specific: Use multiple properties to avoid false positives
  2. Test Thoroughly: Verify rules don’t block legitimate actions
  3. Use URL Filtering: Limit rules to specific pages when possible
  4. Document Rules: Keep notes on why each element is blocked
  5. Combine with Other Controls: Use alongside URL blocking and governance rules