8000 Only listen on 127.0.0.1 not all interfaces · symfony-cli/symfony-cli@e697eb8 · GitHub
[go: up one dir, main page]

Skip to content

Commit e697eb8

Browse files
Only listen on 127.0.0.1 not all interfaces
This is a security risk, because you are exposing your application to other devices on your network if your device has no firewall configured. More importantly though it allows root free running of symfony and on macOS you will no longer get an annoying popup to allow incoming connections.
1 parent bf40c88 commit e697eb8

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

local/process/listener.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,9 @@ func CreateListener(port, preferredPort int) (net.Listener, int, error) {
3939
max = 1
4040
}
4141
for {
42-
// we really want to test availability on 127.0.0.1
4342
ln, err = net.Listen("tcp", "127.0.0.1:"+strconv.Itoa(tryPort))
4443
if err == nil {
45-
ln.Close()
46-
// but then, we want to listen to as many local IP's as possible
47-
ln, err = net.Listen("tcp", ":"+strconv.Itoa(tryPort))
48-
if err == nil {
49-
break
50-
}
44+
break
5145
}
5246
if port > 0 {
5347
return nil, 0, errors.Wrapf(err, "unable to listen on port %d", port)

0 commit comments

Comments
 (0)
0