Skip to content

Commit 7fb4797

Browse files
committed
(fix) bind metrics server to localhost interface only
Bind metrics server endpoints to 127.0.0.1 instead of all interfaces to improve security by preventing direct external access to metrics endpoints. This change supports downstream kube-rbac-proxy integration (see openshift/operator-framework-olm#1061 for more info) by ensuring metrics are only accessible locally within the pod. Signed-off-by: Anik Bhattacharjee <[email protected]>
1 parent 9cd5400 commit 7fb4797

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/lib/server/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ func (sc *serverConfig) tlsEnabled() (bool, error) {
7878

7979
func (sc *serverConfig) getAddress(tlsEnabled bool) string {
8080
if tlsEnabled {
81-
return ":8443"
81+
return "127.0.0.1:8443"
8282
}
83-
return ":8080"
83+
return "127.0.0.1:8080"
8484
}
8585

8686
func (sc serverConfig) getListenAndServeFunc() (func() error, error) {

0 commit comments

Comments
 (0)