Skip to content

Commit 3ca167d

Browse files
committed
Update test cases inline docs and test case and expected result
1 parent 7a51865 commit 3ca167d

File tree

5 files changed

+13
-8
lines changed

5 files changed

+13
-8
lines changed

javascript/frameworks/ui5/src/Diagnostics/InvestigateReact.ql

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
*/
1010

1111
import javascript
12-
import semmle.javascript.frameworks.React
12+
import semmle.javascript.security.dataflow.XssThroughDomQuery
13+
import semmle.javascript.security.dataflow.XssThroughDomCustomizations
1314

14-
from ViewComponentInput v
15-
select v, v.getSourceType()
15+
from DataFlow::Node source
16+
where source instanceof XssThroughDom::Source
17+
select source, ""

javascript/frameworks/ui5/test/models/source-react/controlledcomponent.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ function ControlledComponent( { props }) {
88

99
const handleButtonPress1 = () => {
1010
// Access the input value via the hook
11-
console.log('Current input value:', inputRef1.current.value); // SOURCE
11+
console.log('Current input value:', inputRef1.current.value); // SOURCE - not detected
1212
};
1313

1414
const handleButtonPress2 = event => {
15-
setInputValue(event.target.value); // SOURCE
16-
console.log('Current input value:', inputRef2); // SOURCE - only because of setInputValue
15+
setInputValue(event.target.value); // SOURCE - detected
16+
console.log('Current input value:', inputRef2); // not directly a source
1717
};
1818

1919
return (

javascript/frameworks/ui5/test/models/source-react/functionalcomponentsetstate.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ function MyFunctionalComponent({ props }) {
44
const [count, setState] = useState({ count: 0 });
55

66
const handleClick = event => {
7-
setState({ count: event.target.value + 1 }); // Directly update the state
7+
setState({ count: event.target.value + 1 }); // SOURCE - detected as event.target.value
88
console.log('Current input value:', count);
99
};
1010

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
| controlledcomponent.tsx:15:23:15:40 | event.target.value | |
2+
| functionalcomponentsetstate.tsx:7:23:7:40 | event.target.value | |
3+
| uncontrolledcomponent.tsx:9:24:9:41 | event.target.value | |

javascript/frameworks/ui5/test/models/source-react/uncontrolledcomponent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function UncontrolledComponent({ props }) {
66

77
//direct event value access, no hook/react specific function
88
const handleClick = (event: Ui5CustomEvent<InputDomRef>) => {
9-
const finalValue = event.target.value; // SOURCE
9+
const finalValue = event.target.value; // SOURCE - detected
1010
console.log('Input finalized with value:', finalValue);
1111
};
1212

0 commit comments

Comments
 (0)