1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-18 14:47:03 +00:00

trace: Remove restriction on tracing pages

By default, golang.org/x/net/trace currently only allows the tracing
pages to be seen from localhost.

This restriction can be confusing for people accessing the monitoring
server remotely, and adds no value in our environment.

The monitoring server already exports very sensitive information, and
must be enabled with care, and is not on by default. This is well
documented.

This patch removes the restriction, making all the monitoring pages
equally accessible.
This commit is contained in:
Alberto Bertogli
2021-06-11 23:29:52 +01:00
parent cfe0e48c0a
commit f137702f23

View File

@@ -3,6 +3,7 @@ package trace
import ( import (
"fmt" "fmt"
"net/http"
"strconv" "strconv"
"blitiri.com.ar/go/log" "blitiri.com.ar/go/log"
@@ -10,6 +11,15 @@ import (
nettrace "golang.org/x/net/trace" nettrace "golang.org/x/net/trace"
) )
func init() {
// golang.org/x/net/trace has its own authorization which by default only
// allows localhost. This can be confusing and limiting in environments
// which access the monitoring server remotely.
nettrace.AuthRequest = func(req *http.Request) (any, sensitive bool) {
return true, true
}
}
// A Trace represents an active request. // A Trace represents an active request.
type Trace struct { type Trace struct {
family string family string