Repository navigation
fix(security): prevent credential leak via external compose intent - #3089
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Exported activity callers can bypass action-based external-intent detection using an arbitrary or null action.
Review effort: Balanced
Findings: 2
Open (3)
What changed in this PR
Hardens compose-intent handling and API resource URL construction against credential leakage.
Changes:
- Sanitizes external compose intents and forces new-message mode.
- Validates API resource URLs against the Mail API origin.
- Adds malicious URL regression tests.
| File | Description |
|---|---|
ApiRoutes.kt |
Validates resource URLs and draft scheduling routes. |
NewMessageActivity.kt |
Removes internal extras from recognized external intents. |
NewMessageViewModel.kt |
Adds intent and draft-resource safeguards. |
ApiRoutesTest.kt |
Tests accepted and rejected resource paths. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
FabianDevel
force-pushed
the
fix-intent-credential-leak
branch
2 times, most recently
from
October 1, 2026 13:13
60d1ca0 to
04df191
Compare
FabianDevel
marked this pull request as ready for review
October 1, 2026 13:14
tevincent
requested changes
Oct 1, 2026
FabianDevel
force-pushed
the
fix-intent-credential-leak
branch
from
October 2, 2026 06:38
04df191 to
de49e32
Compare
Co-authored-by: FabianDevel <45429131+FabianDevel@users.noreply.github.com>
Co-authored-by: FabianDevel <45429131+FabianDevel@users.noreply.github.com>
… resource's ApiRoutes function
FabianDevel
force-pushed
the
fix-intent-credential-leak
branch
from
October 2, 2026 06:39
de49e32 to
1cd7846
Compare
|
tevincent
approved these changes
Oct 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.





Motivation
An external webpage or app could craft a browsable or external
intent:launchingNewMessageActivitywitharrivedFromExistingDraft=trueand a maliciousdraftResource(such as@attacker.example/capture). WhenfetchDraft()was invoked, raw URL concatenation inApiRoutes.resource()caused OkHttp to resolve the effective host to the attacker endpoint while attaching the user'sAuthorization: Bearertoken.Changes
NewMessageActivitynon-exported (android:exported="false"), preventing external apps and browsers from directly targeting it or injecting internal navigation extras. Moved external compose intent filters (VIEW/SENDTOformailto:,SEND/SEND_MULTIPLE) to a dedicated exportedExternalComposeActivitytrampoline that forwards only safe, allowlisted compose data (EXTRA_EMAIL,EXTRA_SUBJECT,EXTRA_TEXT,EXTRA_STREAM, etc.).NewMessageViewModel.fetchDraft(), validate thatdraftResourceis a relative path starting with/before querying the repository.ApiRoutes.resource()andrescheduleDraft(), enforce relative paths starting with/(disallowing//and/\\) and verify that the resolved URL matches the Infomaniak Mail API host, scheme, and has no userinfo.ApiRoutesTestcovering valid relative paths, userinfo injection attempts, scheme-relative URLs, and absolute URLs.