r/programminghorror • • Oct 23 '26

GitHub's HTTP header

Post image

This is the crazy thing I've found after analysis why the CI test fails with "Maximum header size exceeded" today.

963 Upvotes

53 comments sorted by

64

u/Julius_Babies Oct 24 '26 edited 28d ago

I saw this post a while ago and just ran into this. The HTTP Engine my app uses cannot handle header values longer than 8192 characters by default, which causes my in-app update mechanism (which relies on GitHub releases) to fail when trying to download the update. I cannot provide a fix for this as this fix would require - you guessed it - an update.

This has been reported as a bug on the GitHub Community discussions already: https://github.com/orgs/community/discussions/211142

Edit: It's now fixed

14

u/dex4er Oct 24 '26

I couldn't believe my eyes when I saw it in the report from online tests: https://github.com/dex4er/Pyjoyment/actions/runs/40022001390/job/120648616821#step:4:420 The library is a port of Mojolicious from Perl then inherited 8K as a limit for headers. As I see it affected mainly Perl and Elixir.

3

u/Julius_Babies Oct 24 '26

Ktor CIO as well

482

u/Belialson Oct 23 '26

Company I work at was proxing some endpoints to us, it was a big shop. They used to set a cookie with json containing entire user’s session including every page visited and it’s details.
Same effect but unfortunately on production

92

u/buckypimpin Oct 23 '26

isnt a cookie max 4KiB?

125

u/RegisteredJustToSay Oct 24 '26

That's per cookie (name + value). You can store many times that if you break it up over multiple keys, tho max 180 per host on chrome. You could fit ten text copies of Alice in wonderland in that space.

You're right though, of course. Just don't want to give anyone here the idea that you're limited to this little space per domain.

37

u/RustOnTheEdge Oct 24 '26

Alice in Wonderland is roughly 170kb, so it would fit 4.3 times in all the available header space.

18

u/SuspiciousSegfault Oct 24 '26

How well does it compress though?

15

u/RegisteredJustToSay Oct 25 '26

Weird, specifically checked gutenberg and saw it was under 80 kB but now on desktop it says 170 kB. Was on mobile though so may have been a presentation issue. Thanks for the correction!

11

u/RustOnTheEdge Oct 25 '26

I found it such a nice unit of measurement, well done for that!

24

u/caboosetp Oct 23 '26

You can fit quite a bit in 4k before it causes issues that a browser restart can fix and push off the issue.

5

u/Chesterlespaul Oct 24 '26

Interesting idea. Obviously don’t do this. But I wonder sort of data this could be useful for.

15

u/groumly Oct 24 '26

Asp (can’t remember if it was the og or the .net one, I think .net) did a lot of crap like that back in day.

It was used to turn stateless web framework into a stateful mode iirc.

12

u/lenswipe Oct 24 '26

Ah yes __VIEWSTATE

I remember seeing that hidden field in a form, decoding it and was like ".....no fucking way"

6

u/groumly Oct 24 '26

Oh, that rings a bell, yes. Wait, so was it actually stored in cookies then? Or did I get confused and it was just passed in a hidden form on every damn link of every damn page?

9

u/lenswipe Oct 24 '26

no it was a hidden form field that got posted between pages

5

u/dunder_name 29d ago

that sounds like a nightmare

3

u/lenswipe 29d ago

I've never had to maintain it. But I've seen it on a few websites...

1

u/Chesterlespaul Oct 24 '26

Oh that would be so useful back in the day! Reactive state set from web requests.

133

u/n9iels Oct 23 '26

Proof that managing CSP headers is an absolute nightmare

-23

u/AyrA_ch Oct 23 '26

They could have gone with *.blob.core.windows.net to massively shorten the header.

69

u/Alikont Oct 23 '26

That's a generic domain for all Azure Blob storage accounts. So I could register my own Storage Account and get the matching url.

29

u/AyrA_ch Oct 23 '26

They also allow raw.githubusercontent.com which serves user defined files, so serving unspecified 3rd party content is not the primary concern here to not use an asterisk.

4

u/Joniator Oct 24 '26

Cant be sure, maybe they only query well known paths, then raw.githubusercontent.com would be fine, some random guys blob who controls that storagr wouldnt.

But thats grasping at straws, i dont think they had concern for anything but that was the fix for some issue they didn't understand enough to come up with a reasonable solution.

5

u/reerden Oct 23 '26

Which makes it even dumber as it’s trivial to add your own CNAME to storage accounts.

3

u/RustOnTheEdge Oct 24 '26

Which came with significant downsides back in the day. Only http or you’d need to use azure front door or something, iirc

2

u/reerden Oct 24 '26

This is still the case, but I don’t think GitHub has any issue affording front door or another content delivery service.

If you run into limitations of a single storage account that you need multiple, especially this many, then surely you can afford something like cloudflare or front door.

1

u/Online_Matter Oct 24 '26

Should they have used a reverse proxy then? 

3

u/n9iels Oct 25 '26

In terms of managing CSP headers that would be easier in theory. In praktische however, most analytics libraries have statics urls and marketing collegues don't care and will still create tickets to "whitelist absolutelyrandom.whatever.example.com".

1

u/Online_Matter Oct 25 '26

That's what I was thinking and you're painfully right. Lot of urls in the post seems to be for the same project however. 

76

u/madjoki Oct 23 '26

They forgot 20-29 and 50-99 somehow.

41

u/steeltownsquirrel Oct 23 '26

I'm off to write the first hit song in the blob.core genre

1

u/WoodyTheWorker Oct 25 '26

I'm doing it in blob.gore genre

16

u/frappucinnimon Oct 24 '26

is that why it takes an ungodly time to load

13

u/hursofid 29d ago

Yeah. I've been troubleshooting why Teams voice/video freezes on Linux and have discovered that it downloads a fucking 200-something megabytes of cookies IIRC.

Fuck microslop.

-10

u/des_the_furry 29d ago

Weak ahh OS can’t handle 200 mb 😹

9

u/hursofid 29d ago

It is not about "handling 200mb" you jerk.

-2

u/des_the_furry 29d ago

How long did it take for your PC to process that comment

4

u/alicepog 28d ago

it would happen on any OS

10

u/TheSpiffySpaceman Oct 24 '26

standard Microsoft fare, unfortunately.

I dare you to write an Azure DO extension and retain your sanity. I promise you that it's impossible.

8

u/JustinPooDough Oct 24 '26

Vibe coded 100%

4

u/andyfsu99 Oct 25 '26

Can someone ELI5 why this is this way?

5

u/GuyWithTwoThumbs 29d ago

Apparently too hard to write a proxy service to forward requests to relevant services, where you'd have to re-authenticate the user to each service as authentication cookies for each domain would not be passed by the browser to this proxy service. This is just how CSP works, and its an important security measure to have. Easier to have the client authenticate with the relevant cookies, etc. directly to the relevant services.

1

u/Hurtfulbirch 29d ago

A CSP tells the browser what 3rd party domains are allowed through. For things like fonts, scripts, images, etc. It’s to prevent xss attacks mostly, I think.

4

u/ryanmgarber 28d ago

GitHub becoming one of the buggiest, most annoying services to exist was not something I ever expected to happen and yet Microslop found a fucking way

6

u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” Oct 24 '26

Christ. And that isn't even the full list in the screenshot.

2

u/topgamer7 28d ago

I had to try to set up CSP for my work. It's a body nightmare if any of your js is third party. You have to call out every domain that code is loaded from at all

2

u/tootac 27d ago

There are bigger headers when looking just at popular sites (there are probably crazier examples):
https://hereket.com/posts/http-header-body-size/