Skip to content

Add WebBlocker extension for productivity and focus - #22715

Merged
raycastbot merged 9 commits into
raycast:mainfrom
ZoroHacker:web-blocker-submission
Nov 14, 2025
Merged

raycastbot merged 9 commits into
raycast:mainfrom
ZoroHacker:web-blocker-submission

Conversation

@ZoroHacker

Copy link
Copy Markdown
Contributor

Description

WebBlocker is a powerful productivity extension that helps users stay focused by blocking distracting websites across all browsers on macOS. Unlike browser extensions that can be easily disabled or bypassed, WebBlocker uses system-level blocking to ensure websites stay blocked—even if they're already open in browser tabs.

Key Features:

  • Effective Blocking: Uses advanced system-level blocking that works across ALL browsers (Chrome, Safari, Arc, Firefox, Edge, Brave)
  • Blocks Already-Open Tabs: Automatically closes and blocks websites that are already open when blocking is enabled
  • Easy Management: Simple interface to add, enable/disable, and manage blocked websites
  • Secure Authentication: Requires Password authentication for all blocking operations
  • Persistent: Blocking survives system restarts and can't be easily bypassed

Commands:

  1. Add Website to Block - Add any website to your block list with automatic URL sanitization
  2. Enable Website Blocking - Activate blocking for all enabled websites with Password authentication
  3. Disable Website Blocking - Deactivate blocking while preserving your block list
  4. Manage Blocked Sites - View, enable/disable, or delete websites from your list
  5. Force Re-Block & Fix - Troubleshoot and refresh blocking if issues occur

Perfect For:

  • Students needing focus during study sessions
  • Professionals avoiding workplace distractions
  • Writers and creators requiring deep work periods
  • Anyone wanting to reclaim control of their time

Screencast

web-blocker-1 web-blocker-3 Raycast 2025-10-18 at 10 43 36

Checklist

@raycastbot raycastbot added new extension Label for PRs with new extensions platform: macOS labels Nov 6, 2025
@raycastbot

raycastbot commented Nov 6, 2025 •

Copy link
Copy Markdown
Collaborator

Congratulations on your new Raycast extension! 🚀

Due to our current reduced availability, the initial review may take up to 10 business days.

Once the PR is approved and merged, the extension will be available on our Store.

ghost left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Greptile Summary

This PR introduces a new WebBlocker extension for Raycast that provides system-level website blocking functionality on macOS. The extension implements multiple blocking mechanisms including hosts file modification, PF firewall rules, and aggressive DNS cache clearing to ensure blocked websites remain inaccessible across all browsers. The extension includes 5 commands: adding websites to block, enabling/disabling blocking, managing blocked sites, and troubleshooting blocks. The implementation uses system-level privileges, AppleScript for authentication, and comprehensive browser integration to close existing tabs when blocking is enabled. The extension stores data using Raycast's LocalStorage API and includes features like category management, bulk operations, and import/export functionality.

PR Description Notes:

  • Title inconsistency: package.json uses "Webblocker" while the PR and other files use "Web Blocker"
  • The CHANGELOG entry incorrectly uses a hardcoded date (2025-10-18) instead of the required {PR_MERGE_DATE} template string

Important Files Changed

Filename Score Overview
extensions/web-blocker/package.json 3/5 Defines extension metadata and commands but has title inconsistency and missing @raycast/utils dependency
extensions/web-blocker/CHANGELOG.md 3/5 Documents initial release but uses hardcoded date instead of required {PR_MERGE_DATE} template
extensions/web-blocker/src/domainUtils.ts 5/5 Provides clean domain validation and sanitization utilities with proper TypeScript practices
extensions/web-blocker/src/storage.ts 3/5 Comprehensive storage management but force-clears categories on every read which could cause data loss
extensions/web-blocker/src/statusVerifier.ts 4/5 Provides blocking status verification with good error handling and dynamic imports
extensions/web-blocker/src/passwordManager.ts 4/5 Implements secure session-based authentication caching for system operations
extensions/web-blocker/src/streamlinedHostsManager.ts 1/5 Extremely aggressive system modifications including process killing and network interface manipulation
extensions/web-blocker/src/browserCacheClearer.ts 2/5 Terminates browser processes without consent and performs invasive system-level modifications
extensions/web-blocker/src/pfFirewallManager.ts 2/5 Modifies critical system firewall configuration with potential network connectivity risks
extensions/web-blocker/src/aggressivePFFirewall.ts 2/5 Network-level blocking with IP resolution and connection termination that could affect system stability
extensions/web-blocker/src/view-blocked-sites.tsx 2/5 Feature-rich management interface but has security concerns with file operations and AppleScript usage
extensions/web-blocker/src/refresh-blocking.tsx 3/5 Implements troubleshooting command with proper authentication but has unused imports
extensions/web-blocker/src/hudHelper.ts 2/5 Attempts to extend HUD display time but implementation is fundamentally flawed
extensions/web-blocker/tsconfig.json 4/5 Standard TypeScript configuration with minor output directory concern

Confidence score: 1/5

  • This extension implements extremely aggressive system-level modifications that pose significant risks to system stability and user security
  • Score reflects critical concerns with privileged system operations, process termination without consent, network interface manipulation, and firewall configuration changes that could break system networking
  • Pay close attention to all system modification files: streamlinedHostsManager.ts, browserCacheClearer.ts, pfFirewallManager.ts, and aggressivePFFirewall.ts which contain potentially dangerous operations

14 files reviewed, 16 comments

Edit Code Review Agent Settings | Greptile

try {
// Resolve IPv4
const { stdout: ipv4 } = await execAsync(
`dig +short ${domain} A 2>/dev/null || true`,

ghost Nov 6, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Command injection vulnerability - domain parameter is not sanitized before being passed to shell command

);
ipv6.split("\n").forEach((ip) => {
const trimmed = ip.trim();
if (trimmed && trimmed.match(/^[0-9a-f:]+$/i)) {

ghost Nov 6, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: IPv6 regex validation is too permissive and may match invalid addresses containing only colons


# Add all blocked IPs to the table
echo "📋 Adding ${ips.length} IPs to block list..."
${ips.map((ip) => `pfctl -t webblocker_blocked -T add ${ip} 2>/dev/null || true`).join("\n")}

ghost Nov 6, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Shell injection vulnerability - IP addresses from DNS resolution are not validated before insertion into shell commands

Comment on lines +521 to +525
const statusText = tempUnblockExpiry
? `⏱️ Temporarily unblocked (${domains.length} domains)`
: isBlockingActive
? `🚫 ${domains.length} websites blocked`
: `✅ ${domains.length} websites ready`;

ghost Nov 6, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Variable statusText is defined but never used in the rendered output


try {
// Execute the command with sudo using AppleScript (uses cached admin session)
const escapedCommand = command.replace(/'/g, "'\\\\\"'\\\\\"'");

ghost Nov 6, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Command injection vulnerability - the escaping pattern is insufficient and dangerous

this.session = null;
// Also clear sudo timestamp
try {
execAsync("sudo -k");

ghost Nov 6, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax: Missing await - execAsync should be awaited to properly handle the sudo clear operation

Comment on lines +17 to +19
await showHUD(message);
// Keep the message visible by delaying the next action
await new Promise((resolve) => setTimeout(resolve, durationMs));

ghost Nov 6, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: This delay doesn't extend HUD visibility - Raycast controls HUD duration internally. The setTimeout only blocks further execution but won't keep the HUD visible longer. Are you experiencing issues with HUD messages disappearing too quickly, or is this based on an assumption about HUD behavior?

@ZoroHacker
ZoroHacker force-pushed the web-blocker-submission branch from 1c54e5a to e8e616c Compare November 6, 2025 17:52
@pernielsentikaer pernielsentikaer self-assigned this Nov 7, 2025
@pernielsentikaer

ghost commented Nov 7, 2025

Copy link
Copy Markdown
Contributor

I update the code a bit, could you make sure I didn't break something?

Also, I deactivated a few sites here but it's still in the hosts file?

CleanShot 2025-11-07 at 15 52 14@2x

Maybe I need to sync first, but that would be a bit weird flow

@pernielsentikaer
pernielsentikaer marked this pull request as draft November 7, 2025 14:53
- Changed disableBlocking() to remove only WebBlocker-tagged entries
- Previously replaced entire /etc/hosts file, deleting user's custom entries
- Now uses grep -v to filter out only WebBlocker lines
- Fixes issue where disabled domains remained in hosts file
- Addresses reviewer feedback from @pernielsentikaer
@ZoroHacker
ZoroHacker force-pushed the web-blocker-submission branch from 19a7f51 to 06acb93 Compare November 7, 2025 15:30
@ZoroHacker
ZoroHacker marked this pull request as ready for review November 7, 2025 15:42
@ZoroHacker

ghost commented Nov 7, 2025 •

Copy link
Copy Markdown
Contributor Author

Thanks a lot for updating the code, @pernielsentikaer! 🙌

I checked everything and fixed the issue — it’s now working perfectly, including proper syncing between the UI and the hosts file.

Really appreciate you taking the time to review and improve it — everything’s smooth now! 🚀

ghost left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Greptile Summary

This review covers only the changes made since the last review, not the entire PR. The changes in this iteration are minimal, with the primary modification being an improvement to the hosts file cleaning logic in streamlinedHostsManager.ts. Instead of completely replacing the hosts file content, the updated logic now preserves existing user entries while only removing WebBlocker-specific entries. This addresses a critical usability issue where users' custom hosts file configurations (such as development environment mappings) would be destroyed. A minor formatting change was also made to package.json fixing capitalization in a command title.

Important Files Changed

Filename Score Overview
extensions/web-blocker/src/streamlinedHostsManager.ts 1/5 Improved hosts file preservation logic but still contains critical command injection vulnerabilities
extensions/web-blocker/package.json 2/5 Minor formatting fix but still has title inconsistency and non-standard build script

Confidence score: 1/5

  • This PR contains critical security vulnerabilities that make it unsafe to merge
  • Score reflects the presence of multiple command injection vulnerabilities and insufficient input sanitization despite the positive improvement to hosts file handling
  • Pay close attention to streamlinedHostsManager.ts which needs comprehensive security review and remediation before this extension can be considered safe for production use

2 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines +283 to +288
echo " ✓ All rules flushed"

# Flush ALL connection states (this is critical!)
pfctl -F states 2>/dev/null || true
pfctl -F state 2>/dev/null || true
echo " ✓ All connection states cleared"

ghost Nov 7, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Potentially destructive - flushing all firewall states affects the entire system, not just WebBlocker connections. Should this only flush WebBlocker-related states instead of all system firewall states?

@pernielsentikaer

ghost commented Nov 7, 2025

Copy link
Copy Markdown
Contributor

Did you roll many of my corrections back :D

@pernielsentikaer

ghost commented Nov 7, 2025

Copy link
Copy Markdown
Contributor

I can do them again, here I only fixed a few new things

@ZoroHacker

ghost commented Nov 8, 2025

Copy link
Copy Markdown
Contributor Author

Thanks a lot, @pernielsentikaer! 🙌

I reviewed your latest changes and everything looks great now — I really appreciate your help polishing the extension.

Everything’s working smoothly on my end after the fixes, so I think it’s ready for publishing whenever you’re good with it. Thanks again for taking the time to review and improve it! 🚀

Per Nielsen Tikær added 3 commits November 14, 2025 07:47
… handling

- Removed obsolete .eslintrc.json file.
- Updated package-lock.json to include new dependencies and updated versions for existing ones.
- Enhanced error handling in various components to use showFailureToast for better user feedback.
- Refactored TypeScript configuration to target ES2023 and streamline options.
- Cleaned up code by removing unused imports and improving consistency across files.
- Simplified .gitignore by removing unnecessary entries and adding Raycast-specific files.
- Introduced a new ESLint configuration file to integrate Raycast's ESLint settings.

ghost left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, approved 🔥

@raycastbot
raycastbot merged commit dac38da into raycast:main Nov 14, 2025
@github-actions

ghost commented Nov 14, 2025

Copy link
Copy Markdown
Contributor

@raycastbot

ghost commented Nov 14, 2025

Copy link
Copy Markdown
Collaborator

🎉 🎉 🎉

Such a great contribution deserves a reward, but unfortunately we couldn't find your Raycast account based on your GitHub username (@ZoroHacker).

Please link your GitHub account to your Raycast account to receive your credits and soon be able to exchange them for some swag.

@ZoroHacker

ghost commented Nov 15, 2025

Copy link
Copy Markdown
Contributor Author

Thanks so much for publishing the extension, @pernielsentikaer — I really appreciate all your help throughout the review process! 🙌

Everything looks great, but I noticed that the screenshots on the store page aren’t showing up. I’m not sure if I missed a formatting requirement or if something needs to be updated on my side.

Could you let me know the correct way to add screenshots so they display properly?

Thanks again for all your support — it means a lot! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new extension Label for PRs with new extensions platform: macOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants