Skip to content

Commit fd7c019

Browse files
authored
chore(coderd): require api key to access derpmap (#8569)
1 parent a823ce7 commit fd7c019

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

coderd/coderd.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,14 @@ func New(options *Options) *API {
727727
r.Post("/azure-instance-identity", api.postWorkspaceAuthAzureInstanceIdentity)
728728
r.Post("/aws-instance-identity", api.postWorkspaceAuthAWSInstanceIdentity)
729729
r.Post("/google-instance-identity", api.postWorkspaceAuthGoogleInstanceIdentity)
730-
r.Get("/connection", api.workspaceAgentConnectionGeneric)
730+
r.With(
731+
apiKeyMiddlewareOptional,
732+
httpmw.ExtractWorkspaceProxy(httpmw.ExtractWorkspaceProxyConfig{
733+
DB: options.Database,
734+
Optional: true,
735+
}),
736+
httpmw.RequireAPIKeyOrWorkspaceProxyAuth(),
737+
).Get("/connection", api.workspaceAgentConnectionGeneric)
731738
r.Route("/me", func(r chi.Router) {
732739
r.Use(httpmw.ExtractWorkspaceAgent(httpmw.ExtractWorkspaceAgentConfig{
733740
DB: options.Database,

0 commit comments

Comments
 (0)