René's URL Explorer Experiment


Title: fix(nostr): NIP-98 payload hash verifies raw request bytes, not a re-serialization — closes #565 by melvincarvalho · Pull Request #573 · JavaScriptSolidServer/JavaScriptSolidServer · GitHub

Open Graph Title: fix(nostr): NIP-98 payload hash verifies raw request bytes, not a re-serialization — closes #565 by melvincarvalho · Pull Request #573 · JavaScriptSolidServer/JavaScriptSolidServer

X Title: fix(nostr): NIP-98 payload hash verifies raw request bytes, not a re-serialization — closes #565 by melvincarvalho · Pull Request #573 · JavaScriptSolidServer/JavaScriptSolidServer

Description: Closes #565. Bug src/auth/nostr.js checked the NIP-98 payload tag against JSON.stringify(request.body) — the parsed-then-recompacted body. NIP-98 defines that tag as sha256(request body) over the exact wire bytes, so any client sending pretty-printed JSON (or a different key order / escaping than Node's JSON.stringify) 401'd with Payload hash mismatch despite a valid signature, URL, method, and timestamp. It silently forced every NIP-98 client toward minified JSON — not a real requirement — and only bit Nostr auth (DPoP has no payload check), making valid signatures look broken. Root cause By the time the auth preHandler runs, Fastify's default application/json parser has already turned the body into an object — the raw bytes are gone. The re-serialization was the best the old code could do, and it matched only by coincidence when the client happened to minify in Node's exact serialization. Fix (two halves) server.js overrides the application/json content-type parser to capture the raw bytes as request.rawBody before parsing — the only point they still exist. It otherwise mirrors Fastify 4's defaultJsonParser exactly: empty body → 400, secure-json-parse (the same prototype-pollution protection JSS gets today — not plain JSON.parse), 400 on malformed. So no other request path changes. secure-json-parse promoted to a direct dependency. nostr.js hashes request.rawBody when present, never a re-serialization. Scope: only application/json was affected — it's the one type parsed into an object. Turtle, JSON-LD, octet-stream, etc. fall through the * parser as Buffers and already hashed raw bytes correctly. Why mirror Fastify's parser instead of JSON.parse Replacing the global JSON parser is the blast radius here, so it had to be byte-faithful. Using plain JSON.parse would have dropped the prototype-pollution protection Fastify provides by default — a real security regression. The test asserts a __proto__ payload is still rejected and Object.prototype stays clean. Tests (test/nip98-payload-hash.test.js, 6 — first direct NIP-98 payload coverage) Parser (via createServer + inject): pretty JSON accepted; malformed → 400 (not 500); __proto__ → 400 + prototype not polluted. Payload hash (unit on verifyNostrAuth): a pretty body with rawBody passes and resolves to the did:nostr: identity; the same body without rawBody still mismatches (control — proves rawBody is the fix); a compact body still verifies (no regression). Full suite: 968/968 — the global JSON-parser override regressed nothing, confirming the mirror is faithful.

Open Graph Description: Closes #565. Bug src/auth/nostr.js checked the NIP-98 payload tag against JSON.stringify(request.body) — the parsed-then-recompacted body. NIP-98 defines that tag as sha256(request body) over the e...

X Description: Closes #565. Bug src/auth/nostr.js checked the NIP-98 payload tag against JSON.stringify(request.body) — the parsed-then-recompacted body. NIP-98 defines that tag as sha256(request body) over the e...

Opengraph URL: https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.113.3

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:89c86763-459c-b74d-5049-851544c657a3
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idCBFE:2D34E3:D69759:11CEC76:6B03B588
html-safe-noncec5f129b14ce0c50321e8b2ed3a3e8ee6ae2fcd22f451785e0a6705941e863b0d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQkZFOjJEMzRFMzpENjk3NTk6MTFDRUM3Njo2QjAzQjU4OCIsInZpc2l0b3JfaWQiOiI2NzI4MTg2NDY5OTM0MTUxMDQ4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac3f6707140d9de5edf54b3bbb6319b8efc819d369f7db5e964eb8e7b7852977b6
hovercard-subject-tagpull_request:3873673007
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/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/files
twitter:imagehttps://avatars.githubusercontent.com/u/65864?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/65864?s=400&v=4
og:image:altCloses #565. Bug src/auth/nostr.js checked the NIP-98 payload tag against JSON.stringify(request.body) — the parsed-then-recompacted body. NIP-98 defines that tag as sha256(request body) over the e...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/JavaScriptSolidServer/JavaScriptSolidServer git https://github.com/JavaScriptSolidServer/JavaScriptSolidServer.git
octolytics-dimension-user_id205442424
octolytics-dimension-user_loginJavaScriptSolidServer
octolytics-dimension-repository_id958025407
octolytics-dimension-repository_nwoJavaScriptSolidServer/JavaScriptSolidServer
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id958025407
octolytics-dimension-repository_network_root_nwoJavaScriptSolidServer/JavaScriptSolidServer
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
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FJavaScriptSolidServer%2FJavaScriptSolidServer%2Fpull%2F573%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
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
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://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
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FJavaScriptSolidServer%2FJavaScriptSolidServer%2Fpull%2F573%2Ffiles
Sign uphttps://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=JavaScriptSolidServer%2FJavaScriptSolidServer
Reloadhttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/files
Reloadhttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/files
Reloadhttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/files
JavaScriptSolidServerhttps://github.com/JavaScriptSolidServer
JavaScriptSolidServerhttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer
Codehttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer
Issues165 (165)https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues
Pull requests14 (14)https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pulls
Actionshttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/actions
Projectshttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/projects
Security and qualityhttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/security
Insightshttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/insights
Sign up for GitHub https://github.com/signup?return_to=%2FJavaScriptSolidServer%2FJavaScriptSolidServer%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FJavaScriptSolidServer%2FJavaScriptSolidServer%2Fissues%2Fnew%2Fchoose
melvincarvalhohttps://github.com/melvincarvalho
gh-pageshttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/tree/gh-pages
issue-565-nip98-raw-bodyhttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/tree/issue-565-nip98-raw-body
Conversation 10 https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573
Commits 4 https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/commits
Checks 0 https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/checks
Files changed https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/files
Please reload this pagehttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/files
fix(nostr): NIP-98 payload hash verifies raw request bytes, not a re-serialization — closes #565 https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/files#top
Show all changes 4 commits https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/files
1fa2266 fix(nostr): NIP-98 payload hash verifies raw request bytes, not a re-… melvincarvalho Jun 16, 2026 https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/commits/1fa2266ee134d534fdd486d21bee7c7a4ce5860d
3dda984 review fix (#573): hash Buffer bodies directly, not via a lossy toStr… melvincarvalho Jun 16, 2026 https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/commits/3dda984199b5c1c72853bdaec0ad82ea10479bb7
09fed94 review pass-2 fix (#573): hash-check payload for falsy-parsed bodies too melvincarvalho Jun 16, 2026 https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/commits/09fed94ea258725df9defe29ee17a6bd2d96c4d2
875680c review pass-3 fix (#573): empty-JSON error carries FST_ERR_CTP_EMPTY_… melvincarvalho Jun 16, 2026 https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/commits/875680cccf33f3b781efd82cfdc2da474ee600bb
Clear filters https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/files
Please reload this pagehttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/files
Please reload this pagehttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/files
package-lock.json https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/files#diff-053150b640a7ce75eff69d1a22cae7f0f94ad64ce9a855db544dda0929316519
package.json https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519
nostr.js https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/files#diff-4d21d2f5794b51604dbafc5247bdf5bbd9e81f405e51a3ead6c2d1eb83c4b382
server.js https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/files#diff-79f4c7cdc0b026f6e556196f5911a449157807cffdb3f9d33f0b5404b4ffc2f3
nip98-payload-hash.test.js https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/files#diff-ed14dc1afef85011ecec74144ab0d46305c8bae42680f5ab06adf48acb1653c7
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/blob/gh-pages/.github/CODEOWNERS#L22
package-lock.jsonhttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/files#diff-053150b640a7ce75eff69d1a22cae7f0f94ad64ce9a855db544dda0929316519
View file https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/blob/875680cccf33f3b781efd82cfdc2da474ee600bb/package-lock.json
Open in desktop https://desktop.github.com
how customized files appear on GitHubhttps://docs.github.com/github/administering-a-repository/customizing-how-changed-files-appear-on-github
Please reload this pagehttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/files
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/blob/gh-pages/.github/CODEOWNERS#L21
package.jsonhttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519
View file https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/blob/875680cccf33f3b781efd82cfdc2da474ee600bb/package.json
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/{{ revealButtonHref }}
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/blob/gh-pages/.github/CODEOWNERS#L15
src/auth/nostr.jshttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/files#diff-4d21d2f5794b51604dbafc5247bdf5bbd9e81f405e51a3ead6c2d1eb83c4b382
View file https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/blob/875680cccf33f3b781efd82cfdc2da474ee600bb/src/auth/nostr.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/{{ revealButtonHref }}
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/files#diff-4d21d2f5794b51604dbafc5247bdf5bbd9e81f405e51a3ead6c2d1eb83c4b382
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/files#diff-4d21d2f5794b51604dbafc5247bdf5bbd9e81f405e51a3ead6c2d1eb83c4b382
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/blob/gh-pages/.github/CODEOWNERS#L12
src/server.jshttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/files#diff-79f4c7cdc0b026f6e556196f5911a449157807cffdb3f9d33f0b5404b4ffc2f3
View file https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/blob/875680cccf33f3b781efd82cfdc2da474ee600bb/src/server.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/{{ revealButtonHref }}
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/files#diff-79f4c7cdc0b026f6e556196f5911a449157807cffdb3f9d33f0b5404b4ffc2f3
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/files#diff-79f4c7cdc0b026f6e556196f5911a449157807cffdb3f9d33f0b5404b4ffc2f3
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/files#diff-79f4c7cdc0b026f6e556196f5911a449157807cffdb3f9d33f0b5404b4ffc2f3
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/blob/gh-pages/.github/CODEOWNERS#L12
test/nip98-payload-hash.test.jshttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/files#diff-ed14dc1afef85011ecec74144ab0d46305c8bae42680f5ab06adf48acb1653c7
View file https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/blob/875680cccf33f3b781efd82cfdc2da474ee600bb/test/nip98-payload-hash.test.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/573/{{ revealButtonHref }}
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

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlno-cache

Viewport: width=device-width


URLs of crawlers that visited me.