Skip to content

Commit 824d004

Browse files
committed
Python: Convert BindToAllInterfaces test to inline expectations
1 parent 6c52de9 commit 824d004

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
Security/CVE-2018-1281/BindToAllInterfaces.ql
1+
query: Security/CVE-2018-1281/BindToAllInterfaces.ql
2+
postprocess: utils/test/InlineExpectationsTestQuery.ql

python/ql/test/query-tests/Security/CVE-2018-1281/BindToAllInterfaces_test.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22

33
# binds to all interfaces, insecure
44
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
5-
s.bind(('0.0.0.0', 31137))
5+
s.bind(('0.0.0.0', 31137)) # $ Alert[py/bind-socket-all-network-interfaces]
66

77
# binds to all interfaces, insecure
88
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
9-
s.bind(('', 4040))
9+
s.bind(('', 4040)) # $ Alert[py/bind-socket-all-network-interfaces]
1010

1111
# binds only to a dedicated interface, secure
1212
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
1313
s.bind(('84.68.10.12', 8080))
1414

1515
# binds to all interfaces, insecure
1616
ALL_LOCALS = "0.0.0.0"
17-
s.bind((ALL_LOCALS, 9090))
17+
s.bind((ALL_LOCALS, 9090)) # $ Alert[py/bind-socket-all-network-interfaces]
1818

1919
# binds to all interfaces, insecure
2020
tup = (ALL_LOCALS, 8080)
21-
s.bind(tup)
21+
s.bind(tup) # $ Alert[py/bind-socket-all-network-interfaces]
2222

2323

2424
# IPv6
2525
s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
26-
s.bind(("::", 8080)) # NOT OK
26+
s.bind(("::", 8080)) # $ Alert[py/bind-socket-all-network-interfaces]

0 commit comments

Comments
 (0)