msyavuz commented on code in PR #35683:
URL: https://github.com/apache/superset/pull/35683#discussion_r2511067953


##########
superset-frontend/plugins/plugin-chart-ag-grid-table/src/AgGridTable/components/CustomHeader.tsx:
##########
@@ -102,18 +167,44 @@ const CustomHeader: React.FC<CustomHeaderParams> = ({
     else clearSort();
   };
 
-  const handleFilterClick = async (e: React.MouseEvent) => {
-    e.stopPropagation();
+  const handleFilterClick = async (e?: React.MouseEvent) => {
+    if (e) {
+      e.stopPropagation();
+    }

Review Comment:
   Can the event triggering this  be undefined?



##########
superset-frontend/plugins/plugin-chart-ag-grid-table/src/AgGridTable/components/CustomHeader.tsx:
##########
@@ -102,18 +167,44 @@ const CustomHeader: React.FC<CustomHeaderParams> = ({
     else clearSort();
   };
 
-  const handleFilterClick = async (e: React.MouseEvent) => {
-    e.stopPropagation();
+  const handleFilterClick = async (e?: React.MouseEvent) => {
+    if (e) {
+      e.stopPropagation();
+    }
     setFilterVisible(!isFilterVisible);
 
-    const filterInstance = await api.getColumnFilterInstance<any>(column);
+    const filterInstance = (await api.getColumnFilterInstance(
+      column,
+    )) as AGGridFilterInstance | null;
     const filterEl = filterInstance?.eGui;
     if (filterEl && filterRef.current) {
-      filterRef.current.innerHTML = '';
+      // Clear children safely without innerHTML to prevent XSS
+      while (filterRef.current.firstChild) {
+        filterRef.current.removeChild(filterRef.current.firstChild);
+      }

Review Comment:
   Is this necessary? There is no user input involved here



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to