Skip to content

Spoof or remove X-Requested-With header from webview#1812

Merged
AntsyLich merged 6 commits intomihonapp:mainfrom
AwkwardPeak7:webview
Mar 2, 2025
Merged

Spoof or remove X-Requested-With header from webview#1812
AntsyLich merged 6 commits intomihonapp:mainfrom
AwkwardPeak7:webview

Conversation

@AwkwardPeak7
Copy link
Copy Markdown
Contributor

  • fix the webview detection in getPackageName to correctly detect it and return a spoofed package (thanks to @vetleledaal)
  • spoofed package will be com.android.chrome (google chrome) or in some cases when it isn't installed, com.android.settings
    • this needs to be a valid installed package, otherwise the app crashes
  • override shouldInterceptRequest of the webview to use okhttp for making the calls and being able to remove the header completely
    • this isn't called for post or xhr/fetch calls in js so spoofed package name is needed

closes #1659

Comment thread core/common/src/main/kotlin/eu/kanade/tachiyomi/util/system/WebViewUtil.kt Outdated
Comment thread core/common/src/main/kotlin/eu/kanade/tachiyomi/network/NetworkHelper.kt Outdated
Comment thread app/src/main/java/eu/kanade/presentation/webview/WebViewScreenContent.kt Outdated
Comment thread app/src/main/java/eu/kanade/presentation/webview/WebViewScreenContent.kt Outdated
@AntsyLich AntsyLich merged commit 793d7fb into mihonapp:main Mar 2, 2025
@AwkwardPeak7 AwkwardPeak7 deleted the webview branch March 2, 2025 15:51
cuong-tran pushed a commit to komikku-app/komikku that referenced this pull request Mar 3, 2025
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Mar 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WebView: X-Requested-With sends the app package name to the host

2 participants