Skip to content

Fix DatabaseViewerActivity against malicious external access and injection attacks - #4759

Draft
TranceLove wants to merge 1 commit into
hotfix/3.11.4from
bugfix/database-viewer-injection-attack
Draft

TranceLove wants to merge 1 commit into
hotfix/3.11.4from
bugfix/database-viewer-injection-attack

Conversation

@TranceLove

Copy link
Copy Markdown
Collaborator

Description

Harden database viewer against external access and injection

  • Make DatabaseViewerActivity non-exported so other apps cannot make it
    root-copy protected databases.
  • Copy root-only databases to the app-private cache dir instead of the
    shared external cache dir.
  • Quote table identifiers in PRAGMA/SELECT queries.
  • HTML-encode column names and cell values before loading into WebView.
  • Add Robolectric tests for markup escaping and non-exported activity.

Automatic tests

  • Added unit tests for specific individual functions
  • Added headless tests for new app functionality
  • Added emulator tests for new UI elements

Manual tests

  • Done

  • Device:

  • OS:

Build tasks success

Successfully running following tasks on local:

  • ./gradlew assembledebug
  • ./gradlew spotlessCheck

Generative code

  • This PR used generative code tools (GenAI, LLMs, etc.)

  • Model: Claude Sonnet

  • Version: 5.5

  • Provider: Github Copilot

Credits: Md. Raisul Islam Mobin (contact@mobin.tech / https://mobin.tech/) for spotting out the issue. Thanks!

- Make DatabaseViewerActivity non-exported so other apps cannot make it
  root-copy protected databases.
- Copy root-only databases to the app-private cache dir instead of the
  shared external cache dir.
- Quote table identifiers in PRAGMA/SELECT queries.
- HTML-encode column names and cell values before loading into WebView.
- Add Robolectric tests for markup escaping and non-exported activity.
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