diff --git a/.jules/sentinel.md b/.jules/sentinel.md new file mode 100644 index 0000000..5e48b43 --- /dev/null +++ b/.jules/sentinel.md @@ -0,0 +1,4 @@ +## 2024-05-20 - WebView XSS Prevention +**Vulnerability:** String interpolation used in `injectJavaScript` to pass data to a WebView, allowing potential Cross-Site Scripting (XSS). +**Learning:** Even with stringified JSON, `injectJavaScript` executes the result directly in the context of the page, potentially allowing attackers to execute arbitrary JavaScript if the input contains malicious escape sequences. +**Prevention:** Use `webViewRef.current.postMessage(data)` and listen for the `message` event inside the WebView (`window.addEventListener('message', ...)`). diff --git a/src/screens/HomeScreen.tsx b/src/screens/HomeScreen.tsx index 8475bcb..e841fee 100644 --- a/src/screens/HomeScreen.tsx +++ b/src/screens/HomeScreen.tsx @@ -42,6 +42,22 @@ const weatherMap: Record = { const engineHtml = `