If you are not sure if the website you would like to visit is secure, you can verify it here. Enter the website address of the page and see parts of its content and the thumbnail images on this site. None (if any) dangerous scripts on the referenced page will be executed. Additionally, if the selected site contains subpages, you can verify it (review) in batches containing 5 pages.
favicon.ico: bun.sh/docs/runtime/csrf - CSRF Protection - Bun.

site address: bun.sh/docs/runtime/csrf redirected to: bun.sh/docs/runtime/csrf

site title: CSRF Protection - Bun

Our opinion (on Wednesday 22 July 2026 22:46:23 UTC):

GREEN status (no comments) - no comments
After content analysis of this website we propose the following hashtags:



Meta tags:
description=Generate and verify CSRF tokens with Bun s built-in API;

Headings (most frequently used words):

csrf, bun, system, protection, documentation, index, on, this, page, generate, verify, using, with, serve, default, secret, typescript, get, started, core, runtime, file, module, http, server, networking, data, storage, concurrency, process, interop, tooling, utilities, standards, compatibility, contributing,

Text of the page (most frequently used words):
token (41), the (36), secret (32), bun (32), csrf (28), sessionid (23), #verify (21), generate (21), session (20), string (19), const (17), and (13), user (10), algorithm (8), default (8), this (7), page (7), encoding (7), type (7), req (7), options (6), server (6), form (6), bound (6), requester (6), hex (5), base64url (5), sha512 (5), for (5), isvalid (5), tokens (5), headers (5), when (5), with (5), used (5), file (5), documentation (4), number (4), expiresin (4), sha256 (4), typescript (4), both (4), per (4), runtime (4), new (4), return (4), visitor (4), one (4), match (4), returns (4), copy (4), protection (4), was (3), function (3), maxage (3), csrfalgorithm (3), base64 (3), use (3), true (3), same (3), thread (3), generated (3), console (3), response (3), csrftoken (3), get (3), formdata (3), getsessionid (3), submit (3), cookie (3), serve (3), null (3), request (3), has (3), identifier (3), only (3), using (3), must (3), during (3), principal (3), not (3), optional (3), key (3), encoded (3), hmac (3), utilities (3), system (3), built (2), secrets (2), transpiler (2), boolean (2), csrfverifyoptions (2), csrfgenerateoptions (2), interface (2), 256 (2), sha384 (2), blake2b512 (2), blake2b256 (2), types (2), always (2), shared (2), across (2), calls (2), uses (2), random (2), workers (2), log (2), _csrf (2), post (2), button (2), input (2), text (2), name (2), hidden (2), content (2), create (2), before (2), every (2), from (2), process (2), pass (2), issued (2), than (2), 1000 (2), age (2), fails (2), verification (2), any (2), without (2), none (2), milliseconds (2), own (2), 86400000 (2), sign (2), provided (2), memory (2), auto (2), description (2), option (2), object (2), parameters (2), expires (2), verifies (2), generates (2), timestamp (2), cross (2), site (2), api (2), contributing (2), node (2), compatibility (2), apis (2), toml (2), data (2), cookies (2), fetch (2), install (2), module (2), search (2), index (2), hosted, mintlify, developer, platform, powered, youtube, discord, github, next, previous, raise, issue, suggest, edits, yes, helpful, namespace, production, provide, explicit, your, infrastructure, within, context, you, omit, parameter, once, convenient, single, threaded, applications, but, won, servers, after, restart, url, listening, 403, status, invalid, typeof, await, async, send, message, value, method, action, httponly, samesite, lax, path, set, append, randomuuid, crypto, html, let, else, issuing, routes, placeholder, less, would, share, binding, yet, never, fall, back, resolve, csrf_secret, env, typical, pattern, rendering, embed, field, submitted, works, reject, older, minute, isvalid2, enforce, shorter, max, what, other, supplied, maximum, independent, required, valid, expired, otherwise, false, token2, different, that, hour, binds, requesting, equivalent, passed, format, until, defaults, hours, unique, contains, cryptographic, nonce, signature, ever, validates, attacker, can, obtain, their, replay, forged, victim, browser, are, signed, include, expiration, forgery, license, bindgen, building, windows, benchmarking, roadmap, web, globals, standards, utils, color, semver, glob, hashing, image, htmlrewriter, jsonl, json5, markdown, yaml, compiler, ffi, interop, tooling, cron, webview, spawn, shell, environment, variables, concurrency, redis, sqlite, sql, archive, binary, streams, storage, dns, udp, tcp, websockets, networking, metrics, error, handling, tls, routing, http, router, plugins, jsx, resolution, bunfig, repl, debugging, watch, mode, core, init, quickstart, installation, welcome, started, feedback, blog, reference, guides, test, runner, bundler, package, manager, navigation, home, skip, main, discover, all, available, pages, exploring, further, complete, docs, llms, txt,


Text of the page (random words):
csrf protection bun documentation index fetch the complete documentation index at docs llms txt use this file to discover all available pages before exploring further skip to main content bun home page search k install bun search navigation utilities csrf protection runtime package manager bundler test runner guides reference blog feedback get started welcome to bun installation quickstart typescript typescript 6 and 7 bun init bun create core runtime bun runtime watch mode debugging repl bunfig toml file module system file types module resolution jsx auto install plugins file system router http server server routing cookies tls error handling metrics networking fetch websockets tcp udp dns data storage cookies file i o streams binary data archive sql sqlite s3 redis concurrency workers process system environment variables shell spawn webview cron interop tooling node api ffi c compiler transpiler utilities csrf protection secrets console toml yaml markdown json5 jsonl htmlrewriter image hashing glob semver color utils standards compatibility globals bun apis web apis node js compatibility contributing roadmap benchmarking contributing building windows bindgen license on this page bun csrf generate bun csrf verify using with bun serve default secret typescript utilities csrf protection copy page copy page generate and verify csrf tokens with bun s built in api copy page copy page bun csrf generates and verifies csrf cross site request forgery tokens tokens are signed with hmac and include an expiration timestamp csrf ts generate a token bound to the requester s session const token bun csrf generate my secret sessionid user session id verify it const isvalid bun csrf verify token secret my secret sessionid user session id console log isvalid true always pass a sessionid the requester s session identifier or user id to both generate and verify without it a token is only bound to the secret any token the server has ever issued validates for every user so an attacker can obtain a token in their own session and replay it in a forged cross site request from a victim s browser bun csrf generate generate a csrf token the token contains a cryptographic nonce a timestamp and an hmac signature encoded as a string generate ts const token bun csrf generate my secret key parameters secret string optional the secret key used to sign the token if not provided bun generates a random in memory default secret unique per thread options object optional option type default description expiresin number 86400000 milliseconds until the token expires defaults to 24 hours encoding string base64url token encoding format base64 base64url or hex algorithm string sha256 hmac algorithm sha256 sha384 sha512 sha512 256 blake2b256 or blake2b512 sessionid string none binds the token to the requesting principal session id user id or equivalent the token only verifies when the same sessionid is passed to verify returns string the encoded token generate options ts token bound to the requester s session that expires in 1 hour encoded as hex const token bun csrf generate my secret sessionid user session id expiresin 60 60 1000 encoding hex using a different algorithm const token2 bun csrf generate my secret sessionid user session id algorithm sha512 bun csrf verify verify a csrf token returns true if the token is valid and has not expired false otherwise verify ts const isvalid bun csrf verify token secret my secret key parameters token string required the token to verify options object optional option type default description secret string auto the secret used to sign the token if not provided uses the same in memory default as generate maxage number 86400000 maximum token age in milliseconds independent of the token s own expiresin encoding string base64url must match the encoding used during generate algorithm string sha256 must match the algorithm used during generate sessionid string none must match the sessionid used during generate a token bound to one principal fails verification for any other principal and a token generated without a sessionid fails verification when one is supplied returns boolean verify options ts verify a token bound to the requester s session const isvalid bun csrf verify token secret my secret sessionid user session id enforce a shorter max age than what the token was generated with const isvalid2 bun csrf verify token secret my secret sessionid user session id maxage 60 1000 reject tokens older than 1 minute using with bun serve a typical pattern is to generate a token when rendering a form embed it in a hidden field and verify it when the form is submitted pass the requester s session identifier as sessionid to both calls so the token only works for the user it was issued to server ts const secret process env csrf_secret my secret resolve the requester s session identifier from a session cookie returns null when the visitor has no session yet never fall back to a shared placeholder or every session less visitor would share one token binding function getsessionid req request string null return req headers get cookie match s session 1 null const server bun serve routes form req create a per visitor session before issuing the form so the token is bound to this visitor and no one else let sessionid getsessionid req const headers new headers content type text html if sessionid sessionid crypto randomuuid headers append set cookie session sessionid httponly samesite lax path const token bun csrf generate secret sessionid return new response form method post action submit input type hidden name _csrf value token input type text name message button type submit send button form headers submit post async req const sessionid getsessionid req const formdata await req formdata const csrftoken formdata get _csrf if sessionid typeof csrftoken string bun csrf verify csrftoken secret secret sessionid return new response invalid csrf token status 403 return new response ok console log listening on server url default secret if you omit the secret parameter in both generate and verify bun uses a random secret generated once per thread this is convenient for single threaded applications but tokens won t verify across servers or workers or after a restart default secret ts both calls use the same per thread default secret within this runtime context const token bun csrf generate const isvalid bun csrf verify token true for production use always provide an explicit secret shared across your infrastructure typescript types ts type csrfalgorithm blake2b256 blake2b512 sha256 sha384 sha512 sha512 256 interface csrfgenerateoptions expiresin number encoding base64 base64url hex algorithm csrfalgorithm sessionid string interface csrfverifyoptions secret string encoding base64 base64url hex algorithm csrfalgorithm maxage number sessionid string namespace bun csrf function generate secret string options csrfgenerateoptions string function verify token string options csrfverifyoptions boolean was this page helpful yes no suggest edits raise issue transpiler previous secrets next i x github discord youtube powered by this documentation is built and hosted on mintlify a developer documentation platform
Thumbnail images (randomly selected): * Images may be subject to copyright.GREEN status (no comments)
  • light logo
  • dark logo

Verified site has: 78 subpage(s). Do you want to verify them? Verify pages:

1-5 6-10 11-15 16-20 21-25 26-30 31-35 36-40 41-45 46-50
51-55 56-60 61-65 66-70 71-75 76-78


The site also has 1 references to other resources (not html/xhtml )

 bun.sh/docs/llms.txt  Verify


Top 50 hastags from of all verified websites.

Supplementary Information (add-on for SEO geeks)*- See more on header.verify-www.com

Header

HTTP/1.1 301 Moved Permanently
Date Wed, 22 Jul 2026 22:46:22 GMT
Content-Type text/html; charset=UTF-8
Transfer-Encoding chunked
Connection close
Server-Timing cfEdge;dur=9,cfOrigin;dur=0
Location htt????/bun.sh/docs/runtime/csrf
Report-To group : cf-nel , max_age :604800, endpoints :[ url : htt????/a.nel.cloudflare.com/report/v4?s=9yDZUr7asDIwMyFokefM4Wuz7husy%2BmGHc5grxtRbAt3mlpP%2Ba9AaDGq3HnTL0t6ntEqC37mKI4KcyyH9ny8kqnfOcil%2BIxdhwFM1nvxIkynEUy0xGSzEg%3D%3D ]
Nel report_to : cf-nel , success_fraction :0.0, max_age :604800
Server cloudflare
CF-RAY a1f5fb24bbae216f-CDG
HTTP/2 200
date Wed, 22 Jul 2026 22:46:22 GMT
content-type text/html; charset=utf-8
age 7106
cache-control no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0
cf-cache-status DYNAMIC
x-version dpl_B6fKKSEu6zLC2JQrqr8Q8XGu5UY1
nel report_to : cf-nel , success_fraction :0.0, max_age :604800
content-security-policy worker-src * blob: data: unsafe-eval unsafe-inline ; object-src data: ; base-uri self ; upgrade-insecure-requests; frame-ancestors self htt????/dashboard.mintlify.com htt????/app.mintlify.com; form-action self htt????/codesandbox.io;
expires 0
link </docs/llms.txt>; rel= llms-txt , </docs/llms-full.txt>; rel= llms-full-txt , </docs/.well-known/api-catalog>; rel= api-catalog , </docs/.well-known/mcp/server-card.json>; rel= mcp-server-card , </docs/.well-known/agent-card.json>; rel= agent-card , </docs/.well-known/agent-skills/index.json>; rel= agent-skills
pragma no-cache
server cloudflare
strict-transport-security max-age=63072000
vary rsc, next-router-state-tree, next-router-prefetch, next-router-segment-prefetch, accept-encoding
x-frame-options DENY
x-llms-txt /docs/llms.txt
x-matched-path /_sites/[subdomain]/[[...slug]]
x-mint-proxy-version 1.0.0-prod
x-mintlify-client-version 0.0.3307
x-nextjs-prerender 1
x-nextjs-stale-time 60
x-served-version dpl_B6fKKSEu6zLC2JQrqr8Q8XGu5UY1
x-vercel-cache REVALIDATED
x-vercel-id lhr1:lhr1:iad1::iad1::jrf62-1784760382256-64b0cf291f97
x-vercel-project-id prj_ekSYngkqMLMUb1wdarxNSixTj2nj
server-timing cfCacheStatus;desc= DYNAMIC
server-timing cfEdge;dur=10,cfOrigin;dur=79
report-to group : cf-nel , max_age :604800, endpoints :[ url : htt????/a.nel.cloudflare.com/report/v4?s=JIIi3DXsbUrzttr2cXvLAjxsj0zCM%2BYnfe%2BXkxJ9sCCQM9lTQIVsSNni1ehk0%2Bn6J%2FqaT5dkz8BrNSpOwAN7B0lxFui6ov%2Bir0rvdVmO1NDs1VY27%2BAq8Q%3D%3D ]
content-encoding gzip
cf-ray a1f5fb25085ecd29-LHR

Meta Tags

title="CSRF Protection - Bun"
charset="utf-8"
name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"
name="description" content="Generate and verify CSRF tokens with Bun's built-in API"
name="application-name" content="Bun"
name="generator" content="Mintlify"
name="msapplication-config" content="/docs/_mintlify/favicons/bun-1dd33a4e/EVjBxeJFWkPSAqAJ/_generated/favicon/browserconfig.xml"
name="apple-mobile-web-app-title" content="Bun"
name="msapplication-TileColor" content="#ff73a8"
property="og:title" content="CSRF Protection - Bun"
property="og:description" content="Generate and verify CSRF tokens with Bun's built-in API"
property="og:url" content="htt????/bun.com/docs/runtime/csrf"
property="og:site_name" content="Bun"
property="og:image" content="htt????/bun-1dd33a4e.mintlify.app/_next/image?url=%2F_mintlify%2Fapi%2Fog%3Fdivision%3DUtilities%26appearance%3Dsystem%26title%3DCSRF%2BProtection%26description%3DGenerate%2Band%2Bverify%2BCSRF%2Btokens%2Bwith%2BBun%2527s%2Bbuilt-in%2BAPI%26logoLight%3Dhttps%253A%252F%252Fmintcdn.com%252Fbun-1dd33a4e%252FJUhaF6Mf68z_zHyy%252Flogo%252Flogo-with-wordmark-dark.svg%253Ffit%253Dmax%2526auto%253Dformat%2526n%253DJUhaF6Mf68z_zHyy%2526q%253D85%2526s%253D3f55cd23822028e40658b192c927f3e4%26logoDark%3Dhttps%253A%252F%252Fmintcdn.com%252Fbun-1dd33a4e%252FJUhaF6Mf68z_zHyy%252Flogo%252Flogo-with-wordmark-light.svg%253Ffit%253Dmax%2526auto%253Dformat%2526n%253DJUhaF6Mf68z_zHyy%2526q%253D85%2526s%253D8a0c5928d9dc3631f0d33e17c257e2ec%26primaryColor%3D%2523ff73a8%26lightColor%3D%2523ff73a8%26backgroundLight%3D%2523ffffff%26backgroundDark%3D%25230e0b0e&w=1200&q=100"
property="og:image:width" content="1200"
property="og:image:height" content="630"
property="og:type" content="website"
name="twitter:card" content="summary_large_image"
name="twitter:title" content="CSRF Protection - Bun"
name="twitter:description" content="Generate and verify CSRF tokens with Bun's built-in API"
name="twitter:image" content="htt????/bun-1dd33a4e.mintlify.app/_next/image?url=%2F_mintlify%2Fapi%2Fog%3Fdivision%3DUtilities%26appearance%3Dsystem%26title%3DCSRF%2BProtection%26description%3DGenerate%2Band%2Bverify%2BCSRF%2Btokens%2Bwith%2BBun%2527s%2Bbuilt-in%2BAPI%26logoLight%3Dhttps%253A%252F%252Fmintcdn.com%252Fbun-1dd33a4e%252FJUhaF6Mf68z_zHyy%252Flogo%252Flogo-with-wordmark-dark.svg%253Ffit%253Dmax%2526auto%253Dformat%2526n%253DJUhaF6Mf68z_zHyy%2526q%253D85%2526s%253D3f55cd23822028e40658b192c927f3e4%26logoDark%3Dhttps%253A%252F%252Fmintcdn.com%252Fbun-1dd33a4e%252FJUhaF6Mf68z_zHyy%252Flogo%252Flogo-with-wordmark-light.svg%253Ffit%253Dmax%2526auto%253Dformat%2526n%253DJUhaF6Mf68z_zHyy%2526q%253D85%2526s%253D8a0c5928d9dc3631f0d33e17c257e2ec%26primaryColor%3D%2523ff73a8%26lightColor%3D%2523ff73a8%26backgroundLight%3D%2523ffffff%26backgroundDark%3D%25230e0b0e&w=1200&q=100"
name="twitter:image:width" content="1200"
name="twitter:image:height" content="630"

Load Info

page size52123
load time (s)0.295533
redirect count1
speed download176688
server IP 172.67.70.226
* all occurrences of the string "http://" have been changed to "htt???/"