feat(publish): escape server name to prevent HTML injection attacks
This commit is contained in:
parent
022dbab85d
commit
820e0ab8b9
1 changed files with 79 additions and 1 deletions
|
|
@ -12,6 +12,7 @@ import (
|
|||
"github.com/modelcontextprotocol/registry/internal/database"
|
||||
"github.com/modelcontextprotocol/registry/internal/model"
|
||||
"github.com/modelcontextprotocol/registry/internal/service"
|
||||
"golang.org/x/net/html"
|
||||
)
|
||||
|
||||
// PublishHandler handles requests to publish new server details to the registry
|
||||
|
|
@ -83,11 +84,13 @@ func PublishHandler(registry service.RegistryService, authService auth.Service)
|
|||
authMethod = model.AuthMethodNone
|
||||
}
|
||||
|
||||
serverName := html.EscapeString(serverDetail.Name)
|
||||
|
||||
// Setup authentication info
|
||||
a := model.Authentication{
|
||||
Method: authMethod,
|
||||
Token: token,
|
||||
RepoRef: serverDetail.Name,
|
||||
RepoRef: serverName,
|
||||
}
|
||||
|
||||
valid, err := authService.ValidateAuth(r.Context(), a)
|
||||
|
|
|
|||
Loading…
Reference in a new issue