net/http/pprof: disallow package to register to the default mux in Go 2 #42834
Labels
Milestone
Comments
/cc @rsc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
net/http/pprof
registers handlers to the default mux at init time. In order to register the handlers on a custom mux, you still have to import to package and have the debug handlers registered to the default mux. This creates the situation everyone who has a direct or transient dependency to the net/http/pprof package has the debug handles registered.This creates security issues and long-term maintenance problems where you want to 100% avoid the use of the default mux to make sure debug endpoints are never exposed to the Internet accidentally. Instead of the current model, export a new API that registers these handlers to the default mux if users want to opt in.
(I remember seeing a similar issue but couldn't find it, filing another one but please close if it's a duplicate.)
The text was updated successfully, but these errors were encountered: