Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server: ensure correct authorization for debug pages #16341

Merged
merged 1 commit into from Jun 6, 2017

Conversation

BramGruneir
Copy link
Member

Up until now, they have been wide open regardless of the cluster settings.

@BramGruneir BramGruneir added this to the 1.1 milestone Jun 5, 2017
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@tamird
Copy link
Contributor

tamird commented Jun 5, 2017

I think you can do this without all the duplication if you use a middleware pattern: write a function that returns a http.HandlerFunc which wraps a passed-in http.HandlerFunc with this authentication logic. Then do all the wrapping in server/server.go where you register all the handlers.

@petermattis
Copy link
Collaborator

These need to be tested. See acceptance/debug_remote_test.go.


Review status: 0 of 5 files reviewed at latest revision, all discussions resolved, all commit checks successful.


Comments from Reviewable

@BramGruneir
Copy link
Member Author

@tamird Good call. Done.
@petermattis. Done.


Review status: 0 of 3 files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@BramGruneir
Copy link
Member Author

Review status: 0 of 3 files reviewed at latest revision, 1 unresolved discussion.


pkg/server/server.go, line 849 at r1 (raw file):

	s.mux.Handle(statusPrefix, gwMux)
	s.mux.Handle("/health", gwMux)
	s.mux.Handle(statusVars, authorizedHandler(http.HandlerFunc(s.status.handleVars)))

Should statusVars be protected as well? Seems like it should be.


Comments from Reviewable

@mberhault
Copy link
Contributor

Review status: 0 of 3 files reviewed at latest revision, 1 unresolved discussion, all commit checks successful.


pkg/server/server.go, line 849 at r1 (raw file):

Previously, BramGruneir (Bram Gruneir) wrote…

Should statusVars be protected as well? Seems like it should be.

Probably not, we still want monitoring to work and shouldn't be exporting metrics with sensitive information.
Even if we do protect it, does that mean we want to disable metrics reporting when we add push-type metrics (eg: graphite)?


Comments from Reviewable

@petermattis
Copy link
Collaborator

:lgtm: modulo not doing auth for the status vars.


Review status: 0 of 3 files reviewed at latest revision, 2 unresolved discussions, all commit checks successful.


pkg/server/server.go, line 854 at r1 (raw file):

	s.mux.Handle(certificatesDebugEndpoint, authorizedHandler(http.HandlerFunc(s.status.handleDebugCertificates)))
	s.mux.Handle(networkDebugEndpoint, authorizedHandler(http.HandlerFunc(s.status.handleDebugNetwork)))
	s.mux.Handle(nodesDebugEndpoint, authorizedHandler(http.HandlerFunc(s.status.handleDebugNodes)))

It might be the case that these could have been added to debugServeMux instead of s.mux. Maybe. Probably not worth changing now.


Comments from Reviewable

Up until now, they have been wide open regardless of the cluster settings.
@BramGruneir
Copy link
Member Author

Review status: 0 of 3 files reviewed at latest revision, 2 unresolved discussions.


pkg/server/server.go, line 849 at r1 (raw file):

Previously, mberhault (marc) wrote…

Probably not, we still want monitoring to work and shouldn't be exporting metrics with sensitive information.
Even if we do protect it, does that mean we want to disable metrics reporting when we add push-type metrics (eg: graphite)?

Done.


pkg/server/server.go, line 854 at r1 (raw file):

Previously, petermattis (Peter Mattis) wrote…

It might be the case that these could have been added to debugServeMux instead of s.mux. Maybe. Probably not worth changing now.

noted. Since I'm going to be moving a lot of these to /_status/ with the move to the admin ui, it might be moot.


Comments from Reviewable

@BramGruneir BramGruneir merged commit 98ac3c3 into cockroachdb:master Jun 6, 2017
@BramGruneir BramGruneir deleted the security branch June 6, 2017 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants