Skip to content

[Patch Tracking] react-native-nitro-sqlite+9.6.0+001+store-database-outside-documents #96649

Description

@NicolasBonet

If you haven't already, check out our contributing guidelines and patch guidelines for information on how to manage patches.


Patch Information

Library Name: react-native-nitro-sqlite
Library Version: 9.6.0
Patch Number: 001
Patch Description: store-database-outside-documents
Full Patch Filename: react-native-nitro-sqlite+9.6.0+001+store-database-outside-documents.patch

Patch Details

Reason for Patch

On iOS, the library stores SQLite databases in the app's Documents directory by default. With file sharing enabled (UIFileSharingEnabled / LSSupportsOpeningDocumentsInPlace), that directory is exposed to users through the Files app and Finder, making the Onyx database (OnyxDB.sqlite3 and its -wal/-shm journal files) visible, shareable, and deletable by users.

Changes Made

  • Databases are stored in Library/Application Support instead of Documents (persistent, backed up, never user-visible), creating the directory if it doesn't exist.
  • On startup, database files created by older app versions (prefix OnyxDB) are migrated out of Documents into Library/Application Support.

Upstream Status

Upstream PR/Issue: margelo/react-native-nitro-sqlite#289

Related Information

PR Introducing Patch: Stop exposing app data to the iOS Files app

Additional Notes

The patch as written isn't directly upstreamable because the migration hardcodes the OnyxDB filename prefix. The upstream issue proposes a generalized fix (Application Support by default with a generic migration, or a configurable base directory). If upstream adopts either, this patch can be removed — the app-specific migration would only need to remain until all installs have migrated off Documents.

Checklist

  • Patch file is correctly named and placed in the appropriate directory
  • Patch is documented in the corresponding details.md file
  • This issue is linked in the details.md file
  • Upstream PR/issue has been created (if applicable)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions