Skip to content

Instantly share code, notes, and snippets.

@ProxiBlue
Last active August 10, 2026 22:06
Show Gist options
  • Select an option

  • Save ProxiBlue/cb5b024e8d958975e016edf2f125749b to your computer and use it in GitHub Desktop.

Select an option

Save ProxiBlue/cb5b024e8d958975e016edf2f125749b to your computer and use it in GitHub Desktop.
Gist to prevent claude to use webfetch due to summary issue

Full-page fetches only — MANDATORY (blanket, not just security)

Never use WebFetch (or any tool that pre-summarizes a page). Fetch the raw page and read it in full yourself. This applies to EVERY fetch — security scans, module/version checks, and general research/citation lookups alike. Widened 2026-08-11 from an advisory/CVE-only rule after the user made clear the same blind spot risks silently dropping content during research, not just security scans.

Why this exists

WebFetch's own tool description says it plainly: fetches the URL, converts HTML to markdown, processes the content with a small, fast model, and "results may be summarized if the content is very large." That intermediate model decides what's relevant before you ever see the page — on a long document it can silently drop a section.

2026-08-11 incident: a Claude instance in the lcd-mageos container was asked to check a security advisory URL against installed Amasty modules. It used WebFetch (internally referred to as "ctx_search" / "preview windows" in the incident writeup). The summarized result reported clean. The raw page in fact contained two critical High-severity RMA lines and a regenerate-url-rewrites line in a later chunk of the High-severity section — a real critical update was nearly missed entirely, caught only because the user pushed back and demanded a re-check with curl + grep. See auto-memory feedback_security_advisory_scan_raw_grep.md.

This is not unique to WebFetch — the same blind spot applies to any tool that returns an excerpt/snippet/preview instead of full content: mcp__claude-in-chrome__get_page_text/read_page, chrome-devtools page snapshots, "search this doc" style helpers. Anything that runs a secondary model or search pass between you and the raw bytes can drop content you needed.

Scope

Everything. No category carve-out. Security advisories, module/version cross-checks, compliance/legal/financial figures, general research citations, "what does this page say" — all of it gets the full raw page, every time.

What to do instead

curl -sL '<url>'

Read the FULL output yourself. If grepping to locate something first, grep only to LOCATE — then read the surrounding context in full, don't discard the rest as noise.

For JS-rendered or authenticated pages (curl can't render JS or hold a session): use a browser tool's raw text extraction — e.g. claude-in-chrome get_page_text/read_page, chrome-devtools page snapshot — not a search/summarize variant of it.

Enforcement

webfetch-completeness-guard.sh (PreToolUse, matcher WebFetch) hard-blocks every WebFetch call, full stop — widened 2026-08-11 from an advisory/CVE-keyword filter to a blanket block. One structural exception: claude.ai/code/artifact/{uuid} and preview.claude.ai URLs, since WebFetch is the only tool that can authenticate there (curl/headless-browser cannot) — not a completeness loophole, a hard capability gap. Blocked calls are redirected to curl or raw browser-tool extraction, not stopped outright — an alternative is always available for ordinary pages.

Genuinely need WebFetch for a page nothing else can reach? Ask the user, or add webfetch-completeness-guard to <repo>/.claude/rules-disable.

Known consequence

The built-in deep-research skill and any workflow that leans on WebFetch for fan-out source fetching will hit this block on every source. Expected — the fix is to fetch each source via curl (or raw browser extraction) and read it in full instead of accepting WebFetch's per-source summary. Slower and pricier in tokens; that trade was made deliberately after the 2026-08-11 near-miss.

#!/bin/bash
# PreToolUse WebFetch hook — blocks ALL WebFetch calls, no exceptions by
# category. Blanket policy as of 2026-08-11 (widened from advisory/CVE-only).
#
# Why: WebFetch converts page -> markdown -> feeds a small fast model ->
# returns a SUMMARY. On long pages the summary silently drops content
# ("Results may be summarized if the content is very large" per WebFetch's
# own tool description). 2026-08-11: an Amasty security-advisory scan via
# WebFetch missed two critical High-severity RMA lines + a regenerate-url-
# rewrites line — task reported clean when a real critical update was live.
# User then widened the rule: not just security, EVERY fetch (including
# research) must load full page content, never a preview/summary.
# See claude-skills-central memory: feedback_security_advisory_scan_raw_grep.
#
# Blocks (exit 2): every WebFetch call. Redirects to curl (raw content) for
# static pages, or a browser tool's raw text extraction (not its summarizing
# variant) for JS-rendered/authenticated pages — the alternative is always
# available, so this is a tool-swap, not a "stop and ask the user" block.
#
# One structural exception: claude.ai/code/artifact/{uuid} (incl.
# preview.claude.ai) URLs — WebFetch's own docs say these ARE fetchable via
# claude.ai login and curl/headless-browser CANNOT authenticate there. Not a
# completeness loophole: there is no alternative tool for this one case.
#
# Per-project opt-out: add the line `webfetch-completeness-guard` to
# <repo>/.claude/rules-disable.
#
# Defensive: NO set -e. Silent no-op if jq missing or input unparseable.
command -v jq >/dev/null 2>&1 || exit 0
INPUT=$(cat 2>/dev/null)
[ -z "$INPUT" ] && exit 0
URL=$(echo "$INPUT" | jq -r '.tool_input.url // ""' 2>/dev/null)
[ -z "$URL" ] && exit 0
# Structural exception: claude.ai artifact URLs — only WebFetch can auth here.
case "$URL" in
*claude.ai/code/artifact/*|*preview.claude.ai*) exit 0 ;;
esac
TOPLEVEL=$(git rev-parse --show-toplevel 2>/dev/null)
if [ -n "$TOPLEVEL" ] && [ -f "$TOPLEVEL/.claude/rules-disable" ]; then
grep -qx 'webfetch-completeness-guard' "$TOPLEVEL/.claude/rules-disable" 2>/dev/null && exit 0
fi
echo "BLOCKED by webfetch-completeness-guard.sh: WebFetch is blanket-blocked." >&2
echo "" >&2
echo "WebFetch summarizes via a small fast model and can silently drop" >&2
echo "content on long pages (2026-08-11 incident: missed critical High-" >&2
echo "severity lines in an Amasty advisory scan — false 'all clear'; policy" >&2
echo "then widened to ALL fetches, including research — full pages only)." >&2
echo "" >&2
echo "Instead:" >&2
echo " Static page: curl -sL '$URL' — read the FULL output yourself," >&2
echo " not just a grep match. Grep only to LOCATE, then read" >&2
echo " surrounding context in full, don't discard the rest." >&2
echo " JS-rendered / authenticated page: use a browser tool's raw text" >&2
echo " extraction (e.g. claude-in-chrome get_page_text /" >&2
echo " chrome-devtools snapshot) — not a search/summarize" >&2
echo " variant of it." >&2
echo "" >&2
echo "Genuinely need WebFetch (e.g. can't reach the page any other way)?" >&2
echo "Ask the user, or add 'webfetch-completeness-guard' to" >&2
echo ".claude/rules-disable." >&2
echo "Full reference: rules/reference/completeness-critical-fetch.md (claude-skills-central)." >&2
exit 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment