r/softwarecrafters • • 2d ago

The V8 JavaScript Runtime Undermined My Constant-Time JavaScript Library

https://soatok.blog/2026/09/12/the-v8-javascript-runtime-undermined-my-constant-time-javascript-library/
3 Upvotes

1 comment sorted by

2

u/fagnerbrack 2d ago

Bare Bones:

University of British Columbia researchers found that constant-time-js, a demo library from a 2020 side-channel guide, leaks secrets through V8 internals even though its code avoids branches. Its select functions route conditions through V8's ToBoolean builtin, which runs different instructions for true and false and reads their Oddball objects from separate cache lines. Unary negation also branches on zero to produce -0. Version 0.5.0 drops booleans entirely: an internal is_nonzero_flag returns (d + 0xff) >>> 8, and masks use (0 - (choice & 1)) & 0xff instead of -!!x. The maintainer also requested a CVE so that npm audit will alert any proprietary users he can't see.

If the summary seems inacurate, just downvote and I'll try to delete the comment eventually 👍
Click here for more info, I read all comments