Skip to content

Commit 1584155

Browse files
committed
escape name and id of entities
Signed-off-by: Robert Landers <landers.robert@gmail.com>
1 parent bd0dbea commit 1584155

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

cli/lib/api.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"io"
2020
"math/rand"
2121
"net/http"
22+
"net/url"
2223
"os"
2324
"slices"
2425
"strconv"
@@ -327,9 +328,24 @@ func Startup(ctx context.Context, js jetstream.JetStream, logger *zap.Logger, po
327328
}
328329

329330
vars := mux.Vars(request)
331+
332+
// url decode the name
333+
escapedName, err := url.QueryUnescape(vars["name"])
334+
if err != nil {
335+
http.Error(writer, "Internal Server Error", http.StatusInternalServerError)
336+
logger.Error("Failed to url decode name", zap.Error(err))
337+
return
338+
}
339+
escapedId, err := url.QueryUnescape(vars["id"])
340+
if err != nil {
341+
http.Error(writer, "Internal Server Error", http.StatusInternalServerError)
342+
logger.Error("Failed to url decode id", zap.Error(err))
343+
return
344+
}
345+
330346
id := &glue.EntityId{
331-
Name: strings.TrimSpace(vars["name"]),
332-
Id: strings.TrimSpace(vars["id"]),
347+
Name: escapedName,
348+
Id: escapedId,
333349
}
334350

335351
ctx := getCorrelationId(ctx, &request.Header, nil)

0 commit comments

Comments
 (0)