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 fmtgets 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 notname: value, are a 400. A connection overWISP_MAX_CONNSgets 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 devcompanions. - 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-suppliednextonly 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,/\eviland\x01//evilgo out as/evil.redirectalone letshttps://…through on purpose, so pass a?next=throughwisp::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_headerandResponse::with_headerdrop 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_headerbecomes a logged 500. No header or cookie injection.Origin: nullon a form post (a page withReferrer-Policy: no-referrer, as on Tor onion sites) passes withSec-Fetch-Site: same-origin. It also passes with noSec-Fetch-Siteand the valid token of a<form guard>. The token case works on native only. Withcross-site,same-siteornone, or with none and no valid token, it is a 403.WISP_REFERRER=same-originkeeps the realOriginon 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_LIMITorCORSgates every method of the endpoints of its route (+server.rsormod server), also aput,patchordelete, apostof a page with no action, and the member route/[id]. An endpoint that must stay public goes to another route.CORSruns once and before every guard: the endpoint'sCORSif 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: anhttp://page cannot post to a site whose proxy sendsX-Forwarded-Proto: https, withWISP_CLIENT_IP_HEADERset or not. AnOriginthat is nothttp(s)://is refused. SetORIGINfor an exact match. WithORIGINset to the clearnet site, a form post from the onion twin of the app also passes, when itsOriginis a.onionaddress that equals itsHost. A post from another onion is a 403. - On a native build, a form post or WebSocket upgrade with an
Originthat is not UTF-8 is a 403, withORIGINset or not.
Abuse and JavaScript-off sites (Tor)
RATE_LIMITandcx.limitcount bycx.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.onionHostfrom a local peer. An export does not count.- Cookies are
Secure, and the session, flash, OAuth and signed ones__Host-(underWISP_BASE, they are__Secure-withPath=<base>. A signed cookie with adomain, or apathother than/, is__Secure-name. A sibling subdomain can set a__Secure-cookie, which it cannot do for a__Host-one. Under nested bases/aand/a/b, both apps send__Secure-sessionto/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 tolocalhost,*.localhostor a loopback address, an onion, or a named proxy (WISP_CLIENT_IP_HEADER) that saysx-forwarded-proto: http. A plain-http deploy with no proxy (an intranet box) must have its proxy sendx-forwarded-proto: httpwithWISP_CLIENT_IP_HEADERset, or run in dev; else the browser drops the cookies and sign-in fails. Wisp logs this once, the first time aSecurecookie 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). Socx.param("slug")cannot hold../xfrom an escape. x-forwarded-protoandx-forwarded-hostare read like the client address: the entryWISP_CLIENT_IP_DEPTHnames from the right, the one your proxy added.- DNS rebinding: with
ORIGINset, the app refuses a form post from any other origin. Without it, a release build accepts anyHost, because the proxy routes by it. SetORIGINfor apps on a trusted network.WISP_ALLOWED_HOSTS(orwisp::allow_hosts) answers a request with any otherHostwith a 421. It holds on the native server and on thenode,deno,bunandcloudflaretargets. Oncloudflare, the files ofstatic/come from Cloudflare and skip the check. Thepages,vercel,netlifyandazurehosts also serve those files before the app. Not tested on those hosts. - HTTP/2: a
hostbeside:authoritymust name the same host (RFC 9113 8.3.1), else the stream is refused. WISP_MAX_CONNSis 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.Backofflocks a key out for longer each time, before any password hashing, with the same answer for a name that does not exist. The request afterfreefailures 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 andretry-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_oncemakes a reset or magic-link token work once.- A refused form lists its problems at the top with
role="alert"andautofocus, linked to the fields, with no script.
Servers
- Tor onion services:
WISP_ONIONsendsno-referrer, never HSTS, noSecurecookie, adateto the minute and a CSP with no external images.x-forwarded-*andWISP_CLIENT_IP_HEADERare ignored. AHostthat only ends like.onion(evil.onion.example.com,a.onion/x) is not one. An attacker's.onionHostnever replacesSITE_URLin 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-lengthis digits only, and repeats must agree. A:paththat 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
CACHEanswer that carries its owncontent-encodingsaysvary: accept-encoding. - OAuth: a
.redirect(url)must behttps://(loopbackhttp://for tests) with no#; in dev the callback takes theHostonly when it is loopback; anhttpsOIDC issuer's endpoints must all behttps. - Dev mode on an address other than loopback signs with a key of its own process, never
.wisp/secret. Underwisp dev, aHOSTother 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
Valueor straight into a type ("too many values", a 400), and aValueis 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.\u0000is JSON, so it stays in aString;Emailand theemail,urlandslugrules refuse it. wisp::fetchandfetch_followread 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_follownever sends a body (307/308) or a header the app set to another origin; theon_fetchhook getshop.moved, so a key it adds stays on the first origin. A URL a visitor names goes throughwisp::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/_imgremote pictures.wisp::fetch_streamis for the app's own URLs and checks no address;wisp::fetch_stream_publicstreams 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 starvefetch_public. At most 256 fetch streams are open at once; one more is a 503. A stream asks foraccept-encoding: identity; a coding the upstream sends anyway is passed withvary: accept-encoding.- The
upstash,vercel-blob, libSQL (with a token) ands3:(with a session token) stores send their token over https only. Plain http is forlocalhost,127.0.0.1and[::1], else the first call answers a 500:a token goes over https only (plain http is for localhost). Upstream::respond()sendsx-content-type-options: nosniff, andcontent-security-policy: sandboxfor 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.Svgparses 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,styleelement, animation,on*attribute, external link orurl(). It is served with a sandboxing CSP; show it only through<img>(data_url()or a route), never inlined.Imagerefuses a header over 8192 by 8192 pixels, or one whose size cannot be read. A zip is labelled by its central directory: an OpenDocumentmimetypefirst 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 withnosniff, a sandboxing CSP andattachment), ideally from another origin; never serve one with a type the visitor chose; never serve anUploadtaken withtypes = "image/svg+xml"inline (take anSvg); scan files with an antivirus if users share them. - Without
SITE_URL, a release build takes no address from theHostheader. It serves no made/sitemap.xml,/robots.txtor/feed.xml, so a client'sHostnever names the links in them. Dev mode still uses theHost. - A string
style={:s}keeps only the declarations thatstyle=${s}keeps on the server's first paint. A declaration stays when it isname:valuewith no\, comment,expression(,javascript:,-moz-bindingorbehaviorin the value.scroll-behaviorstays in a value. Wisp also refuses a declaration whose name isbehavior,-moz-bindingor-ms-behavior, in any case. This is a precaution: they are old engine features that load code from a URL.live.jsfilters thestyleattribute that the page sets: a string, an object, a quoted value with{:…}and a spread. It refuses each declaration whose name isbehavior,-moz-bindingor-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 inurl(). 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. Aurl()stays on both. - The build fails for a hole in the name of a declaration in a quoted
styleattribute (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 aftername: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.jssends 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-queueform with a password,cc-*,one-time-codeor*-passwordfield is not kept insessionStorage. wisp::test::clientposts forms with a browser'sOriginandSec-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_CONNSslot. - 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_HEADERtakes the last address of the last header line, which the trusted proxy added.Error::redirectwith 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_insendsx-content-type-options: nosniffandcontent-security-policy: default-src 'none'; style-src 'unsafe-inline'; img-src data:; sandboxon every file, so an uploaded page runs no script on the site, andcontent-disposition: attachmenton all but raster images, audio, video and plain text. A.js,.mjs,.cssor.wasmfile is sent asapplication/octet-stream, so an upload cannot act as a script of the site (serve your own assets fromstatic/).Response::file_in_codeopts in to the real type of those four (nosniffstays): 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_inanswer 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 devdoes not serve it. Wisp hides a symlink to such a path too, and the file for/_imgand<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 formWisp does not serve <path>: its path has a dot segment.wisp build --staticshows it twice: the build prints it and the copy ofstatic/prints it. The folderstatic/.well-knownstays public, but a dot segment below it is hidden.wisp build --staticwrites.nojekyllitself. Adist/.envthat an earlier export wrote stays: deletedist/once. - A build and
wisp deployrefuse a symlink instatic/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_rsainto the image.wispruns curl for downloads with--before the URL.wisp fmtskips a symbolic link, andwisp ui add,wisp add,wisp openapi -oandwisp deploy initrefuse 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 thex-wisp-devheader. A request a proxy or tunnel passed on (forwarded,x-forwarded-for,x-real-ip) is never a dev request (403). TheHostmust belocalhost, a name under.localhost, an address in127.0.0.0/8or[::1]. At most:and 1 to 5 digits can follow it, so the server refuseslocalhost: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 loopbackHost, no proxy header andx-wisp-dev(which CORS never lets another site send) shut out every page, and any local process could read a token. Thewisp devfront names the client inx-wisp-peerwith a token of the run, so a client on the network is not a loopback peer to the app. Open-in-editor runs onlyWISP_EDITOR,EDITORor VS Code, never the system's opener, so a.bator.desktopfile is never run. The dev events stream answers aHostoflocalhost,127.0.0.1or[::1], or one listed inWISP_DEV_ORIGIN(comma-separated, for a proxy or tunnel), else 403. - The
wisp devfront (for the app, its WebSockets and event streams, and each proxy target) andwisp preview --staticserve only aHostthat is an IP address,localhost, a*.localhostname or one inWISP_DEV_ORIGIN, else 403 (Vite'sallowedHostsrule), and at most 256 connections at once (503 past that).wisp preview --staticrefuses a path segment Windows would read as..(..,...), one with:, and device names (nul,con.txt,com¹..com³,lpt¹..lpt³). wisp devandwisp previewtakeHOSTonly as an IP address orlocalhost. A machine name (some shells set one) is warned about and replaced by loopback.wisp.jsleaves cross-origin form posts to the browser. A form field named__wispEnhancecannot replaceuse:enhance. Thejavascript:guard on URL attributes is fuzzed, and on a tag that loads its URL as a document (<iframe>,<frame>,<object>,<embed>) an expression-chosendata:orblob:value is blocked too, both at first render and on a live update, since adata:text/htmldocument there runs script;<img src=${u}>keepsdata:pictures and<a href=${u} download>keeps adata:/blob:download (a browser blocks top-leveldata:navigation). A hole after a lone/or\(href="/${p}") cannot make a protocol-relative URL (//evil,/\evil,\/evil,\\evilare blocked).<base href>, like<script src>, takes no expression. A hole in astyleattribute is HTML-escaped only, not CSS-checked: put visitor text in one property's checked value (style="width: ${pct}%"), never a whole declaration or aurl(…).
Build and CLI
- A route file name that is not UTF-8 or has a control character is an error.
wisp fmtno longer panics on a tag cut off after an attribute name. wisp service installquotesExecStart, escapes the plist XML, and refuses an app folder with a quote,%or a control character in its path.wisp mcpcaps a message line at 16 MiB.- Every variable named
PUBLIC_*is public. Browser code gets it at build (env.PUBLIC_X), and withpublic_env = trueeach 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 --staticruns the server on the build machine, so the exported pages hold that machine's values. Never give a secret thePUBLIC_prefix. APUBLIC_name with SECRET, PASSWORD, PASSWD, PRIVATE or CREDENTIAL in it stops the build (browser code that reads it, orpublic_env = true) and stops the server at its start (public_env = true). A name withTOKENorKEYpasses, because many public keys have them. APUBLIC_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
Connectionheader listingcloseanywhere (any case, even besidekeep-alive) closes the connection after the response (RFC 9112 section 9.6). - Bridges that read a body with the host's
fetchstop 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::fetchfollows no redirect (redirect: 'manual'), as nativewisp::fetch;wisp::fetch_followfollows 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::fetchandwisp::fetch_streamon the edge takehttp://andhttps://URLs only, as nativewisp::fetch. Any other URL fails with 500fetch needs an http:// or https:// URL, so a URL from a client never reaches the stores or bindings of the host.cx.cfcomes from the host only (Cloudflare'srequest.cf). No request header sets it, on any host or path.wisp::sleeppast 24.8 days waits its whole length.wisp::platform::callrefusesconstructor,Object.prototypenames and_names; an unknownwisp:<kind>is a 500.- A WebSocket message past the limit closes with 1009, or 4009 on Deno, whose
closeaccepts no 1009. - Windows hosts pass environment names in upper case, so reading
PATHworks. - 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 andsrc/fonts.txtname, 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>) andform-action(<form action>,formaction). Theimportof a module (import x from "https://esm.sh/x"in a<script>block, asrc/libfile 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 getsfont-src, as CDN stylesheets such as Font Awesome load their fonts from it, andfonts.googleapis.combringsfonts.gstatic.com. Images need nothing,img-srcallowshttps:. - 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 formodulepreload,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'simportis the exception: the files it pulls in next are unknown, so the whole origin is allowed and the build printsscript-src allows all of https://esm.sh; pin it withwisp::cspif you need to. Other directives take the origin. - NPM packages (
wisp npm add) ship from.wisp/npm, not from esm.sh.wisp buildchecks each downloaded file against its SHA-256 innpm.lockand fails on a mismatch. Commitnpm.lock. - Only
https://. A value with a hole (src=${url}),http://and//hostare not guessed: add them by hand withwisp::csp. So is afetch,WebSocketorEventSourceURL in browser code: it needswisp::csp("connect-src 'self' https://api.example.com"). A directive you name inwisp::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 aswisp::csp("style-src 'none'")) stays'none'. Wisp adds no hash, nonce, asset host orwisp devsource to it, because a browser ignores'none'next to another source. integrityandcrossoriginpass 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 --staticleaves their URLs as written. The policy is made once at start: a request pays nothing for any of this. wisp::csp_nonce()(ininit) 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'sscript-src(andstyle-srcwhen it has no'unsafe-inline'). Write<script nonce=${cx.nonce()}>...</script>. An app whosesrc/never sayscsp_nonce(pays nothing.wisp buildfor 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/idlescript) the first page's nonce. A script with no nonce ({@html}text) stays blocked. wisp::csp_report_only()(ininit) sends the policy ascontent-security-policy-report-only: it reports and blocks nothing.wisp::csp_report("/csp")(ininit) addsreport-uri /csp. Add aPOST /cspendpoint 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?