1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-23 07:19:41 +02:00

fix(aeec): enforce non-empty EdgeIDs for global key environment retrieval EE-3013 (#6808)

This commit is contained in:
andres-portainer 2022-04-25 11:35:14 -03:00 committed by GitHub
parent bcec6a8915
commit 5b77edb76d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 0 deletions

View file

@ -1,6 +1,7 @@
package endpoints
import (
"errors"
"net/http"
httperror "github.com/portainer/libhttp/error"
@ -21,6 +22,9 @@ type endpointCreateGlobalKeyResponse struct {
// @router /endpoints/global-key [post]
func (handler *Handler) endpointCreateGlobalKey(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
edgeID := r.Header.Get(portainer.PortainerAgentEdgeIDHeader)
if edgeID == "" {
return httperror.BadRequest("Invalid Edge ID", errors.New("the Edge ID cannot be empty"))
}
// Search for existing endpoints for the given edgeID