fix(drilldetail): sanitize explore URL before navigation

CodeQL flagged a DOM-XSS taint path (js/xss-through-dom) from
DashboardPageIdContext into window.location.href via generateExploreUrl.
Wrap the generated URL in sanitizeUrl(), matching the existing convention
used elsewhere for window.location.href assignments (e.g. ResultSet,
SaveDatasetModal, navigationUtils).

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
rusackas
2026-07-28 04:51:27 -07:00
parent 55cbc1be19
commit 8e936e00e7

View File

@@ -18,6 +18,7 @@
*/
import { useContext, useMemo, useState } from 'react';
import { sanitizeUrl } from '@braintree/sanitize-url';
import {
BinaryQueryObjectFilterClause,
css,
@@ -171,7 +172,7 @@ export default function DrillDetailModal({
},
);
window.location.href = url;
window.location.href = sanitizeUrl(url);
} catch (error) {
console.error('Failed to generate chart explore URL:', error);
addDangerToast(t('Failed to generate chart explore URL'));