Skip to content

feat: open SQLite databases within the file rules when the engine app has all files access - #25

Merged
NenkaLab merged 1 commit into
masterfrom
feat/guard-sqlite
Nov 15, 2026
Merged

NenkaLab merged 1 commit into
masterfrom
feat/guard-sqlite

Conversation

@NenkaLab

Copy link
Copy Markdown
Member

What changed

  • GuardSQLiteDatabase replaces the static members of android.database.sqlite.SQLiteDatabase (final; the databases it returns stay real). SQLite opens its file and journal by path, which no host descriptor can stand in for:
    • without All files access for the engine app it throws SQLiteCantOpenDatabaseException saying to use the host db module, and warns once in the project log;
    • with it, the path is checked against the project's file rules through the host (stat, then access with read/write, or the folder for a new database) before the real SQLite opens it; refusals are reported like other paths.
    • :memory: and create/createInMemory always work.
  • GuardSession gets storageAccess (default StorageAccess.granted(): Environment.isExternalStorageManager() on Android 11+, a write check on shared storage before) and hasStorageAccess, read on every use since the user can switch it while the engine runs; warnOnce for free-form log warnings.
  • TCK: sqliteOnStorageNeedsAllFilesAccess. Parity test: final classes whose objects stay real are checked for static members only; CONFLICT_VALUES (@hide) is skipped.

Testing

  • :guard:connectedDebugAndroidTest on an API 36 x86_64 emulator: 28/28, including SQLite with and without access.
  • JavaGuardConformance 13/13 in NodeJSPlugin and the GraalJS fixture with this revision.
  • End to end with the host app: without access both engines refuse data/bot.db with the db module message and open :memory:; after granting All files access to NodeJSPlugin, data/bot.db in the project works and another bot's folder is still refused by the file rules.

🤖 Generated with Claude Code

@NenkaLab
NenkaLab merged commit d30fa72 into master Nov 15, 2026
1 check passed
@NenkaLab
NenkaLab deleted the feat/guard-sqlite branch November 15, 2026 12:40
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