@radekmie

On How Bad a Random String Can Be

By Radosław Miernik · Published on · Comment on Reddit

Table of contents

Intro

When was the last time you encountered an annoying yet harmless problem with your tooling? You know, that kind of bug that took you only half an hour and went away by itself the second you tried to figure it out. It’s funny how back in the day I had to run find -L node_modules/.bin -type l | xargs rm roughly every other time I ran npm ci to fix the dangling links.

Nowadays, it feels like it happens less often. I know I’m no longer working with the bleeding edge technologies (sort of). As a result, the problems I face are both less likely but also more severe.

And as this week I got a (small) heart attack, it’s time for a (small) rant.

Security scanners

Literally all kinds of software are getting attacked at the moment. I’ll leave the debate on whether it’s because of the AI, an attempt at cyber dominance of Your Least Favorite Country, or the reptile-led hidden government trying to hide something for another post, though.

Almost every single day we have to upgrade or reconfigure something, because there’s a new vulnerability in NGINX, PHP, and Ruby1… Or because some company’s private key was literally 4. You know it’s big when an incident gets a dedicated Wikipedia page. Shout out to our amazing DevOps Engineer!

Anyway, you try to keep up with it somehow. Monitoring r/programming helps (it really does), but you want something more reliable, so you configure an automated security scanner. And because you want something you can trust, you go with the recommended one: Trivy.

Don’t get me wrong – it’s great! Yet, out of nowhere, i.e., without changing any of our dependencies and keeping a strict package-lock.json policy, we got an alert on one of our Docker images: a github-app-token was leaked.

In my books, it’s bad. Like, “I gotta go” on the call I’m in bad. But then we looked into it, and it’s in ~/.npm/_cacache/index-v5/… How the hell did it get there? It’s npm’s cacache store.

The offensive file stored information about the smart-buffer package. To be precise, in its metadata field, it stores resHeaders – the HTTP headers that were sent with the package’s .tgz file. Here’s the problematic part:

"set-cookie":["__cf_bm=3u5zX4U3hFVBJ3hsf2hl8ygGmkszp.ghs_iLPDBZ4Lo-1795604112.
5139828-1.0.1.1-4L3kqIosCY.U0.di_R8rQOnv0PxSDOs7AmozbwVuQuQTAC0kQ8KMTCygUMCi0N
K7deMQ.DojgMVcJ9Bi2oZWLNUtGuY6qWm7VpAX2Mc.yP5jspNkruZmrfDIfeD9ren0; HttpOnly; 
SameSite=None; Partitioned; Secure; Path=/; Domain=npmjs.org; Expires=Wed, 25 
Nov 2026 11:25:12 GMT"]

I wrapped it a little so you can see it better. Can you see that ghs_ part that matches GitHub’s recommended pattern and triggered this Trivy’s rule? Does it look like a problem to you? Of course not, it’s just a Cloudflare cookie! Yet, it took us time to investigate it and make sure we didn’t actually leak anything.

I posted about it on Cloudflare’s Community. To be honest, I don’t mind them ignoring it, as it feels that the odds are so small it will never happen again2.

Your browser history

Some time ago, I had a problem while accessing one particular file in Figma. It worked when I opened it from within the file selector, but when I used a direct link, Safari failed to open it. Weirdly enough, sometimes it was a DNS problem, sometimes a security block, and once the page loaded but was blank. Let’s look at the structure of such a link:

https://www.figma.com/design/${fileId}/${slug}?node-id={nodeId}&...

It turned out to be an overzealous adblock, which detected an “adult content oriented” substring in the fileId (I’ll leave it to your imagination), and decided to block it. So yeah, I re-enabled porn on my laptop added an exclusion for this one Figma link and forgot about it.

Closing thoughts

I bet you’ve heard tens of similar stories – me too! And it’s always funny until it hits you. Then it’s funny and costs you an hour or so. You can skip the vowels, which helps a little, but hey – there’s no fun in that.

Let’s hope your clients won’t complain about 1337 speak next.

1

Luckily for me, we don’t use Ruby, and PHP is only used in one internal tool.

2

I tried to reproduce it. After a thousand requests, I got ghS and hs_ once.