Skip to content

Security: WebView auth token domain validation, redirect race condition, and file:// URI removal#1981

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/explore-security-vulnerabilities
Draft

Security: WebView auth token domain validation, redirect race condition, and file:// URI removal#1981
Copilot wants to merge 2 commits intomainfrom
copilot/explore-security-vulnerabilities

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 16, 2026

Three security vulnerabilities identified in a codebase audit, ranging from auth token leakage to unintended file access via exported components.

Changes

OnlyOfficeActivity — URL domain validation before auth header attachment

The ****** was attached to any URL passed via intent extra, with no origin check. Added isUrlFromTrustedDomain() that enforces HTTPS and *.infomaniak.com host before building the Authorization header. Activity finishes immediately on failure.

if (!isUrlFromTrustedDomain(url)) {
    finish()
    return@with
}
val headers = mapOf("Authorization" to "******")

OnlyOfficeActivityshouldOverrideUrlLoading race condition

popBackIfNeeded() calls finish() for out-of-pattern redirects, but view.loadUrl() was called unconditionally afterward — the rejected URL briefly loaded in the WebView. Now guarded with isFinishing.

popBackIfNeeded(redirectUrl)
if (!isFinishing) view.loadUrl(redirectUrl)

AndroidManifest.xml — Remove file:// scheme from PreviewPDFActivity

The exported PDF viewer accepted file:// URIs, bypassing ContentProvider access controls. Any app could craft an intent pointing at sensitive files on shared storage. Restricted to content:// only, which enforces proper URI permission grants.


📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

…file:// scheme removal

Co-authored-by: sirambd <28200274+sirambd@users.noreply.github.com>
Copilot AI changed the title [WIP] Explore repository for potential security vulnerabilities Security: WebView auth token domain validation, redirect race condition, and file:// URI removal Mar 16, 2026
Copilot AI requested a review from sirambd March 16, 2026 15:08
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants