Skip to content

Commit 4a17373

Browse files
committed
tests/csdiff: help csdiff to find the correct key event
The 2nd event is a key event in the following finding from Coverity: ``` Error: SOCKET_ACCEPT_ALL_ORIGINS (CWE-942): grafana-9.2.10/vendor/github.com/gorilla/websocket/server.go:302: go_socketio_all_origins: The function "function anonymous%1" always returns "true". grafana-9.2.10/vendor/github.com/gorilla/websocket/server.go:302: go_socketio_all_origins: The function "Upgrader.CheckOrigin()" always returns "true" to accept requests from all origins. grafana-9.2.10/vendor/github.com/gorilla/websocket/server.go:302: go_socketio_all_origins: Modify the "Upgrader.CheckOrigin()" function to only return "true" for trusted origins, or remove the function completely since the default "Upgrader" will only create "WebSocket" connections with clients from the same origin. ``` Related: https://issues.redhat.com/browse/OSH-552 Closes: #165
1 parent 75a2a82 commit 4a17373

5 files changed

+1
-37
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,9 +0,0 @@
1-
Error: SOCKET_ACCEPT_ALL_ORIGINS (CWE-942):
2-
grafana-9.2.10/vendor/github.com/gorilla/websocket/server.go:302: go_socketio_all_origins: The function "function anonymous%1" always returns "true".
3-
grafana-9.2.10/vendor/github.com/gorilla/websocket/server.go:302: go_socketio_all_origins: The function "Upgrader.CheckOrigin()" always returns "true" to accept requests from all origins.
4-
grafana-9.2.10/vendor/github.com/gorilla/websocket/server.go:302: go_socketio_all_origins: Modify the "Upgrader.CheckOrigin()" function to only return "true" for trusted origins, or remove the function completely since the default "Upgrader" will only create "WebSocket" connections with clients from the same origin.
5-
# 300| // don't return errors to maintain backwards compatibility
6-
# 301| }
7-
# 302|-> u.CheckOrigin = func(r *http.Request) bool {
8-
# 303| // allow all connections by default
9-
# 304| return true
Original file line numberDiff line numberDiff line change
@@ -1,9 +0,0 @@
1-
Error: SOCKET_ACCEPT_ALL_ORIGINS (CWE-942):
2-
grafana-9.2.10/vendor/github.com/gorilla/websocket/server.go:302: go_socketio_all_origins: The function "function anonymous%1" always returns "true".
3-
grafana-9.2.10/vendor/github.com/gorilla/websocket/server.go:302: go_socketio_all_origins: The function "Upgrader.CheckOrigin()" always returns "true" to accept requests from all origins.
4-
grafana-9.2.10/vendor/github.com/gorilla/websocket/server.go:302: go_socketio_all_origins: Modify the "Upgrader.CheckOrigin()" function to only return "true" for trusted origins, or remove the function completely since the default "Upgrader" will only create "WebSocket" connections with clients from the same origin.
5-
# 300| // don't return errors to maintain backwards compatibility
6-
# 301| }
7-
# 302|-> u.CheckOrigin = func(r *http.Request) bool {
8-
# 303| // allow all connections by default
9-
# 304| return true
Original file line numberDiff line numberDiff line change
@@ -1,9 +0,0 @@
1-
Error: SOCKET_ACCEPT_ALL_ORIGINS (CWE-942):
2-
grafana-9.2.10/vendor/github.com/gorilla/websocket/server.go:302: go_socketio_all_origins: The function "function anonymous%1" always returns "true".
3-
grafana-9.2.10/vendor/github.com/gorilla/websocket/server.go:302: go_socketio_all_origins: The function "Upgrader.CheckOrigin()" always returns "true" to accept requests from all origins.
4-
grafana-9.2.10/vendor/github.com/gorilla/websocket/server.go:302: go_socketio_all_origins: Modify the "Upgrader.CheckOrigin()" function to only return "true" for trusted origins, or remove the function completely since the default "Upgrader" will only create "WebSocket" connections with clients from the same origin.
5-
# 300| // don't return errors to maintain backwards compatibility
6-
# 301| }
7-
# 302|-> u.CheckOrigin = func(r *http.Request) bool {
8-
# 303| // allow all connections by default
9-
# 304| return true
Original file line numberDiff line numberDiff line change
@@ -1,9 +0,0 @@
1-
Error: SOCKET_ACCEPT_ALL_ORIGINS (CWE-942):
2-
grafana-9.2.10/vendor/github.com/gorilla/websocket/server.go:302: go_socketio_all_origins: The function "function anonymous%1" always returns "true".
3-
grafana-9.2.10/vendor/github.com/gorilla/websocket/server.go:302: go_socketio_all_origins: The function "Upgrader.CheckOrigin()" always returns "true" to accept requests from all origins.
4-
grafana-9.2.10/vendor/github.com/gorilla/websocket/server.go:302: go_socketio_all_origins: Modify the "Upgrader.CheckOrigin()" function to only return "true" for trusted origins, or remove the function completely since the default "Upgrader" will only create "WebSocket" connections with clients from the same origin.
5-
# 300| // don't return errors to maintain backwards compatibility
6-
# 301| }
7-
# 302|-> u.CheckOrigin = func(r *http.Request) bool {
8-
# 303| // allow all connections by default
9-
# 304| return true

tests/csdiff/diff-misc/19-cov-parser-key-event-new.err

+1-1
Original file line numberDiff line numberDiff line change
@@ -2811,7 +2811,7 @@ grafana-9.2.10/vendor/github.com/gorilla/websocket/compression.go:36: null_metho
28112811
# 38| }
28122812

28132813
Error: SOCKET_ACCEPT_ALL_ORIGINS (CWE-942):
2814-
grafana-9.2.10/vendor/github.com/gorilla/websocket/server.go:302: go_socketio_all_origins: The function "function anonymous%1" always returns "true".
2814+
# XXX: help csdiff to find the correct key event -- grafana-9.2.10/vendor/github.com/gorilla/websocket/server.go:302: go_socketio_all_origins: The function "function anonymous%1" always returns "true".
28152815
grafana-9.2.10/vendor/github.com/gorilla/websocket/server.go:302: go_socketio_all_origins: The function "Upgrader.CheckOrigin()" always returns "true" to accept requests from all origins.
28162816
grafana-9.2.10/vendor/github.com/gorilla/websocket/server.go:302: go_socketio_all_origins: Modify the "Upgrader.CheckOrigin()" function to only return "true" for trusted origins, or remove the function completely since the default "Upgrader" will only create "WebSocket" connections with clients from the same origin.
28172817
# 300| // don't return errors to maintain backwards compatibility

0 commit comments

Comments
 (0)