jose deleted 200 files when Node grew a crypto global
jose 5 shipped two complete crypto implementations, one for Node and one for browsers. jose 6 ships one. I counted the files and ran the code in both.
16 posts
jose 5 shipped two complete crypto implementations, one for Node and one for browsers. jose 6 ships one. I counted the files and ran the code in both.
Web Crypto signs a JWT with a 512-bit RSA key and calls it valid. RFC 7518 wants 2048 bits. Where that check lives, and how to test your own keys.
Deny-by-default is one layer. Here's every other threat the bridge is built to handle — prototype pollution, CSRF, and the line between what it secures and what your code still has to.
Reaching for .buffer to turn a Node Buffer into an ArrayBuffer hands you the whole 8KB allocation pool, not your 15 bytes. Here is the HMAC it silently breaks, the password it leaks, and why it works fine on a big payload and fails on a small one.
Sharing one in-flight request between callers is a great speed trick. If the key only says what was asked for, and not who asked, the second user gets the first user's data. Here is a 30-line reproduction and the fix.
A security token that's correct at mint time and never checked again is a ticking bug, not a fix. What happened when a tab in my Next.js logger outlived its token, and the rollover mechanism that closes the gap.
I tested every way to copy an object with a __proto__ key. Spread is safe, Object.assign is not, and only one of them reaches Object.prototype.
Import your normal API client into a client component and check the Network tab. This is the architecture that stops that from happening.
My logger claimed it blocked newline injection. It only stripped carriage returns. Here is the real log injection bug and the fix I tested.
INCR then PEXPIRE is the standard Redis rate limit. I tested what happens when the second one fails, and found a key that never expires.
new URL(path, baseURL) is not string joining. A leading slash wipes your base path, a missing trailing slash eats a segment, and the wrong path can send your auth token to someone else's server.
Bearer, cookie, API key, OAuth2 — and the one bug almost every hand-rolled auth layer has: four parallel requests triggering four token refreshes at once.
A practical walk through the vercel.json headers block I ship in production — HSTS, X-Frame-Options, X-Content-Type-Options, Permissions-Policy, and immutable long-cache for hashed assets, fonts, and images.
A honeypot is a hidden form field humans never see and bots always fill. Here's how I added one to my contact form — the hidden input on the client and the silent 200 on the server.
A tiny sliding-window rate limiter that tracks requests per IP in memory and returns 429 when a client sends too many — plus an honest look at why in-memory limits are only a first line of defence on serverless.
Access tokens leak. Refresh tokens live for weeks. Rotation with reuse detection is what stops a stolen token from becoming a permanent backdoor — here's how I built it in MERN Notes, and how RBAC layers cleanly on top.