emscripten icon indicating copy to clipboard operation
emscripten copied to clipboard

run emrun on localhost / 127.0.0.1 by default

Open kolAflash opened this issue 1 year ago • 3 comments

Currently emrun filename.html listens to 0.0.0.0. Instead it should listen to localhost / 127.0.0.1 by default. (checked version 3.1.46)

For security reasons debugging and testing tools like emrun should not listen to possibly publicly reachable addresses.
Yes, there might be a firewall protecting public addresses. But it's better to pick safe defaults. (Yes, even the localhost address isn't extremly safe. But that will hopefully change soon)

In case it's needed emrun already has a --hostname switch where you can manually set 0.0.0.0 to listen on all addresses.

kolAflash avatar Jun 10 '24 19:06 kolAflash

Seems reasonable to me. @juj WDYT? @kolAflash would you like to send a PR? (Please add a ChangeLog entry if you do)

sbc100 avatar Jun 10 '24 21:06 sbc100

@sbc100 Can you give me a hand finding out why the pull request failed?
#22645

 

P.S.
I've another pull request which failed too. I'd be thankful if you may also have a look at it.
#22644

kolAflash avatar Sep 27 '24 13:09 kolAflash

I agree, given that we do have a --hostname=0.0.0.0 option, we would now be able to default to listening to 127.0.0.1.

I would recommend that when emrun listens to localhost/127.0.0.1, that it would print a continuation to the help message in this line https://github.com/emscripten-core/emscripten/blob/f508b432f2c1b8104ce449f4175a5217cb948b74/emrun.py#L508 , something like , if you want this server to be accessible from another device, pass --hostname=0.0.0.0 option to listen on the network.

Otherwise people might be surprised "why doesn't this work" kind of a way, and not know what to do to make it work.

juj avatar Sep 27 '24 16:09 juj