Wisp is in pre-release, self-hosted since GitHub suspended us. Install it, or see the changelog.

Wisp

Security and Hardening

Wisp can be broken. The team audits every source file line by line within three days of a change. No third party has audited Wisp. Defaults and the CSP are in CLI, dev loop and security, limits in Runtime and build.

Status

  • The full test suite runs on every change, including a test that compiles every code sample of the reference.
  • A seeded generator fuzzes the HTTP/1 parser, HTTP/2 frames and HPACK, JSON, forms, cookies, WebSocket frames and the signing code, and gives the compiler's scanners malformed, nested and huge input. wisp fmt gets an idempotent round trip. A failing seed repeats.
  • A table of request-smuggling shapes (conflicting lengths, doubled Transfer-Encoding, bad chunking) must each be refused. A head line ending in a bare LF, and chunked trailer lines that are not name: value, are a 400. A connection over WISP_MAX_CONNS gets a 503 and a clean close.
  • Startup proves every fast path, and each falls back. A handler panic is a 500 while the server keeps serving. The shipped code has no unsafe code outside the Linux I/O drivers, the edge exports and the Windows Job Object that ends wisp dev companions.
  • Each pass hunts bugs in one area (HTTP, app and browser script, build, CLI, edge bridges), and each finding gets a test.

Latest Hardening

Auth

  • redirect(wisp::local(next)) sends a visitor-supplied next only to a path of this site: local("/cart") is /cart, local("//evil.example") is /evil.example, and anything that is not a path (https://…, cart, a line break, empty) becomes /. Leading slashes, backslashes, tabs, control characters and spaces are dropped, so //evil, /\evil and \x01//evil go out as /evil. redirect alone lets https://… through on purpose, so pass a ?next= through wisp::local. A value with CR, LF or NUL, or a control byte (but tab) left inside the path, is a 500.
  • cx.set_cookie, cx.set_header and Response::with_header drop a value they cannot hold (a control byte but tab: CR, LF, NUL, DEL; ;, a space or non-ASCII in a cookie) and log the name and length, never the value. Error::with_header becomes a logged 500. No header or cookie injection.
  • Origin: null on a form post (a page with Referrer-Policy: no-referrer, as on Tor onion sites) passes with Sec-Fetch-Site: same-origin. It also passes with no Sec-Fetch-Site and the valid token of a <form guard>. The token case works on native only. With cross-site, same-site or none, or with none and no valid token, it is a 403. WISP_REFERRER=same-origin keeps the real Origin on its own posts.
  • A page for one visitor gets cache-control: private, no-store, so Back after a sign-out cannot show it, and the offline worker does not keep it. The sources are: a signed cookie read, a flash shown, cx.nonce() and a <form once>. The edge builds send it too. A flash cookie lives 5 minutes and is cut to fit 4 KB.
  • A page's own SIGNED_IN, MIDDLEWARE, RATE_LIMIT or CORS gates every method of the endpoints of its route (+server.rs or mod server), also a put, patch or delete, a post of a page with no action, and the member route /[id]. An endpoint that must stay public goes to another route. CORS runs once and before every guard: the endpoint's CORS if it has one, else the page's.
  • Sign-ins are limited to ten a minute per account, not per address. <form once> answers a form sent twice with a 303 to the page.
  • Without ORIGIN, form posts and WebSocket upgrades check the scheme too: an http:// page cannot post to a site whose proxy sends X-Forwarded-Proto: https, with WISP_CLIENT_IP_HEADER set or not. An Origin that is not http(s):// is refused. Set ORIGIN for an exact match. With ORIGIN set to the clearnet site, a form post from the onion twin of the app also passes, when its Origin is a .onion address that equals its Host. A post from another onion is a 403.
  • On a native build, a form post or WebSocket upgrade with an Origin that is not UTF-8 is a 403, with ORIGIN set or not.

Abuse and JavaScript-off sites (Tor)

  • RATE_LIMIT and cx.limit count by cx.visitor(): the address (the /64 for IPv6), or behind Tor a signed ticket cookie plus the whole site's allowance (eight clients' worth), so a swarm of made-up visitors cannot multiply a limit. A request claims Tor only with a .onion Host from a local peer. An export does not count.
  • Cookies are Secure, and the session, flash, OAuth and signed ones __Host- (under WISP_BASE, they are __Secure- with Path=<base>. A signed cookie with a domain, or a path other than /, is __Secure-name. A sibling subdomain can set a __Secure- cookie, which it cannot do for a __Host- one. Under nested bases /a and /a/b, both apps send __Secure-session to /a/b), with no setting: Wisp has no TLS of its own, so a deploy sits behind a TLS proxy (SvelteKit's default). They stay plain only in dev, for plain http to localhost, *.localhost or a loopback address, an onion, or a named proxy (WISP_CLIENT_IP_HEADER) that says x-forwarded-proto: http. A plain-http deploy with no proxy (an intranet box) must have its proxy send x-forwarded-proto: http with WISP_CLIENT_IP_HEADER set, or run in dev; else the browser drops the cookies and sign-in fails. Wisp logs this once, the first time a Secure cookie goes out on such a request.
  • A route param keeps its raw text when an escape would add a /, a \ or a . or .. segment (%2F, %5C, %2E%2E). So cx.param("slug") cannot hold ../x from an escape.
  • x-forwarded-proto and x-forwarded-host are read like the client address: the entry WISP_CLIENT_IP_DEPTH names from the right, the one your proxy added.
  • DNS rebinding: with ORIGIN set, the app refuses a form post from any other origin. Without it, a release build accepts any Host, because the proxy routes by it. Set ORIGIN for apps on a trusted network. WISP_ALLOWED_HOSTS (or wisp::allow_hosts) answers a request with any other Host with a 421. It holds on the native server and on the node, deno, bun and cloudflare targets. On cloudflare, the files of static/ come from Cloudflare and skip the check. The pages, vercel, netlify and azure hosts also serve those files before the app. Not tested on those hosts.
  • HTTP/2: a host beside :authority must name the same host (RFC 9113 8.3.1), else the stream is refused.
  • WISP_MAX_CONNS is server-wide, not per client, as nginx's default; put a per-IP connection limit in the proxy if one client must not hold every slot.
  • Backoff locks a key out for longer each time, before any password hashing, with the same answer for a name that does not exist. The request after free failures gets the 429. A flood of made-up names cannot make it forget a lockout or a count. A 429 from a form action shows the form again with what was typed, the wait in words and retry-after.
  • <form guard> adds a token signed over the page, action and ticket (once, 2 seconds to 12 hours old) and an invisible honeypot. No script, no third party. A forged or mangled token never panics (fuzzed).
  • wisp::untoken_once makes a reset or magic-link token work once.
  • A refused form lists its problems at the top with role="alert" and autofocus, linked to the fields, with no script.

Servers

  • Tor onion services: WISP_ONION sends no-referrer, never HSTS, no Secure cookie, a date to the minute and a CSP with no external images. x-forwarded-* and WISP_CLIENT_IP_HEADER are ignored. A Host that only ends like .onion (evil.onion.example.com, a.onion/x) is not one. An attacker's .onion Host never replaces SITE_URL in a sitemap.
  • HTTP/2: a reset the server sends because of a client (MadeYouReset) spends the client's reset budget. Past 1 MiB of incoming bodies, only the oldest stream's window reopens. Sending past the receive window is FLOW_CONTROL_ERROR. content-length is digits only, and repeats must agree. A :path that is not origin form, or a header name that is not a lowercase token, is a stream PROTOCOL_ERROR. Padding-only DATA frames, GOAWAY frames, WINDOW_UPDATEs for closed streams, and WINDOW_UPDATEs that grant room when nothing was sent since the last one spend the empty-frame flood budget. A field value with a control byte but tab (C0, DEL), pseudo-headers too, is a stream PROTOCOL_ERROR, as HTTP/1 answers 400. A body still arriving must keep up 1 KB/s after a 10 s grace, as over HTTP/1.
  • A WebSocket message sent in pieces must make progress every 10 s and come whole at 1 KB/s after that, or it is closed with 1008 (built-in server, HTTP/2, raw edge sockets).
  • Over HTTP/1.1, the built-in server drops a client that takes none of a response for 30 s, or when the kernel takes less than 1 KB/s of it after those 30 s. The rate counts the bytes that the kernel takes from the server, not the bytes that the client reads. On Linux it resets the connection (TCP RST), so the kernel frees the queued response at once. A client that reads a byte at a time cannot hold a large response in memory.
  • A CACHE answer that carries its own content-encoding says vary: accept-encoding.
  • OAuth: a .redirect(url) must be https:// (loopback http:// for tests) with no #; in dev the callback takes the Host only when it is loopback; an https OIDC issuer's endpoints must all be https.
  • Dev mode on an address other than loopback signs with a key of its own process, never .wisp/secret. Under wisp dev, a HOST other than loopback counts too.
  • A chunked body arriving a few bytes at a time is parsed once, not from the start each read.
  • A JSON text holds at most 200 000 values, keys' members counted, read into a Value or straight into a type ("too many values", a 400), and a Value is 16 bytes with short text inline and each array or object made at its final size, so a body of tiny values ([0,0,...], {"":0,...}, [[],[],...]) holds at most 8 times its size (under 16 times for nested one-item arrays and one-member objects, [[0],[0],...] and [{"":0},...]) and never more than about 8 MB. A key twice: the last one counts, on every path. \u0000 is JSON, so it stays in a String; Email and the email, url and slug rules refuse it.
  • wisp::fetch and fetch_follow read a chunked reply as it arrives, each byte once (a server cutting its reply into pieces that end in an empty line cannot make it decode again from the start), parse the head once, hold a sized reply in one allocation of its size, and check chunk sizes with sums that cannot wrap on 32-bit targets.
  • wisp::fetch_follow never sends a body (307/308) or a header the app set to another origin; the on_fetch hook gets hop.moved, so a key it adds stays on the first origin. A URL a visitor names goes through wisp::fetch_public: every call, the first too, only to public addresses (every IANA special-purpose range refused, 6to4, Teredo and NAT64 forms included), at most 16 at once with /_img remote pictures.
  • wisp::fetch_stream is for the app's own URLs and checks no address; wisp::fetch_stream_public streams from a URL a visitor named, only to public addresses (every address checked, the one connected to), at most 8 at once with turns of their own (one more is a 503), so they never starve fetch_public. At most 256 fetch streams are open at once; one more is a 503. A stream asks for accept-encoding: identity; a coding the upstream sends anyway is passed with vary: accept-encoding.
  • The upstash, vercel-blob, libSQL (with a token) and s3: (with a session token) stores send their token over https only. Plain http is for localhost, 127.0.0.1 and [::1], else the first call answers a 500: a token goes over https only (plain http is for localhost).
  • Upstream::respond() sends x-content-type-options: nosniff, and content-security-policy: sandbox for any type but event streams, JSON, NDJSON, plain text, bytes, PDF and raster images (not SVG): an upstream's HTML never runs script on your origin.
  • Upload file names lose bidi controls (U+202A-202E, U+2066-2069), zero-width and other invisible characters (U+200B-200F, U+2060-206F, U+FEFF, the soft hyphen, variation selectors, tags), a drive (C:), an NTFS stream (:stream), paths, and trailing dots and spaces, and are cut to 255 bytes. A Windows device name (CON, nul.txt, COM1.png) gets a _ in front. The kind of an upload comes from its first 256 bytes, in memory or streamed, then a bounded read of the file for zips (Office, OpenDocument, EPUB) and text (JSON, CSV, and control bytes anywhere).
  • Streamed uploads go to temporary files created new (O_EXCL), named at random, mode 0600, in a folder of the process's own (0700, named at random). Every error path removes them. A form sends at most 64 files and 256 parts.
  • image/* never matches SVG. Svg parses SVG strictly (no DOCTYPE, entities, UTF-16 or NUL; bounded depth, elements and attributes) and writes it again from a namespace-aware allowlist: no script, foreignObject, style element, animation, on* attribute, external link or url(). It is served with a sandboxing CSP; show it only through <img> (data_url() or a route), never inlined. Image refuses a header over 8192 by 8192 pixels, or one whose size cannot be read. A zip is labelled by its central directory: an OpenDocument mimetype first entry never hides Office or macro parts.
  • A kind is what the bytes are, not a promise they are harmless: one file can be two kinds (HTML inside a GIF, a PDF with JavaScript). What the app must still do: serve uploads from Response::file_in (or with nosniff, a sandboxing CSP and attachment), ideally from another origin; never serve one with a type the visitor chose; never serve an Upload taken with types = "image/svg+xml" inline (take an Svg); scan files with an antivirus if users share them.
  • Without SITE_URL, a release build takes no address from the Host header. It serves no made /sitemap.xml, /robots.txt or /feed.xml, so a client's Host never names the links in them. Dev mode still uses the Host.
  • A string style={:s} keeps only the declarations that style=${s} keeps on the server's first paint. A declaration stays when it is name:value with no \, comment, expression(, javascript:, -moz-binding or behavior in the value. scroll-behavior stays in a value. Wisp also refuses a declaration whose name is behavior, -moz-binding or -ms-behavior, in any case. This is a precaution: they are old engine features that load code from a URL. live.js filters the style attribute that the page sets: a string, an object, a quoted value with {:…} and a spread. It refuses each declaration whose name is behavior, -moz-binding or -ms-behavior, in any case. It also refuses each declaration whose name has a \ or a /* (a CSS escape or a comment). It reads each ; as the end of a declaration, also inside a quote or in url(). So it can refuse a part of a quoted value that looks like such a declaration. It keeps every other part as it is, also a data URL with a ; in a quote. The server's first paint refuses a value with ;, so it leaves such a data URL out. A url() stays on both.
  • The build fails for a hole in the name of a declaration in a quoted style attribute (style="-moz-${x}:v", style="${a}${b}:v", style="a:b;${c}"). Two values that pass the check one by one can write a banned name together. A hole after name: stays. The error is: a `${}` in a `style` attribute must come after `name:`. A property name must be text in the file. Write style="color:${value}" or style=${declarations}. The same holds for a <wisp:element> and a component tag.
  • A form post that wisp.js sends and that answers with a file shows the file only for an image that is not SVG, audio, video or plain text. It saves any other type (SVG, XML, PDF, JSON) as a download, because the blob address loses the answer's own CSP.
  • An offline data-wisp-queue form with a password, cc-*, one-time-code or *-password field is not kept in sessionStorage.
  • wisp::test::client posts forms with a browser's Origin and Sec-Fetch-Site: same-origin, so an app's tests run the CSRF check.
  • WebSocket ping, pong and close frames (125 bytes at most) are accepted even under a smaller message limit.
  • A full page cache (CACHE) flooded by unique query strings sweeps expired entries at most once a second.
  • #[derive(Rest)] POST, PUT and PATCH with a value a #[unique] field already holds answer 422, not 500.
  • A streamed answer still hears its client leave after 64 KB were sent, freeing the connection and its WISP_MAX_CONNS slot.
  • If unset, the connection cap stays 1024 descriptors under the open-file limit and within a quarter of the container's memory. A failed accept (EMFILE) backs off 50 ms.
  • WISP_CLIENT_IP_HEADER takes the last address of the last header line, which the trusted proxy added.
  • Error::redirect with CR or LF in the location is a logged 500. A status other than 300 to 303, 307 and 308 is sent as 303.
  • A dev 5xx page never shows in a release build, even with WISP_DEV=on.

Files and uploads

  • Response::file_in sends x-content-type-options: nosniff and content-security-policy: default-src 'none'; style-src 'unsafe-inline'; img-src data:; sandbox on every file, so an uploaded page runs no script on the site, and content-disposition: attachment on all but raster images, audio, video and plain text. A .js, .mjs, .css or .wasm file is sent as application/octet-stream, so an upload cannot act as a script of the site (serve your own assets from static/). Response::file_in_code opts in to the real type of those four (nosniff stays): an uploaded script is then a script of your site, so it is for files you or a trusted user wrote, never for a public upload.
  • Static files and Response::file_in answer 404 for Windows device names (nul, CON.txt, COM1, COM¹-³, LPT¹-³, CONIN$, CONOUT$) and for names Windows trims (a.txt., a.txt ).
  • Wisp does not embed, serve or export a file in static/ whose path has a segment that starts with . (.env, .git/config). wisp dev does not serve it. Wisp hides a symlink to such a path too, and the file for /_img and <img src>. The build prints one warning for each hidden entry. The entry is the first hidden name of a path, such as the folder .git. The warning shows the full path, in the form Wisp does not serve <path>: its path has a dot segment. wisp build --static shows it twice: the build prints it and the copy of static/ prints it. The folder static/.well-known stays public, but a dot segment below it is hidden. wisp build --static writes .nojekyll itself. A dist/.env that an earlier export wrote stays: delete dist/ once.
  • A build and wisp deploy refuse a symlink in static/ or a listed folder that leads outside it (the error names the link: copy the file in or remove the link), so a cloned repository cannot publish a file such as ~/.ssh/id_rsa into the image. wisp runs curl for downloads with -- before the URL. wisp fmt skips a symbolic link, and wisp ui add, wisp add, wisp openapi -o and wisp deploy init refuse to write through one. The CLI shows a control character in a file name or a recipe note as ?.

Browser script and dev mode

  • The template-swap and other dev endpoints answer only a loopback Host (against DNS rebinding). The swap also needs the x-wisp-dev header. A request a proxy or tunnel passed on (forwarded, x-forwarded-for, x-real-ip) is never a dev request (403). The Host must be localhost, a name under .localhost, an address in 127.0.0.0/8 or [::1]. At most : and 1 to 5 digits can follow it, so the server refuses localhost:1@evil. The dev OAuth callback and the plain-http cookie check use the same rule. The dev endpoints take no token: a loopback peer, a loopback Host, no proxy header and x-wisp-dev (which CORS never lets another site send) shut out every page, and any local process could read a token. The wisp dev front names the client in x-wisp-peer with a token of the run, so a client on the network is not a loopback peer to the app. Open-in-editor runs only WISP_EDITOR, EDITOR or VS Code, never the system's opener, so a .bat or .desktop file is never run. The dev events stream answers a Host of localhost, 127.0.0.1 or [::1], or one listed in WISP_DEV_ORIGIN (comma-separated, for a proxy or tunnel), else 403.
  • The wisp dev front (for the app, its WebSockets and event streams, and each proxy target) and wisp preview --static serve only a Host that is an IP address, localhost, a *.localhost name or one in WISP_DEV_ORIGIN, else 403 (Vite's allowedHosts rule), and at most 256 connections at once (503 past that). wisp preview --static refuses a path segment Windows would read as .. (.. , ...), one with :, and device names (nul, con.txt, com¹..com³, lpt¹..lpt³).
  • wisp dev and wisp preview take HOST only as an IP address or localhost. A machine name (some shells set one) is warned about and replaced by loopback.
  • wisp.js leaves cross-origin form posts to the browser. A form field named __wispEnhance cannot replace use:enhance. The javascript: guard on URL attributes is fuzzed, and on a tag that loads its URL as a document (<iframe>, <frame>, <object>, <embed>) an expression-chosen data: or blob: value is blocked too, both at first render and on a live update, since a data:text/html document there runs script; <img src=${u}> keeps data: pictures and <a href=${u} download> keeps a data:/blob: download (a browser blocks top-level data: navigation). A hole after a lone / or \ (href="/${p}") cannot make a protocol-relative URL (//evil, /\evil, \/evil, \\evil are blocked). <base href>, like <script src>, takes no expression. A hole in a style attribute is HTML-escaped only, not CSS-checked: put visitor text in one property's checked value (style="width: ${pct}%"), never a whole declaration or a url(…).

Build and CLI

  • A route file name that is not UTF-8 or has a control character is an error. wisp fmt no longer panics on a tag cut off after an attribute name.
  • wisp service install quotes ExecStart, escapes the plist XML, and refuses an app folder with a quote, % or a control character in its path. wisp mcp caps a message line at 16 MiB.
  • Every variable named PUBLIC_* is public. Browser code gets it at build (env.PUBLIC_X), and with public_env = true each page carries it. A prerendered page (PRERENDER) that the server sends holds the server's values from its start. A static page that the build bakes holds them too. wisp build --static runs the server on the build machine, so the exported pages hold that machine's values. Never give a secret the PUBLIC_ prefix. A PUBLIC_ name with SECRET, PASSWORD, PASSWD, PRIVATE or CREDENTIAL in it stops the build (browser code that reads it, or public_env = true) and stops the server at its start (public_env = true). A name with TOKEN or KEY passes, because many public keys have them. A PUBLIC_ name must use only A-Z, a-z, 0-9 and _: a look-alike letter of another script is an error too.

Edge hosts

  • Raw connections on Node, Bun and Deno have the native head and body deadlines; a trickled request gets 408.
  • A Connection header listing close anywhere (any case, even beside keep-alive) closes the connection after the response (RFC 9112 section 9.6).
  • Bridges that read a body with the host's fetch stop one byte past the route's limit, and the app answers 413.
  • Each reply that sets a cookie carries its own head: an unkept head (u32::MAX, -1 in JS) is never cached and reused for another request. A trap with no task under way fails the requests in flight instead of hanging them.
  • wisp::edge::fetch follows no redirect (redirect: 'manual'), as native wisp::fetch; wisp::fetch_follow follows them and drops credentials across origins. Its error text names the host only: URLs the host quotes are cut to their host, and a query is cut off.
  • wisp::edge::fetch and wisp::fetch_stream on the edge take http:// and https:// URLs only, as native wisp::fetch. Any other URL fails with 500 fetch needs an http:// or https:// URL, so a URL from a client never reaches the stores or bindings of the host.
  • cx.cf comes from the host only (Cloudflare's request.cf). No request header sets it, on any host or path.
  • wisp::sleep past 24.8 days waits its whole length. wisp::platform::call refuses constructor, Object.prototype names and _ names; an unknown wisp:<kind> is a 500.
  • A WebSocket message past the limit closes with 1009, or 4009 on Deno, whose close accepts no 1009.
  • Windows hosts pass environment names in upper case, so reading PATH works.
  • Per-request random values (nonces, ids, tokens, salts) come from a ChaCha20 stream (RFC 8439) keyed per thread from OS randomness (/dev/urandom plus the standard library's getrandom keys on Linux; 256 bits via the hasher keys the standard library draws from the OS on Windows), rekeyed after every batch and reseeded every 1 MiB. Lasting secrets (the signing key, TOTP secrets) are read straight from the OS on every call. Wisp refuses to start if the OS gives no randomness (no OS randomness: /dev/urandom unreadable). If the seed read fails later, values fall back to the standard library's OS-seeded hasher keys and one line is logged.

Content-Security-Policy

  • Other sites need no call. The build reads the https:// origins that your templates, src/app.html, CSS and src/fonts.txt name, and adds each to the matching directive: script-src (<script src>, <link rel=modulepreload>, rel=preload as=script), style-src (<link rel=stylesheet>, @import), font-src (rel=preload as=font, url() in an @font-face), media-src (<video>, <audio>, <source>), frame-src (<iframe>), object-src (<embed>, <object>) and form-action (<form action>, formaction). The import of a module (import x from "https://esm.sh/x" in a <script> block, a src/lib file or an inline module script) counts as a script. So do the https URLs in the values of a <script type="importmap">. A stylesheet's origin also gets font-src, as CDN stylesheets such as Font Awesome load their fonts from it, and fonts.googleapis.com brings fonts.gstatic.com. Images need nothing, img-src allows https:.
  • A script is allowed by its exact URL, not its origin: <script src="https://cdn.jsdelivr.net/npm/a@1/a.js"> allows that file (query and fragment dropped), so an injected tag cannot load another package from the same shared CDN (jsdelivr, unpkg, cdnjs, esm.sh). The same holds for modulepreload, preload as=script, <embed> and <object>. A URL with a character like ;, , or a space is skipped, and so is one whose path is empty or ends in / (in CSP that would allow everything under it). A module's import is the exception: the files it pulls in next are unknown, so the whole origin is allowed and the build prints script-src allows all of https://esm.sh; pin it with wisp::csp if you need to. Other directives take the origin.
  • NPM packages (wisp npm add) ship from .wisp/npm, not from esm.sh. wisp build checks each downloaded file against its SHA-256 in npm.lock and fails on a mismatch. Commit npm.lock.
  • Only https://. A value with a hole (src=${url}), http:// and //host are not guessed: add them by hand with wisp::csp. So is a fetch, WebSocket or EventSource URL in browser code: it needs wisp::csp("connect-src 'self' https://api.example.com"). A directive you name in wisp::csp(..) is yours alone, the build adds nothing to it. An onion site gets none (it asks no other site for anything).
  • A directive that is 'none' (such as wisp::csp("style-src 'none'")) stays 'none'. Wisp adds no hash, nonce, asset host or wisp dev source to it, because a browser ignores 'none' next to another source.
  • integrity and crossorigin pass through untouched, so Subresource Integrity works: <script src="https://cdn.example.com/x.js" integrity="sha384-…" crossorigin="anonymous"></script>.
  • The service worker never keeps or answers another site's files, and wisp build --static leaves their URLs as written. The policy is made once at start: a request pays nothing for any of this.
  • wisp::csp_nonce() (in init) turns on nonce mode. cx.nonce() returns a random 22-character nonce for the request (made on first ask, empty without that call), named in the policy's script-src (and style-src when it has no 'unsafe-inline'). Write <script nonce=${cx.nonce()}>...</script>. An app whose src/ never says csp_nonce( pays nothing. wisp build for the edge wasm leaves the code out (WISP_NONCE=0, size in Environment variables).
  • Scripts the build writes keep their hashes, so baked pages work. A page that asks for a nonce is never kept or baked, and gets cache-control: private, no-store. Give cached or prerendered pages hashed (hole-free) inline scripts.
  • After a client navigation the first page's policy still applies, so wisp.js gives each script it copies in (and each wisp/idle script) the first page's nonce. A script with no nonce ({@html} text) stays blocked.
  • wisp::csp_report_only() (in init) sends the policy as content-security-policy-report-only: it reports and blocks nothing.
  • wisp::csp_report("/csp") (in init) adds report-uri /csp. Add a POST /csp endpoint to read the reports.
// src/hooks.rs
fn init() -> Result {
    wisp::csp_nonce();
    wisp::csp_report("/csp");
    wisp::csp_report_only();
    Ok(())
}

Not Claimed

  • No third-party audit, bug bounty or certification. TLS is not built in: put a proxy in front for browsers, as Deploying says.
  • Fuzzing and tests find only what they are written to find. The fuzz targets are in the repository.
  • A debug build is for your machine. Behind a proxy on the same machine every peer is loopback. Never serve a debug build.

Found something? Tell us in the Discord (message a maintainer privately). A failing request or file is the best report.

Is This Page Useful?

View This Page's Source

Type to search every docs page and heading.