Skip to content

Commit 93fe32f

Browse files
committed
Don't listen on any interface by default.
The previous default is a huge security hazard...
1 parent 441d67c commit 93fe32f

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,11 @@ REST API
1414
| Close Webpage | DELETE | http://localhost:\<port\> | |
1515

1616
By default, `<port>` is 8090
17+
18+
Environment variables
19+
---------------------
20+
21+
* `INSTANT_MARKDOWN_OPEN_TO_THE_WORLD=1` - by default, the server only listens
22+
on localhost. To make the server available to others in your network, set this
23+
environment variable to a non-empty value. Only use this setting on trusted
24+
networks!

instant-markdown-d

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,16 @@ var server = require('http').createServer(httpHandler),
1010
server,
1111
socket;
1212

13-
server.listen(8090);
13+
// WARNING: By setting this environment variable, anyone on your network may
14+
// run arbitrary code in your browser and read arbitrary files in the working
15+
// directory of the open file!
16+
if (process.env.INSTANT_MARKDOWN_OPEN_TO_THE_WORLD) {
17+
// Listen on any interface.
18+
server.listen(8090);
19+
} else {
20+
// Listen locally.
21+
server.listen(8090, '127.0.0.1');
22+
}
1423

1524
var md = new MarkdownIt({
1625
html: true,

0 commit comments

Comments
 (0)