safe-web

Secure web fetch and search with **PromptGuard** scanning.

3,891 stars

Best use case

safe-web is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Secure web fetch and search with **PromptGuard** scanning.

Teams using safe-web should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/safe-web/SKILL.md --create-dirs "https://raw.githubusercontent.com/openclaw/skills/main/skills/adamnaghs/safe-web/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/safe-web/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How safe-web Compares

Feature / Agentsafe-webStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Secure web fetch and search with **PromptGuard** scanning.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# safe-web

Secure web fetch and search with **PromptGuard** scanning.

## Status

✅ Working

## Purpose

Protects against prompt injection attacks hidden in web content before returning it to the AI. Wraps web fetching and searching with security scanning.

## Installation

Requires [PromptGuard](https://clawhub.ai/seojoonkim/prompt-guard) and Python dependencies:

```bash
# Install PromptGuard first
cd /home/linuxbrew/.openclaw/workspace/skills/prompt-guard
pip3 install --break-system-packages -e .

# Install web dependencies (if not present)
pip3 install --break-system-packages requests beautifulsoup4
```

## Usage

### Fetch Command

Fetch a URL and scan the content:

```bash
# Basic fetch
safe-web fetch https://example.com/article

# Save to file
safe-web fetch https://example.com --output article.txt

# JSON output for automation
safe-web fetch https://example.com --json

# Strict mode (block on MEDIUM)
safe-web fetch https://example.com --strict
```

### Search Command

Search the web and scan results:

```bash
# Basic search
safe-web search "AI safety research"

# More results
safe-web search "stock market news" --count 10

# JSON output
safe-web search "machine learning" --json
```

## Exit Codes

| Code | Meaning |
|------|---------|
| 0 | Success - content/results are clean |
| 1 | Error (network, parsing, etc.) |
| 2 | Threat detected - content blocked |

## Configuration

### Environment Variables

- `BRAVE_API_KEY` - API key for Brave Search (optional, enables search command)
  - Get one at: https://brave.com/search/api/

### Symlink (Recommended)

Create a system-wide symlink so `safe-web` works from any directory:

```bash
sudo ln -s /home/linuxbrew/.openclaw/workspace/skills/safe-web/scripts/safe-web.py /usr/local/bin/safe-web
```

After creating the symlink, you can use `safe-web` directly without specifying the full path.

## How It Works

### Fetch Flow
1. Downloads URL content with requests
2. Extracts text using BeautifulSoup (removes scripts, styles)
3. Scans extracted text with PromptGuard
4. Returns clean content or blocks with SHIELD report

### Search Flow
1. Queries Brave Search API (requires API key)
2. Scans each result title and description
3. Filters out suspicious results
4. Returns only clean results

## Security Model

**Fail-closed:** If PromptGuard cannot be loaded or scanning fails, the tool reports an error rather than returning unverified content.

**Content sanitization:** HTML is parsed and scripts/styles are removed before scanning to reduce false positives.

**No execution:** This tool only fetches and scans. It never executes JavaScript or runs commands found in web content.

## Example Output

### Clean Fetch
```
Fetching: https://site.com/article
Fetched 1523 characters
Scanning with PromptGuard...

Article content here...
```

### Blocked Content
```
Fetching: https://suspicious-site.com
Fetched 2048 characters
Scanning with PromptGuard...
============================================================
🛡️  SAFE-WEB SECURITY ALERT
============================================================
Source: https://suspicious-site.com
Severity: CRITICAL
Action: BLOCK_NOTIFY
Patterns Matched: 8

Detected Patterns:
  - instruction_override_en
  - role_manipulation_en
  - system_impersonation_en
============================================================

Content from https://suspicious-site.com has been blocked.
```

### Search Results
```
Searching: AI research
Found 5 results, scanning...

Showing 3 clean results:

1. Latest AI Research Papers
   URL: https://arxiv.org/list/ai/recent
   Recent submissions in artificial intelligence...

2. AI Safety Institute
   URL: https://www.safe.ai/
   Research and development for safe AI systems...
```

## When to Use

Use `safe-web` when:
- Fetching content from untrusted URLs
- Scraping web pages for analysis
- Searching and processing web results
- Any web content will enter the AI context window

Use standard `web_fetch`/`web_search` tools only for:
- Trusted, known-safe domains
- Internal documentation sites
- When you explicitly want to bypass scanning

## Comparison with Native Tools

| Feature | Native `web_fetch` | `safe-web fetch` |
|---------|-------------------|------------------|
| Fetches HTML | ✅ | ✅ |
| Extracts text | ✅ | ✅ |
| Injection scanning | ❌ | ✅ |
| JSON output | ✅ | ✅ |
| Save to file | ❌ | ✅ |
| Exit codes | 0/1 | 0/1/2 (security) |

## Dependencies

- Python 3.8+
- [PromptGuard 3.1.0+](https://clawhub.ai/seojoonkim/prompt-guard) (installed in workspace)
- requests
- beautifulsoup4
- Brave Search API key (for search command)

## Limitations

- Search requires Brave API key (free tier available)
- Fetch does not execute JavaScript (static HTML only)
- Large pages may be truncated during text extraction
- Network timeouts default to 30 seconds

Related Skills

Food Safety & HACCP Compliance Agent

3891
from openclaw/skills

You are a food safety compliance specialist. Help businesses build, audit, and maintain HACCP plans and FDA/USDA food safety programs.

Food Safety & Compliance

AI Safety Audit

3891
from openclaw/skills

Comprehensive AI safety and alignment audit framework for businesses deploying AI agents. Built around the UK AI Security Institute Alignment Project standards (2026), EU AI Act requirements, and NIST AI RMF.

Security

openclaw-safe-change-flow

3891
from openclaw/skills

Safe OpenClaw config change workflow with backup, minimal edits, validation, health checks, and rollback. Single-instance first; secondary instance optional.

DevOps & Infrastructure

skill-safe-install-l0-strict

3891
from openclaw/skills

Strict secure-install workflow for ClawHub/OpenClaw skills. Use when asked to install a skill safely, inspect skill permissions, review third-party skill risk, or run a pre-install security audit. Enforce full review + sandbox + explicit consent gates, with no author-based trust bypass.

Security

龙虾安全卫士 (openclaw-safe-guard) v1.2.3

3891
from openclaw/skills

## 📦 来源信息

gateway-safety

3891
from openclaw/skills

Safely update OpenClaw gateway configuration (openclaw.json) with automatic validation, backup, and 30-second health-check rollback. Use this skill whenever an agent needs to modify gateway settings, ports, provider credentials, or network bindings to ensure the session is not permanently lost due to a bad configuration.

aimlapi-safety

3891
from openclaw/skills

Content moderation and safety checks. Instantly classify text or images as safe or unsafe using AI guardrails.

scar-safety

3891
from openclaw/skills

Agent safety that learns from incidents. Reflex arc blocks repeat threats without LLM calls.

run-command-safety-check

3891
from openclaw/skills

在执行 shell 方案前检查危险模式,如 pipe-to-shell、覆盖式删除、危险重定向或混淆执行。;use for shell, security, command-review workflows;do not use for 提供攻击性命令, 帮用户绕过限制.

li-etl-handle-safe - 安全版 Excel/CSV ETL 处理技能

3891
from openclaw/skills

## 功能描述

Workplace Safety & OSHA Compliance

3891
from openclaw/skills

Generate workplace safety programs, incident reports, hazard assessments, and compliance documentation.

AI Safety Guard × CMN Team

3880
from openclaw/skills

Prevents AI from accidentally leaking user privacy in all types of outputs. Automatically detects and filters sensitive information (ID cards, bank cards, phone numbers, addresses, medical records, passwords, etc.) across emails, documents, conversations, API responses, screen sharing, and more. This is a behavioral skill - the AI itself becomes privacy-aware, not a filtering tool.