bito-code-review[bot] commented on code in PR #40624:
URL: https://github.com/apache/superset/pull/40624#discussion_r3337721884


##########
superset-frontend/plugins/plugin-chart-ag-grid-table/test/utils/agGridFilterConverter.test.ts:
##########
@@ -771,6 +771,57 @@ describe('agGridFilterConverter', () => {
       // Should reject column names longer than 255 characters
       expect(result.simpleFilters).toHaveLength(0);
     });
+
+    test('should drop inRange bounds that are not numeric', () => {
+      const filterModel: AgGridFilterModel = {
+        age: {
+          filterType: 'number',
+          operator: 'AND',
+          condition1: {
+            filterType: 'number',
+            type: 'inRange',
+            filter: '0 AND 1=1--',
+            filterTo: '100',
+          },
+          condition2: {
+            filterType: 'number',
+            type: 'greaterThan',
+            filter: 5,
+          },
+        } as AgGridCompoundFilter,
+      };
+
+      const result = convertAgGridFiltersToSQL(filterModel);
+
+      // The malicious range condition is dropped, so its payload never reaches
+      // the WHERE clause; the sibling numeric condition is unaffected.
+      expect(result.complexWhere ?? '').not.toContain('1=1');
+      expect(result.complexWhere ?? '').not.toContain('BETWEEN');

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Weak SQL injection test assertions</b></div>
   <div id="fix">
   
   The test only asserts the malicious payload is absent but does not assert 
the valid sibling condition `age > 5` is present. The comment on lines 796-797 
claims 'the sibling numeric condition is unaffected' — verify this directly, 
e.g., `expect(result.complexWhere).toContain('age > 5')` or 
`expect(result.complexWhere).toBe('age > 5')`. See existing pattern at line 395 
for exact-match assertions, or lines 450-451 for `toContain` on compound output.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #041115</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
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