Browse Source

fix(iot-hub): encode creatorId and type into the query string

These were the only two of the thirteen fields interpolated raw, and creatorId is not
an internal value: iot-hub-browse and the creator profile both read it straight off the
route with nothing between the URL and the request, so a crafted id could close the
parameter and append its own. The UUID shape is a convention here, not something this
code enforces.
pull/16148/head
dshvaika 2 months ago
parent
commit
edf81221ad
  1. 4
      ui-ngx/src/app/shared/models/iot-hub/iot-hub-version.models.ts

4
ui-ngx/src/app/shared/models/iot-hub/iot-hub-version.models.ts

@ -156,7 +156,7 @@ export interface MpItemVersionQueryOptions {
function filtersToQuery(o: MpItemVersionQueryOptions): string {
let query = '';
if (o.type) {
query += `&type=${o.type}`;
query += `&type=${encodeURIComponent(o.type)}`;
}
if (o.types?.length) {
query += o.types.map(t => `&type=${encodeURIComponent(t)}`).join('');
@ -165,7 +165,7 @@ function filtersToQuery(o: MpItemVersionQueryOptions): string {
query += `&peOnly=${o.peOnly}`;
}
if (o.creatorId) {
query += `&creatorId=${o.creatorId}`;
query += `&creatorId=${encodeURIComponent(o.creatorId)}`;
}
if (o.categories?.length) {
query += o.categories.map(c => `&categories=${encodeURIComponent(c)}`).join('');

Loading…
Cancel
Save