Skip to content

Charge AI training crawlers a day pass (x402 crawl gateway 0.11) - #166

Merged
ralyodio merged 1 commit into
mainfrom
feat/crawl-gateway
Oct 21, 2026
Merged

ralyodio merged 1 commit into
mainfrom
feat/crawl-gateway

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

Wires @profullstack/x402-gateway ^0.11.0 into the bundled Hono API and puts it in front of the Caddy-served pages.

  • Caddy forward_auth asks /api/crawl-gate (original path in X-Forwarded-Uri) on every GET/HEAD page read: 204 serves the page, the gateway's 402 offer (with PAYMENT-REQUIRED) is copied back to training crawlers.
  • /crawl and /crawl/* are reverse-proxied to the API: the $1 day pass (USDC on Base/Polygon/Ethereum, or the CoinPay Buy a day pass checkout). The site CSP (form-action 'self') is no longer sent on those paths so the checkout redirect to coinpayportal.com works.
  • Browsers, verified search crawlers (client IP from nginx X-Real-IP, which Caddy passes through), AI chat fetchers and tb_session holders are never charged; /api and /mcp are never metered.
  • Uses the existing "x402 crawl passes" key on business bf73e9d1 (COINPAY_X402_KEY + CRAWL_PAY_TO were already in app.env, never read; now also in vault tronbrowser-dev--prod).
  • services/api/src/crawl-gate.test.ts covers the forward_auth answers and the /crawl offer. Caddyfile validated with caddy:2.

🤖 Generated with Claude Code

Caddy serves the pages, so it asks the API first with forward_auth
(/api/crawl-gate): GPTBot and other training crawlers get the 402 offer with
PAYMENT-REQUIRED, everyone else gets the page. /crawl and /crawl/* go to the
API, which sells the fleet day pass (x402 USDC or CoinPay checkout); the CSP
header skips those paths so the Buy button can redirect to CoinPay. People,
verified search crawlers, AI chat fetchers and signed-in users are never
charged; /api and /mcp are never metered. Off without COINPAY_X402_KEY and
CRAWL_PAY_TO.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​profullstack/​x402-gateway@​0.11.08810010096100

View full report

@github-actions

Copy link
Copy Markdown
Contributor

ThreatCrush Security Scan

49 finding(s)

HIGH/CRITICAL: 2 | MEDIUM: 26 | LOW: 21

Severity Rule Location
HIGH py-ssrf-outbound-request apps/desktop/launcher/tron-tor-helper:303
HIGH py-ssrf-outbound-request apps/desktop/launcher/tron-tor-helper:437
MEDIUM js-open-redirect apps/desktop/extensions/ai-sidebar/install-helper.js:156
MEDIUM js-unescaped-html-sink apps/desktop/extensions/ai-sidebar/media.js:34
MEDIUM js-unescaped-html-sink apps/desktop/extensions/ai-sidebar/media.js:57
MEDIUM js-unescaped-html-sink apps/desktop/extensions/ai-sidebar/newtab.js:246
MEDIUM js-unescaped-html-sink apps/desktop/extensions/ai-sidebar/newtab.js:275
MEDIUM js-unescaped-html-sink apps/desktop/extensions/ai-sidebar/newtab.js:345
MEDIUM js-unescaped-html-sink apps/desktop/extensions/ai-sidebar/options.js:306
MEDIUM js-unescaped-html-sink apps/desktop/extensions/ai-sidebar/sidepanel.js:78
MEDIUM js-unescaped-html-sink apps/desktop/extensions/ai-sidebar/sidepanel.js:166
MEDIUM redos-nested-quantifier apps/desktop/extensions/ai-sidebar/w3bs.js:17
MEDIUM js-unescaped-html-sink apps/extensions/public/store.js:77
MEDIUM js-unescaped-html-sink apps/extensions/public/store.js:227
MEDIUM js-unescaped-html-sink apps/extensions/public/store.js:571
MEDIUM js-unescaped-html-sink apps/web/public/app.js:29
MEDIUM js-unescaped-html-sink apps/web/public/dns.js:54
MEDIUM sh-remote-script-execution apps/web/public/install.sh:182
MEDIUM sh-remote-script-execution apps/web/public/install.sh:422
MEDIUM sh-remote-script-execution apps/web/public/install.sh:440
MEDIUM js-unescaped-html-sink apps/web/public/settings.js:96
MEDIUM js-unescaped-html-sink apps/web/public/settings.js:168
MEDIUM js-dynamic-code-execution packages/sdk/src/mcp/tools.ts:125
MEDIUM js-dynamic-code-execution packages/sdk/src/page.ts:68
MEDIUM js-dynamic-code-execution packages/sdk/src/page.ts:73
MEDIUM sql-template-interpolation services/api/src/store/db.ts:116
MEDIUM js-dynamic-code-execution services/api/src/store/scanner.ts:44
MEDIUM sh-predictable-temp-path start.sh:28
LOW js-dynamic-code-execution apps/desktop/extensions/ai-sidebar/pit-proxy.test.js:8
LOW js-dynamic-code-execution packages/agent-runtime/src/analyze/form-script.test.ts:6
LOW js-unescaped-html-sink packages/agent-runtime/src/analyze/form-script.test.ts:26
LOW js-unescaped-html-sink packages/agent-runtime/src/analyze/form-script.test.ts:49
LOW js-dynamic-code-execution packages/browser-core/src/automation/extract-script.test.ts:6
LOW js-unescaped-html-sink packages/browser-core/src/automation/extract-script.test.ts:16
LOW js-unescaped-html-sink packages/browser-core/src/automation/extract-script.test.ts:45
LOW js-unescaped-html-sink packages/browser-core/src/automation/extract-script.test.ts:57
LOW js-unescaped-html-sink packages/browser-core/src/automation/extract-script.test.ts:80
LOW js-unescaped-html-sink packages/browser-core/src/automation/extract-script.test.ts:99
LOW js-dynamic-code-execution packages/browser-core/src/automation/snapshot-script.test.ts:11
LOW js-unescaped-html-sink packages/browser-core/src/automation/snapshot-script.test.ts:62
LOW js-unescaped-html-sink packages/browser-core/src/automation/snapshot-script.test.ts:101
LOW js-unescaped-html-sink packages/provenance/src/scan.test.ts:47
LOW js-unescaped-html-sink packages/provenance/src/scan.test.ts:170
LOW js-unescaped-html-sink packages/provenance/src/scan.test.ts:216
LOW js-dynamic-code-execution packages/sdk/src/mcp/automate.test.ts:261
LOW secret-generic-api-key packages/storage/src/config.ts:51
LOW secret-generic-credential packages/storage/src/config.ts:51
LOW js-dynamic-code-execution services/api/src/store/scanner.test.ts:32
LOW js-hardcoded-crypto-key services/api/src/store/signing.test.ts:24

Snippets are redacted; ThreatCrush never prints matched credential material.

@ralyodio
ralyodio merged commit 8fd38bb into main Oct 21, 2026
9 checks passed
@ralyodio
ralyodio deleted the feat/crawl-gateway branch October 21, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant