diff --git a/.jules/sentinel.md b/.jules/sentinel.md new file mode 100644 index 0000000..8a19e4d --- /dev/null +++ b/.jules/sentinel.md @@ -0,0 +1,4 @@ +## 2024-05-01 - XSS in WebView +**Vulnerability:** Use of `injectJavaScript` to pass user-provided base64 images to WebView in `HomeScreen.tsx` and `ShiftScreen.tsx` introduces XSS risk. +**Learning:** React Native developers often use `injectJavaScript` with string interpolation for passing data, which can execute arbitrary JS if the string isn't sanitized perfectly. The memory correctly points out we should use `postMessage` instead. +**Prevention:** Avoid `injectJavaScript` for data transfer. Use `postMessage` from React Native to WebView, and set up a `message` listener inside the WebView's HTML string. diff --git a/src/screens/HomeScreen.tsx b/src/screens/HomeScreen.tsx index 7779ce3..80be29d 100644 --- a/src/screens/HomeScreen.tsx +++ b/src/screens/HomeScreen.tsx @@ -35,6 +35,17 @@ const HOME_REST_TIMING = { startHour: 12, startMinute: 0, endHour: 14, endMinute const engineHtml = `