Live data from Hacker News

Show HN: Redbean – Single-file distributable web server

justine.lol

231–240 of 264 posts

Re: Show HN: Redbean – Single-file distributable web server

#231

Earlier quoted context omitted.

IIRC, from vague memories of things flying past, Big Sur won't let a modified binary run once it's been checked by Gatekeeper. Which means the first run gets checked and notarised but when you add the `index.html`, the on-disk binary has changed and Gatekeeper won't allow it to run - I guess it's to prevent malicious code modifications, etc.

Its good from a security perspective, but also its a nightmare to know that the mothership knows everything you run on your machine. This will also prevent distribution from outside of their appstore giving it will prevent updates. So as anything Apple, the world security here is being used as code for personal machines remotely controlled by the mothership. You trade privacy and freedoms for a little convenience.

> This will also prevent distribution from outside of their appstore giving it will prevent updates.

I think that if an app is correctly codesigned, Gatekeeper has no issue with it. Also if it's not correctly codesigned but you've ticked "allow unsigned binaries", you can still run them.

> the mothership knows everything you run on your machine

I can't remember the details from the last time this came up but IIRC it only sends a hash and possibly even then only the first time you launch it. Either way, they're not going to block out-of-appstore distribution except if you're a known malicious actor.

Re: Show HN: Redbean – Single-file distributable web server

#232
post #78

Earlier quoted context omitted.

Thanks for the links. The discussion on the first one is interesting, it wasn't clear to me from the original doc that the UNIX version needs to overwrite itself to get to the ELF header. That's a bit unfortunate, because it means you can't share the program again after you ran it the first time on BSD or Linux. Still very clever, though. I imagine there could be a "repackage for distribution" switch added to put the…

I did the research and what we've accomplished here, while imperfect, is the best of all worlds solution. I like to think of it as an installer that takes a few microseconds, because it only needs to change 64 bytes. I've been considering adding a CLI flag where you can say ./foo.com --restore and it'll put the original 64 byte header back in place. Perhaps one day we can change the Linux, BSD, and XNU kernels so the…

Why didn't you copy to a tmpfs and overwrite that version instead?

Seems more likely to have installed programs on read-only media and a little tmpfs, instead of a writable binary and no tmpfs.

Do you have any information on some of the other strategies you researched?

Re: Show HN: Redbean – Single-file distributable web server

#233

I absolutely love reading Justine's code. It comes up from time to time here and it just makes me happy. It reminds me of the passage from "Programming Sucks" by Still Drinking [1] Every programmer occasionally, when nobody’s home, turns off the lights, pours a glass of scotch, puts on some light German electronica, and opens up a file on their computer. It’s a different file for every programmer. Sometimes they wrot…

This is too real. Except at this point, after 25 years I have probably ten of these.

Re: Show HN: Redbean – Single-file distributable web server

#234
post #156

Can someone explain this to me like I'm an 8 year old?

On most computer systems these days can select a set of files and folders and tell the computer to "Send to compressed file", the files that come out of that process usually end in ".zip", and are thus known as "zip files" This is a zip file, like any other... you can add and remove things from it. However, this ZIP file has a superpower, it can display the contents on the web... it has a web server built into it. Yo…

So... will a new browser need to be created in order for this tech to go mainstream? In the case of building a web app does this eliminate the need for a server?

Re: Show HN: Redbean – Single-file distributable web server

#237
It is all pretty good, but why there is update of "static bool" variables from signal handlers? In old-style C it must be "volatile int" (and only int), in new-style moder C it must be atomic-anything (bool is ok). But access to plain "static bool" from signal handlers & main thread is race and UB.

Re: Show HN: Redbean – Single-file distributable web server

#238

I absolutely love reading Justine's code. It comes up from time to time here and it just makes me happy. It reminds me of the passage from "Programming Sucks" by Still Drinking [1] Every programmer occasionally, when nobody’s home, turns off the lights, pours a glass of scotch, puts on some light German electronica, and opens up a file on their computer. It’s a different file for every programmer. Sometimes they wrot…

This is too real. Except at this point, after 25 years I have probably ten of these.

I've been thinking of putting together github repo which is just an index out to people's snowflakes. If I do, I'll reach out.

Re: Show HN: Redbean – Single-file distributable web server

#239
post #10

I just spent 30 minutes reading about this. I'm so shocked that I'm logging in to comment after 5 years of lurking. Justine has built a c library that allows you compile a binary once and have it run it on any os or baremetal. The SAME binary. Quite frankly, that sentence doesn't even make sense to me. Check out https://storage.googleapis.com/justine/cosmopolitan/index.ht... As far as I'm concerned, this is literal m…

While this is absolutely amazing, and I'm still trying to see if I'm even able to grok the how..

But, the paranoid in me is now curious/afraid if this approach can/will lead to multi-OS malware?

Re: Show HN: Redbean – Single-file distributable web server

#240
error:./printimage.com: check failed: 0x0 != 0x0 (0)

6ffffffffe30 0000004025db UNKNOWN

6ffffffffe40 0000004023a7 UNKNOWN

6fffffffffb0 000000401862 UNKNOWN

6ffffffffff0 000000401ed1 UNKNOWN

Run on ubuntu 14? There's nothing running on :8080. Not sure what I'm going wrong.

Post reply on HN