r/programming • • 1d 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/
26 Upvotes

12 comments sorted by

35

u/simon_o 23h ago edited 23h ago

You cannot build constant-time primitives as a library in code executed by an optimizing (JIT) compiler without runtime support.

Not sure whether I should be more surprised by

  • JavaScript developers' hubris of thinking this would work, or
  • them believing that their "fix" will do anything but kicking the can a bit further down the road.

(And no, I'm not buying the "describing how programmers introduce side-channels into their code and wrote an example library for educational purposes" ret-con of the library.)

5

u/masklinn 20h ago

Retcon? The note that you should not use the library in production was added just a month after the article was published, more than 6 years ago. And the article never presents it as something you should use, it's introduced in the "Design Patterns for Algorithmic Constant-Time Code" section as an alternative language to the PHP examples. Nor is soatok's an especially javascript oriented developer.

0

u/Somepotato 18h ago

You can make some assumptions with how turbofan will work though

3

u/simon_o 18h ago

Yes, though that would be really stupid.

0

u/Somepotato 18h ago

Hardly. Knowing how turbofan let's you optimize intelligently ie giving it array size hints (such as providing mathematical guarantees you won't overflow) to let it optimize out length checks or writing functions in a way that can be inlined

1

u/simon_o 13h ago

That's simply not the topic at hand.

4

u/qmunke 1d ago

This is a relatively interesting post, it's just a shame the author has a gigantic chip on their shoulder about the whole furry thing to the extent they need a huge essay linked at the top of the article about it.

15

u/KaMaFour 1d ago

It's a shame they need to make an essay for people complaining about the content of his personal blog

1

u/dwighthouse 10h ago

Wait, I thought the point of both personal blogs and Reddit was complaining about things.

8

u/simon_o 23h ago

I think it's largely because of people like you. :-)

2

u/Somepotato 18h ago

Yes, it is so in the way, obtrusive and bothersome that I too want to prove the authors point and whine about it.