René's URL Explorer Experiment


Title: feat(server): session/auth/CSRF/guard primitives + graduate toward Stable (#131, #132) by JosunLP · Pull Request #153 · bQuery/bQuery · GitHub

Open Graph Title: feat(server): session/auth/CSRF/guard primitives + graduate toward Stable (#131, #132) by JosunLP · Pull Request #153 · bQuery/bQuery

X Title: feat(server): session/auth/CSRF/guard primitives + graduate toward Stable (#131, #132) by JosunLP · Pull Request #153 · bQuery/bQuery

Description: Collected work for the two open server tickets, landed in one branch and targeting dev. Closes #131. Closes #132. #132 — session, auth, and middleware primitives session() + memoryStore() — HMAC-signed session-id cookie (Web Crypto, cross-runtime), payload in a pluggable SessionStore (in-memory default; bring-your-own Redis/DB without bundling a client). ctx.session is a Proxy: payload via plain props, lifecycle via $id / $isNew / $data / $regenerate / $destroy / $clear. Includes secret rotation, rolling sessions, prototype-pollution filtering, and session-fixation defense. csrf() + csrfToken() — OWASP double-submit cookie (signed when a secret is supplied); token via x-csrf-token header or _csrf body field. Composes with the security module (integrity vs. output). guard() — predicate route guard mirroring the router's guard ergonomics. basicAuth() / bearerAuth() — Authorization parsing with a verify() hook; resolved user on ctx.state. Signing utilities — signValue / unsignValue / timingSafeEqual / randomToken / randomId / base64Url*, all on globalThis.crypto.subtle (no node:crypto). Shared cookie helpers extracted to src/server/cookies.ts (+ appendSetCookie); no behavioral change to existing ctx.setCookie. #131 — promote server toward Stable Guide Stability section: exit-criteria checklist, frozen ctx/app surface, per-runtime support matrix; intro + README notes; version history. app.listen() now supports Deno via Deno.serve (Node/Bun/Deno covered). ctx.session is additive/optional — no breaking changes to the 1.14 surface. New exports wired through server/index.ts and the /full bundle. Zero-dependency & secure-by-default No runtime dependencies added; each primitive is independently importable/tree-shakeable. Sessions default to httpOnly + SameSite=Lax; signing is HMAC-SHA-256; comparisons are constant-time. Verification Full suite 2785 pass / 0 fail (42 new in tests/server-stable.test.ts: sessions, CSRF, guards, auth, crypto — incl. secret rotation, rolling, $destroy-revive, immutable-response cookies). Cross-runtime smoke extended for server (sign/verify, session, CSRF) — passes on Node + Bun locally; Deno in CI. tsc, eslint, bun run build, check:full-bundle (in sync), check:doc-exports (server 23/23) all green. Review Ran an adversarial multi-agent review of the diff; applied the confirmed hardening: don't cache a rejected HMAC key-import, guard timingSafeEqual against empty input, revive a session written-to after $destroy(), simplify the Deno listen() address resolution, and strengthened tests/docs. 🤖 Generated with Claude Code

Open Graph Description: Collected work for the two open server tickets, landed in one branch and targeting dev. Closes #131. Closes #132. #132 — session, auth, and middleware primitives session() + memoryStore() — HMAC-s...

X Description: Collected work for the two open server tickets, landed in one branch and targeting dev. Closes #131. Closes #132. #132 — session, auth, and middleware primitives session() + memoryStore() — HMAC-s...

Opengraph URL: https://github.com/bQuery/bQuery/pull/153

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:c6e6ba08-7b3b-795c-c6a3-2070ba8798fe
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idD606:1BF5E4:49DE5D:67E2F0:6A4E7083
html-safe-nonce6a7a6e87b080cc9b3f976d2199a41edd07a5a7c41a40e0617e1287eef7e21ff9
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENjA2OjFCRjVFNDo0OURFNUQ6NjdFMkYwOjZBNEU3MDgzIiwidmlzaXRvcl9pZCI6IjY4MDQ2NzU3NDg2NTUxNjU1NzEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac38eaff7dc35f2d45e15faa31067f5993e724e83baafec986b6d4376d80ded1df
hovercard-subject-tagpull_request:3950571817
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/bQuery/bQuery/pull/153/files
twitter:imagehttps://avatars.githubusercontent.com/u/20913954?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/20913954?s=400&v=4
og:image:altCollected work for the two open server tickets, landed in one branch and targeting dev. Closes #131. Closes #132. #132 — session, auth, and middleware primitives session() + memoryStore() — HMAC-s...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None41b6ab3ba6d20a71766ac245b5a4a94c6fc672a9cd4da7d44c1b33ab8bf6a21c
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/bQuery/bQuery git https://github.com/bQuery/bQuery.git
octolytics-dimension-user_id256381806
octolytics-dimension-user_loginbQuery
octolytics-dimension-repository_id1139284244
octolytics-dimension-repository_nwobQuery/bQuery
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1139284244
octolytics-dimension-repository_network_root_nwobQuery/bQuery
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasee6a744804e8e70f97b4d5a18a94dcc63db22f97a
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/bQuery/bQuery/pull/153/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FbQuery%2FbQuery%2Fpull%2F153%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FbQuery%2FbQuery%2Fpull%2F153%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=bQuery%2FbQuery
Reloadhttps://github.com/bQuery/bQuery/pull/153/files
Reloadhttps://github.com/bQuery/bQuery/pull/153/files
Reloadhttps://github.com/bQuery/bQuery/pull/153/files
Please reload this pagehttps://github.com/bQuery/bQuery/pull/153/files
bQuery https://github.com/bQuery
bQueryhttps://github.com/bQuery/bQuery
Please reload this pagehttps://github.com/bQuery/bQuery/pull/153/files
Notifications https://github.com/login?return_to=%2FbQuery%2FbQuery
Fork 0 https://github.com/login?return_to=%2FbQuery%2FbQuery
Star 1 https://github.com/login?return_to=%2FbQuery%2FbQuery
Code https://github.com/bQuery/bQuery
Issues 0 https://github.com/bQuery/bQuery/issues
Pull requests 0 https://github.com/bQuery/bQuery/pulls
Actions https://github.com/bQuery/bQuery/actions
Security and quality 0 https://github.com/bQuery/bQuery/security
Insights https://github.com/bQuery/bQuery/pulse
Code https://github.com/bQuery/bQuery
Issues https://github.com/bQuery/bQuery/issues
Pull requests https://github.com/bQuery/bQuery/pulls
Actions https://github.com/bQuery/bQuery/actions
Security and quality https://github.com/bQuery/bQuery/security
Insights https://github.com/bQuery/bQuery/pulse
Sign up for GitHub https://github.com/signup?return_to=%2FbQuery%2FbQuery%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FbQuery%2FbQuery%2Fissues%2Fnew%2Fchoose
JosunLPhttps://github.com/JosunLP
devhttps://github.com/bQuery/bQuery/tree/dev
feat/server-stable-131-132https://github.com/bQuery/bQuery/tree/feat/server-stable-131-132
Conversation 1 https://github.com/bQuery/bQuery/pull/153
Commits 1 https://github.com/bQuery/bQuery/pull/153/commits
Checks 8 https://github.com/bQuery/bQuery/pull/153/checks
Files changed https://github.com/bQuery/bQuery/pull/153/files
Please reload this pagehttps://github.com/bQuery/bQuery/pull/153/files
feat(server): session/auth/CSRF/guard primitives + graduate toward Stable (#131, #132) https://github.com/bQuery/bQuery/pull/153/files#top
Show all changes 1 commit https://github.com/bQuery/bQuery/pull/153/files
08f6572 feat(server): first-party session/auth/CSRF/guard primitives + gradua… JosunLP Jun 28, 2026 https://github.com/bQuery/bQuery/pull/153/commits/08f657262278a3b02c85fe24cef28086a093307b
Clear filters https://github.com/bQuery/bQuery/pull/153/files
Please reload this pagehttps://github.com/bQuery/bQuery/pull/153/files
Please reload this pagehttps://github.com/bQuery/bQuery/pull/153/files
README.md https://github.com/bQuery/bQuery/pull/153/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5
server.md https://github.com/bQuery/bQuery/pull/153/files#diff-243ae54884e2f05bcd55e5576bca13708a9120971f955ea579b3a568658da476
introduction.md https://github.com/bQuery/bQuery/pull/153/files#diff-56f8d2b8c873ba84c43d98f257eeec70dc5901f0b9635db6f90bd874b914e97d
full.ts https://github.com/bQuery/bQuery/pull/153/files#diff-3061502541780be549a3418b68cb60d2fbe8fc17f84f6ec533ce6bd0ab4eb95b
auth.ts https://github.com/bQuery/bQuery/pull/153/files#diff-4fc74dea0e5beb40c3454c95ae13bee6639bae43dd8bf7079f0993a7002e4f05
cookies.ts https://github.com/bQuery/bQuery/pull/153/files#diff-df3c2f898c5f45e6022827fa7023797b95f918274deb580dabf89902931a9274
create-server.ts https://github.com/bQuery/bQuery/pull/153/files#diff-35b28cf33078fa1982a625ab671b36fce0e7b8de02b25b5c90defac733f9a170
crypto.ts https://github.com/bQuery/bQuery/pull/153/files#diff-73640eb4d8f5f85ea07853c23b4ec0d7f805e0644e2aa1ec34cb74567c28d919
csrf.ts https://github.com/bQuery/bQuery/pull/153/files#diff-28286fa86bed6ba084fa3d0bb60eb6022980854e28ca38d097f109d194483445
guard.ts https://github.com/bQuery/bQuery/pull/153/files#diff-7afcc99fdbc6628cd53b13787f55aac9c2e29728be2b546236d46f89be8b63a0
index.ts https://github.com/bQuery/bQuery/pull/153/files#diff-e4e7a68d82cdfba4e7dab9a32a8f55f3806ffa0cf33f1b8ab64b42941cf68888
session.ts https://github.com/bQuery/bQuery/pull/153/files#diff-c9fde3d99427a4b56c409a7dec15c227b21119d0d56bcfab4dbfad23f83118b0
types.ts https://github.com/bQuery/bQuery/pull/153/files#diff-9a3a0a5fdd0766b53ba8436a42cd88d004c2dadf2853adbe4ca061f4b2215a40
run.mjs https://github.com/bQuery/bQuery/pull/153/files#diff-0fd530272dbcbea5ca45e4035c1d244c22f21a0abae278a0797a1d78f4cf18a1
server-stable.test.ts https://github.com/bQuery/bQuery/pull/153/files#diff-4e41a24b4402ddda204ab01441e6752f051fe8a70f976865d66010df4cc88df4
README.mdhttps://github.com/bQuery/bQuery/pull/153/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5
View file https://github.com/bQuery/bQuery/blob/08f657262278a3b02c85fe24cef28086a093307b/README.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/bQuery/bQuery/pull/153/{{ revealButtonHref }}
https://github.com/bQuery/bQuery/pull/153/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5
https://github.com/bQuery/bQuery/pull/153/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5
https://github.com/bQuery/bQuery/pull/153/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5
https://github.com/bQuery/bQuery/pull/153/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5
docs/guide/server.mdhttps://github.com/bQuery/bQuery/pull/153/files#diff-243ae54884e2f05bcd55e5576bca13708a9120971f955ea579b3a568658da476
View file https://github.com/bQuery/bQuery/blob/08f657262278a3b02c85fe24cef28086a093307b/docs/guide/server.md
Open in desktop https://desktop.github.com
Please reload this pagehttps://github.com/bQuery/bQuery/pull/153/files
docs/introduction.mdhttps://github.com/bQuery/bQuery/pull/153/files#diff-56f8d2b8c873ba84c43d98f257eeec70dc5901f0b9635db6f90bd874b914e97d
View file https://github.com/bQuery/bQuery/blob/08f657262278a3b02c85fe24cef28086a093307b/docs/introduction.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/bQuery/bQuery/pull/153/{{ revealButtonHref }}
https://github.com/bQuery/bQuery/pull/153/files#diff-56f8d2b8c873ba84c43d98f257eeec70dc5901f0b9635db6f90bd874b914e97d
https://github.com/bQuery/bQuery/pull/153/files#diff-56f8d2b8c873ba84c43d98f257eeec70dc5901f0b9635db6f90bd874b914e97d
https://github.com/bQuery/bQuery/pull/153/files#diff-56f8d2b8c873ba84c43d98f257eeec70dc5901f0b9635db6f90bd874b914e97d
src/full.tshttps://github.com/bQuery/bQuery/pull/153/files#diff-3061502541780be549a3418b68cb60d2fbe8fc17f84f6ec533ce6bd0ab4eb95b
View file https://github.com/bQuery/bQuery/blob/08f657262278a3b02c85fe24cef28086a093307b/src/full.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/bQuery/bQuery/pull/153/{{ revealButtonHref }}
https://github.com/bQuery/bQuery/pull/153/files#diff-3061502541780be549a3418b68cb60d2fbe8fc17f84f6ec533ce6bd0ab4eb95b
https://github.com/bQuery/bQuery/pull/153/files#diff-3061502541780be549a3418b68cb60d2fbe8fc17f84f6ec533ce6bd0ab4eb95b
https://github.com/bQuery/bQuery/pull/153/files#diff-3061502541780be549a3418b68cb60d2fbe8fc17f84f6ec533ce6bd0ab4eb95b
src/server/auth.tshttps://github.com/bQuery/bQuery/pull/153/files#diff-4fc74dea0e5beb40c3454c95ae13bee6639bae43dd8bf7079f0993a7002e4f05
View file https://github.com/bQuery/bQuery/blob/08f657262278a3b02c85fe24cef28086a093307b/src/server/auth.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/bQuery/bQuery/pull/153/{{ revealButtonHref }}
src/server/cookies.tshttps://github.com/bQuery/bQuery/pull/153/files#diff-df3c2f898c5f45e6022827fa7023797b95f918274deb580dabf89902931a9274
View file https://github.com/bQuery/bQuery/blob/08f657262278a3b02c85fe24cef28086a093307b/src/server/cookies.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/bQuery/bQuery/pull/153/{{ revealButtonHref }}
Please reload this pagehttps://github.com/bQuery/bQuery/pull/153/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.