[feat] 버전 정보 js injection 구현#59
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Implements JavaScript injection in the WebView route so the embedded web app can read the native app version at runtime.
Changes:
- Import
appVersionfromservices/forceupdate. - Define an
injectedJavaScriptsnippet that setswindow.APP_VERSION. - Pass the snippet to the
WebViewviainjectedJavaScript.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| const userAgent = generateUserAgent(); | ||
|
|
||
| const injectedJavaScript = `window.APP_VERSION = "${appVersion ?? '0.0.0'}";true;`; |
There was a problem hiding this comment.
injectedJavaScript builds a JS string using "${appVersion}" without escaping. If the version ever contains quotes/backslashes (or other characters needing escaping), this will generate invalid JS and can also become an injection footgun. Prefer assigning via JSON.stringify(appVersion ?? '0.0.0') (or equivalent escaping) instead of manual quoting.
| const injectedJavaScript = `window.APP_VERSION = "${appVersion ?? '0.0.0'}";true;`; | |
| const injectedJavaScript = `window.APP_VERSION = ${JSON.stringify(appVersion ?? '0.0.0')};true;`; |
| thirdPartyCookiesEnabled={true} | ||
| sharedCookiesEnabled={true} | ||
| userAgent={userAgent} | ||
| injectedJavaScript={injectedJavaScript} |
There was a problem hiding this comment.
injectedJavaScript runs for every navigation. With originWhitelist={['*']} and onShouldStartLoadWithRequest allowing any https?:// URL, this will also inject APP_VERSION into third-party pages if the WebView ever navigates off webUrl. If the version should only be exposed to your first-party origin, gate the injected script on window.location.origin (or restrict navigation/originWhitelist accordingly).
No description provided.