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 elementsinput- Blocks typing into input fields and text areaschange- Blocks changing select dropdowns and other form controls
Storage Structure
Action blocking rules are stored inchrome.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 anACTION_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
Block Credit Card Input
Block All Submit Buttons on 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:
<p> or <button> will also be blocked because they’re children of the blocked div.
Best Practices
- Be Specific: Use multiple properties to avoid false positives
- Test Thoroughly: Verify rules don’t block legitimate actions
- Use URL Filtering: Limit rules to specific pages when possible
- Document Rules: Keep notes on why each element is blocked
- Combine with Other Controls: Use alongside URL blocking and governance rules
Related
- URL Blocking - Domain-level navigation restrictions
- Governance Rules - Network-level compliance policies