export function isLegacyResource(): boolean {
const queryParams = new URLSearchParams(window.location.search);
return isQspValueTruthy(queryParams.get('isLegacy'));
}
export function isQspValueTruthy(value: string | null): boolean {
if (value === null) {
return false;
}
return value === '1' || value.toLowerCase() === 'true';
}
const isLegacy = isLegacyResource();
Semmle raises this warning [SM01513] User-controlled bypass of security check.
This says that I might be comparing the user-input using user controlled data. I feel the query param reading using window.location.search
is checked for truthy-ness and this is not contradicting to any security flaw.
Can someone please point out the issue and how I can mitigate this?