Add no-JS ad frame endpoint (/api/ads/frame) - #90
Merged
Merged
Conversation
Serves an ad as a full HTML document so publishers can embed a plain cross-origin <iframe src=...> that renders and is clickable with zero JavaScript on the host page. Enables embedding on JS-restricted contexts (e.g. Tor hidden services) and keeps the click link inside CrawlProof's own document so the host page can't intercept it. Impressions are metered server-side in serveAd, same as the JSON /api/ads/serve path. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
vu1nz Security Review0 finding(s) in PR #? No security issues found. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The current ad tag (
<div data-cp-ad>+ad.js) renders nothing until JS runs, and even then injects a sandboxedsrcdociframe whose click link can be interfered with by the host page's JS. It also can't work at all where JS is unavailable/blocked (e.g. Tor hidden services in Safer/Safest mode).What
New
GET /api/ads/frame?slot=<id>&format=<fmt>returns the ad as a full HTML document (not JSON), so publishers can embed a plain, script-free tag:target="_blank") lives inside CrawlProof's own cross-origin document → the host page can never intercept the click-through.content-security-policy: frame-ancestors *, noX-Frame-Options) — works on.onionpublishers who can only cut-n-paste.serveAd(bots → house ad, paid clicks tracked through/api/ads/click). No new tracking code.Reuses
serveAd+renderCreativeHtml; mirrors/api/ads/serve(which stays for thead.jspath).🤖 Generated with Claude Code