Skip to content

🔒 Fix Intent URL Validation & SSRF Vulnerability#32

Merged
Aatricks merged 1 commit intomainfrom
security/intent-url-validation-862430617499026646
Feb 6, 2026
Merged

🔒 Fix Intent URL Validation & SSRF Vulnerability#32
Aatricks merged 1 commit intomainfrom
security/intent-url-validation-862430617499026646

Conversation

@Aatricks
Copy link
Owner

@Aatricks Aatricks commented Feb 6, 2026

This PR addresses a security vulnerability where MainActivity blindly accepted and scraped URLs via ACTION_VIEW intents, potentially allowing malicious apps to pollute the library or trigger SSRF attacks by pointing the scraper to local network resources.

Changes:

  1. Strict Validation: Introduced UrlSecurity utility to reject private IP addresses (192.168.x.x, 10.x.x.x, etc.) and loopback addresses, ensuring the scraper only targets public web content.
  2. User Consent: Implemented ExternalUrlConfirmationDialog. When an external link is received, the app now prompts the user ("Open this link in Reader?") instead of acting immediately.
  3. No Implicit Side Effects: Removed the call to libraryViewModel.addItem in MainActivity. External links are now opened in "Preview Mode" and are not automatically saved to the persistent library database, preventing library pollution.
  4. Global Handling: Hoisted the confirmation dialog logic to MainActivity (Compose root) to ensure the dialog is visible even if the user was on a different screen (e.g., Explore) when the intent was received. Upon confirmation, the app navigates to the ReaderScreen.
  5. Tests: Added UrlSecurityTest to verify IP blocking logic.

PR created automatically by Jules for task 862430617499026646 started by @Aatricks

… confirmation

- Remove automatic library addition for external `ACTION_VIEW` intents.
- Implement `UrlSecurity` to block private IPs and non-HTTP schemes (SSRF mitigation).
- Add `ExternalUrlConfirmationDialog` to prompt user consent before loading external links.
- Hoist dialog state to `MainActivity` to ensure visibility regardless of current screen.
- Update `ReaderViewModel` to manage external URL request state.

Co-authored-by: Aatricks <113598245+Aatricks@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@Aatricks Aatricks merged commit 912e39d into main Feb 6, 2026
1 check passed
@Aatricks Aatricks self-assigned this Feb 6, 2026
@Aatricks Aatricks deleted the security/intent-url-validation-862430617499026646 branch February 6, 2026 19:06
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.

1 participant