Title: test(nostr-cid-vm): make JWK-y corruption provably off-curve (closes #438) by melvincarvalho · Pull Request #504 · JavaScriptSolidServer/JavaScriptSolidServer · GitHub
Open Graph Title: test(nostr-cid-vm): make JWK-y corruption provably off-curve (closes #438) by melvincarvalho · Pull Request #504 · JavaScriptSolidServer/JavaScriptSolidServer
X Title: test(nostr-cid-vm): make JWK-y corruption provably off-curve (closes #438) by melvincarvalho · Pull Request #504 · JavaScriptSolidServer/JavaScriptSolidServer
Description: Summary Replaces the single-char base64url flip on jwk.y with 'A'.repeat(43) (32 zero bytes) so the "right x, wrong y" JWK is provably off-curve for any practical random keypair. Same shape, same parsing path — only the corruption is deterministic now. Root cause The old corruption was: y: goodJwk.y.slice(0, -1) + (goodJwk.y.endsWith('A') ? 'B' : 'A') The last base64url char of a 32-byte field carries only 4 high bits — the bottom 2 are padding zeroes. 'A' = 000000 and 'B' = 000001 differ only in those padding bits, so they decode to the same bytes. When y's base64url happened to end in 'A' (~1/16 of randomly generated keys), the "corruption" was a no-op and the JWK passed curve validation, so the WebID upgrade succeeded and the test failed. A much rarer second path (the one the issue analysis flagged): the flip happened to land on -y mod p, which is the other valid y for the same x. Either way, the fix below kills both. Fix Set y to 32 zero bytes. (x, 0) is on secp256k1 iff x³ ≡ -7 mod p, which has exactly 3 solutions in ~2²⁵⁶ — vanishingly improbable for any randomly generated x. Keeps option 2 from the issue's fix menu, preserving "random keypair" coverage. Test plan node --test test/nostr-cid-vm.test.js — all 25 tests pass. Ran the suite 30 consecutive times — zero failures (previously flaked ~1 in 16 runs). Targeted test still validates the intended path: profile carries a JWK with valid x but invalid y, the curve check rejects it, and auth falls back to did:nostr:. Closes #438.
Open Graph Description: Summary Replaces the single-char base64url flip on jwk.y with 'A'.repeat(43) (32 zero bytes) so the "right x, wrong y" JWK is provably off-curve for any practical random keypair....
X Description: Summary Replaces the single-char base64url flip on jwk.y with 'A'.repeat(43) (32 zero bytes) so the "right x, wrong y" JWK is provably off-curve for any practical...
Opengraph URL: https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/504
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
| react-profiling | 0 |
| react-import-map | react,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-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:7b1f40cd-ff01-fbff-8975-2d4778fb510e |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8322:2D34E3:95C79C:C5F71E:6B039DEF |
| html-safe-nonce | e7ec0c286660a1c91a6a448d08f658a39f0fe34e64de8e28f889302d43362969 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MzIyOjJEMzRFMzo5NUM3OUM6QzVGNzFFOjZCMDM5REVGIiwidmlzaXRvcl9pZCI6IjMwMTE0Njc0MTg2MTE3MTk2NjMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 0c98fa03b7ead91b872c7aae4f1cc0752337fdeee53529de53fb59da01b6fd71 |
| hovercard-subject-tag | pull_request:3706834439 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/504/files |
| twitter:image | https://avatars.githubusercontent.com/u/65864?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/65864?s=400&v=4 |
| og:image:alt | Summary Replaces the single-char base64url flip on jwk.y with 'A'.repeat(43) (32 zero bytes) so the "right x, wrong y" JWK is provably off-curve for any practical random keypair.... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/JavaScriptSolidServer/JavaScriptSolidServer git https://github.com/JavaScriptSolidServer/JavaScriptSolidServer.git |
| octolytics-dimension-user_id | 205442424 |
| octolytics-dimension-user_login | JavaScriptSolidServer |
| octolytics-dimension-repository_id | 958025407 |
| octolytics-dimension-repository_nwo | JavaScriptSolidServer/JavaScriptSolidServer |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 958025407 |
| octolytics-dimension-repository_network_root_nwo | JavaScriptSolidServer/JavaScriptSolidServer |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width