Unreleased [Not released yet]
Part 14 of 15. Previous part
Security (152)
wisp clean --cachedeletes a folder only when it is a build cache. Before, a mistypedWISP_BUILD_CACHEcould pass the checks and make the command delete files of the user. Now a build writes the marker only in a new or empty folder. The command resolves.., links and the case of a Windows path before it compares the folder with home and the current folder. It also refuses a folder that holds anything but the entries that cargo makes, and the error names the reason. A folder that does not exist gives "already empty".- The edge build with raw connections (Node, Bun, Deno) stops the output of a connection when the host says the client is behind, until the host pulls. Before, a client that sent many requests for large pages and read nothing made the host buffer grow without limit.
- AWS Lambda WebSocket: a handler that sends before the code answers
$connectcan hold 1 MiB at most. Past it,sendfails withGone. Each send also gives the deadline timer a turn. Before, a loop of sends grew memory until Lambda stopped the invocation. WISP_USER: the check for root reads the user id in/proc/self/status. Before, it used the owner of/proc/self, which is root for a process that cannot be dumped (a binary that the user cannot read). The server then started itself again without end. When Wisp cannot read the file or itsUid:line, the server stops. Before, it logged a line and went on as root. On a system that is not Linux, a server withWISP_USERset stops too.src/hooks.rsrefuses a knob of a page or a layout:SIGNED_IN,TIMEOUT,BODY_LIMIT,CACHE,CACHE_PUBLIC,CACHE_STALE,CACHE_TAGS,PRERENDER,COMPRESS,SSR,CSR,RUNTIME,CSRF,EARLY_HINTS,PRECACHEandTRAILING_SLASH. Before,const SIGNED_IN: bool = true;there built without an error and did nothing, so every page stayed open. Check inbeforewithcx.signed_in()?. TheCSRFmessage says to set it in the+server.rswhose requests it lets through.- Build plugins refuse an input file name with a backslash or a control character (a newline). Before, such a name could make the build delete a file of the app (
Cargo.toml) in a later build. Withext, a name with backslashes could also write a file outsideout. - A PUT or PATCH of a
#[derive(Rest)]row gives the#[json(skip)]fields of a list item only to the old item that equals it in all shown members. Before, it gave them by position, so a delete or a reorder of list items moved a secret to another item. The match uses the typed value (1.0equals1, a member left out equals its default). An item that changed or is new gets the default. A PUT or PATCH of a list with too many changed items to match is a 413 (codetoo_many), not a reset. - An image resize that needs more than 320 MB of scratch memory is now a 400 with
not an image Wisp can resize, before Wisp decodes the picture. The scratch is 16 bytes for each pixel of the source width by the new height. Before, a PNG of 3841 by 10413 pixels (a few KB) atw=3840needed 640 MB of scratch. Many such requests at once could stop the server for lack of memory. - One rule decides whether a host names this machine.
localhost, a name under.localhost,127.0.0.0/8and[::1]count, with at most:and 1 to 5 digits after them. The dev endpoints, the dev OAuth callback, the plain-http cookie check and the dev base of/sitemap.xml,/robots.txt,/feed.xmlandwisp::alternatesuse it. The OAuth endpoint check and the libSQL token check take onlylocalhost,127.0.0.1and[::1]. Before, each place had its own rule. The libSQL driver tookhttp://localhost:1@db.example/with a token, and the host of that URL isdb.example. The cookie check tooklocalhost:1@evil.example,.localhost,[0:0:0:0:0:0:0:1],[::1]eviland127.0.0.1:80:81as this machine. Now these hosts are not local, so their cookies getSecure. The dev endpoints tooklocalhost.,.localhost,[127.0.0.1]and[0:0:0:0:0:0:0:1]. The dev OAuth callback tooka@b.localhost, and the OAuth endpoint check tookhttp://127.0.0.1234/. A name under.localhosthas only labels of letters, digits and-. A label is not empty and has no-at its start or end. Thewisp devevents stream takes onlylocalhost,127.0.0.1and[::1]with this port rule. Before, it tooklocalhost:123456. Thewisp devfront andwisp preview --staticuse the rule for a name, and also take any IP address. In dev, the base of a host under.localhostor in127.0.0.0/8now useshttp, nothttps.LOCALHOST:3000now useshttp, andlocalhost:abcnow useshttps. WISP_ALLOWED_HOSTSnow holds on the edge targets (node,deno,bun,cloudflare). Before, only the native server checked theHostof a request, and an edge build answered everyHost. 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.- On the edge, a page or a trailing-slash redirect with a
corsrule is notconst: each request enters the wasm. Before, the bridge kept the first answer for the path and gave it to each later request. So theaccess-control-allow-originof one site went to requests from other sites, and to requests with noorigin. A first request with nooriginalso made the path answer allowed sites with noaccess-control-allow-origin. This applied to Workers, Pages,Deno.serve,Bun.serve, Netlify Functions, Netlify Edge and Vercel Edge. - On the edge, a page or a trailing-slash redirect with a
headersrule that has a cookie or header condition is notconst: each request enters the wasm. Before, the bridge kept the first answer for the path. So the header for one visitor's cookie went to each later request, or a later request with the cookie did not get it. This applied to the same hosts. - A CSP directive that is
'none'stays'none'. Wisp adds no nonce, asset host (WISP_ASSET_BASE) orwisp devsource (https://esm.sh, the reload events) to it. Before,wisp::csp("style-src 'none'")becamestyle-src 'none' 'nonce-...'. A browser ignores'none'next to another source, so the directive allowed that source. WISP_ASSET_BASE(assets) with a;or a,is a build error. Before,https://a.example;sandboxadded a directive to the CSP header. The error now lists;and,with the other characters that it refuses.- The
upstash,vercel-blobands3:stores send their token over https only, as libSQL does. 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).s3:checks it only with a session token. Before, these stores sent the token in clear text to anyhttp://host. - Plain http to an
s3:host that is not this machine sends the request bodies and the signatures in clear text. Use https. WISP_LISTEN=unix:<path>in.envworks like the same variable in the process. Before, Wisp read only the process, ignored a value in.envand listened on TCP atHOSTandPORT, so an app that expected a proxy on a socket could listen on a public port.- The export refuses to write a file through a symlink or junction in the output folder, as the sweep already refused to delete through one. Before, the write followed the link and wrote the file outside the folder.
- The export refuses to write a path with a control character (a line break, for example) and fails with
the export refuses to write "<path>": the path has a control character. The sweep ignores a line of the export list that has one. Before, a page that named an asset such as/_app/c/x%0Ay.jsput two lines in the list, and the next export deleted a file of yours namedy.js. A list that an older export wrote with such a path holds two ordinary lines. The sweep cannot tell them apart from other lines. style=${s}, astylepair of a spread and the first paint ofstyle={:s}refuse 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. A dev build logswisp: style:NAME=VALUE is not a plain CSS declaration. Wisp skipped it. Before, such a declaration stayed when its value was plain.- A quoted
styleattribute fails the build for a${}in the name of a declaration:style="-moz-${x}:v",style="${a}${b}:v"andstyle="a:b;${c}". The error isa${}in astyleattribute must come aftername:. A property name must be text in the file. Write style="color:${value}" or style=${declarations}. Before, each hole had its own check, and two values that each passed it could write the name-moz-bindingtogether. A hole aftername:is as before. The build also refuses a hole after a comment with no end in the same value, and after an entity other than&,<and>, because it cannot tell where the name starts. live.jsrefuses, in astyleattribute that the page sets (style={:s}as a string or an object, a quoted value with{:…}, and a spread), each declaration whose name isbehavior,-moz-bindingor-ms-behaviorin any case, or has a\or a/*in its name (a CSS escape or a comment). This is a precaution. It reads each;as the end of a declaration, 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.live.jsis 107 bytes larger when minified and gzipped (12_381 to 12_488). Before, only the first paint of the server refused these names.wisp deploy init docker,init torand the host configs do not write through a symbolic link. A link namedDockerfile,.dockerignore,docker-compose.yml,tor.Dockerfile,torrcor a file ofdeploy/tor/is an error. Before, a link to a missing file passed the check for an existing file, and the write created the target.wisp deploy init torcreates the.envfile with mode 0600 on Unix.--forcesets the mode 0600 on an old file before the write. Before, the command set the mode after the write. The file holds no secret at that time.- An HTTP/2 request with
:method,:pathor:authoritytwice is malformed (RFC 9113 8.3), also when the first value is empty. Before, an empty first value let a second one pass. - On an edge build, the WebSocket of a host that gives whole messages (Workers,
Deno.serve,Bun.serve) counts each queued message toward its flood bound. An empty message counts too. Past the bound, Wisp closes the socket. Before, a client that sent only empty messages grew the queue with no bound while the handler did not read. - On AWS Lambda, a WebSocket counts each unread message toward its 1 MiB bound (
AHEAD), also an empty one. Past the bound,recvends. Before, a client that sent only empty messages grew the queue with no bound while the handler did not read. The messages that a handler sends before$connectis answered count the same way. Past the bound,sendfails. Password::checkandlogintreat aPlainpassword (the text typed, not hashed yet) as no hash. The result isfalse, and the check takes as long as for no member. Before, aPlainvalue whose text was a hash of the password typed checked astrue. ATable::newtable (in memory) keeps aPlainrow, and that row never signs in.- A
Passwordin aBTreeMap<String, Password>orHashMap<String, Password>field now seals as one in aVecdoes. The same holds for aPasswordin aRow<T>field. A saved table (Table) refuses a typed one (a 500) and reads a stored one as the hash it is. A REST write (#[derive(Rest)]) counts a typed one in its limit of 16 passwords and hashes it. Before, none of this held. The table hashed the typed text inside the write, on the worker. A row read back kept its hash as text typed, soPassword::checkandloginnever matched it. A REST write hashed any number of them, past the limit. Upstream::respondsends acontent-typewith an empty media type (; charset=utf-8or;text/html, for example) asapplication/octet-stream, like an empty value. Before, it sent such a value as it came, with nocontent-security-policy: sandbox. The check read the media type as empty and counted it as data.- The Markdown parser
pulldown-cmarkis now 0.13.6. Version 0.13.5 has RUSTSEC-2026-0433: quadratic parsing of nested image wikilinks withENABLE_WIKILINKS. Wisp does not set that option (crates/wisp-build/src/markdown.rs,crates/wisp-build/src/seo.rs), but the weeklyadvisoriescheck reports the old version. - A request body with
Content-Encoding: gzipcan hold one dynamic Huffman block for each 24 bytes of its deflate data (not the gzip header and trailer), and 64 more. A body with more answers 400. A dynamic block builds its codes and can make no output, so a body of many such blocks used time thatWISP_BODY_LIMITdid not limit. - On a server with TLS (the
tlsfeature andWISP_TLS_CERT) and noORIGIN, the origin check rejects anhttp://origin with 403. A request with nox-forwarded-protoheader now gets the 403 too. The rule holds for form posts and WebSocket upgrades. Before, the fast path of the check passed anhttp://origin that named theHost, and the post got its normal answer. So with the old code, a plain-HTTP page on the name of the site may post to the HTTPS site. Anyone on the network can write such a page. A request with anx-forwarded-protoheader was not affected. - An error about a store setting (
WISP_KV_<NAME>,WISP_BLOB_<NAME>,WISP_SQL_<NAME>,WISP_STORE) or an OTLP endpoint (OTEL_EXPORTER_OTLP_ENDPOINT,OTEL_EXPORTER_OTLP_TRACES_ENDPOINT) shows only the scheme and the host of the value. Before, it showed the whole value, with a user, a password or a query such as?authToken=, and the logs got it. When a/,?or#in a password hides where the host starts, the error shows(hidden)for the host. A value with no://shows only its driver word, such asfsorcf, else(hidden). The edge bridge (bridge.js) uses the same rules. On an edge build, a fetch error shows(hidden)for the host in the same case. AnOTEL_EXPORTER_OTLP_HEADERSentry with no=does not show. An OTLP endpoint host with a?or#stops the server at start. The start error names the reason, such asit has a user (@), but not the value. An@after a raw/in an OTLP endpoint also counts as a user. The log line of a failed trace POST shows the endpoint path with no query. On an edge build, aWISP_STOREread or write that fails shows each URL in its reason as the host only. - Without
ORIGIN, a form post or WebSocket upgrade with anOriginthat has no host (https://) and an emptyHostis a 403. Before, the empty host matched the emptyHost, so the request passed. - On a native build, the origin check of a form post or WebSocket upgrade counts a
Sec-Fetch-Sitethat is not UTF-8 ascross-site. Before, Wisp read it as no header, so a request with noOriginpassed. WithOrigin: nulland such a header, the valid token of a<form guard>does not let the post in. - A REST write with an
if-matchorif-none-matchheader that is not UTF-8 is a 412:changedforif-match,matchedforif-none-match. A POST with anif-none-matchthat is not UTF-8 is a 412 too. Before, Wisp read such a header as absent, skipped the precondition and made the change. On the lazy path of a wasm edge build, the host gives each header as text (Headers.get), so Wisp reads that text. - The start errors of
ORIGINandWISP_ONION_LOCATIONshow***in place of user info (user:pass@), a query and a fragment. The scheme, the host and the path stay. When a?or#comes before the last@, the error shows only the scheme and***. Before, the error showed the whole value, so the log got any password or token in it. body: Tanswers 415 to a body whosecontent-typeis not UTF-8. A file request with anif-rangethat is not UTF-8 gets the whole file (200), not the range. Arangethat is not UTF-8 keeps aCOMPRESSanswer as it is, as arangein text does. Before, Wisp read each such header as absent. So it read the body as JSON, sent the range with no check of the tag, and compressed the answer. On the lazy path of a wasm edge build, the host gives each header as text (Headers.get), so Wisp reads that text.- On the raw sockets of the
node,bunanddenotargets, the origin check counts aSec-Fetch-Sitethat is not UTF-8 ascross-site. Before, it read such a header as absent, so a form post with noOriginpassed. - Without
ORIGIN, the origin check of a native build counts anX-Forwarded-Protoentry that is not UTF-8 ashttps. So a post from anhttp://origin gets a 403. Before, Wisp read the entry as absent, and the post passed. - On a native build, a line of the
WISP_CLIENT_IP_HEADERheader that is not UTF-8 counts inWISP_CLIENT_IP_DEPTH. When the picked entry is not UTF-8,cx.client_ip()is the peer. Before, Wisp skipped such a line, so the depth could pick an address that the client sent. - The dev endpoints count a proxy header (
forwarded,x-forwarded-forand the others of their list) by its name, also when its value is not UTF-8. Before, such a value in the first line of the header read as no header. So a request that a tunnel passed on may reach the dev endpoints. - A
d1-http:<account>/<database>store refuses an id with a character other than a letter, a digit,-or_. Each call is a 500 that names which id (account or database) and its first refused character, never the rest of the id or the token:WISP_SQL_DB is d1-http: it is d1-http:<account id>/<database id>, and each id holds only letters, digits, - and _ (the account id has "?" at byte 1). An empty id gets(the database id is empty)or(the account id is empty). Before, Wisp checked only that each id was not empty. It put the ids in the URL of the D1 API. So a/,?or#in an id could change that URL, and the token went with the request. cx.sign_in(0)starts no session. It signs the visitor out and writes a log line.cx.signed_in()refuses a signed cookie with id 0. Before,sign_in(0)made a session of id 0 thatwisp::sign_out_everywherecould not end, because 0 is no row id.- A REST route scope on a number field (
users/[user=int]/noteswithuser: u64) matches only the same text as the stored number. Another owner gets a 404 for a GET, PUT, PATCH and DELETE of the row. Before, the scope compared as anf64. Past 2^53, a request could pass for a neighbour owner, and a PUT or PATCH then wrote the caller's number into the row. - The docs of
const COMPRESSsay: An answer can hold a secret and also text from the request. When Wisp compresses such an answer, its size can show the secret to an attacker (BREACH). Wisp does not pad or mask the answer. SetCOMPRESSonly on routes whose answers never hold both. Wisp does not compress aCOMPRESSanswer withcache-control: no-transform. A streamed page ({#await}) follows the same rule: gzip only withCOMPRESS, and never withcache-control: no-transform. A PPR page is never gzip. Wisp does not prevent BREACH: keep a secret and text from the request out of one compressed answer, or leaveCOMPRESSoff for that route. The docs ofwisp::cachesay: The key is the text the app gives, with no host and no user in it. All requests of a process share each key. For data of one user, put the user's id in the key.