Skip to content

Json file is saved in public documents folder even when setting storageJson flag is false #171

Closed

Description

@vangelis-vargas

Using the latest Segment Flutter package 1.1.7, the file analytics-flutter-queue-flushing-plugin.json is saved in the user's files directory even after setting the flag storageJson to false. The file which is easily accessible by the user includes some info like userId and the client's Segment apiKey. This is a follow up to an issue reported back in 2024:

#68
and the PR that addressed the issue
#75

If this file is absolutely necessary, it would be ideal to store this inside a private app directory instead of the public Files(iOS) directory.

Image Image

Activity

  1. changed the title [-]Json file is saved in public documents folder even when setting storageJson flag to false[/-] [+]Json file is saved in public documents folder even when setting storageJson flag is false[/+] on Jul 14, 2025
  2. vangelis-vargas commented on Aug 27, 2025

    @vangelis-vargas
    Author

    Hi team, just following up to see if anyone on Segment's side has had a chance to look into this? It's likely safe to say this is impacting more users than just us. Please let me know if you need any more information from me. thanks

  3. neelkanth-kaushik commented on Sep 2, 2025

    @neelkanth-kaushik
    Contributor

    @vangelis-vargas Yes, we are looking into this.

  4. vangelis-vargas commented on Sep 2, 2025

    @vangelis-vargas
    Author

    Thanks for the reply!

  5. added a commit that references this issue on Sep 9, 2025
  6. neelkanth-kaushik commented on Sep 10, 2025

    @neelkanth-kaushik
    Contributor

    Hello @vangelis-vargas ,

    We have fixed the issue with storageJson option in latest release version 1.1.9. Now the JSON file is created only when the storageJson is set to true.

    However, regarding the location of the JSON file, we’ve verified that on the iOS, JSON files are indeed stored in the App's sandboxed container, preventing access from outside the app.

    For instance, the analytics-flutter-queue_flushing_plugin.json is created on the following path which is App's sandbox directory:

    /Users/nk/Library/Developer/CoreSimulator/Devices/CA8FEF53-C4FD-4074-9918-BFD97E415297/data/Containers/Data/Application/C0304C4E-3EB4-4512-B4D4-C08422C0F1F7/Documents

    Apple describes this isolation clearly:

    During installation of a new app, the installer creates a number of container directories for the app inside the sandbox directory. Each container directory has a specific role. The bundle container directory holds the app’s bundle, whereas the data container directory holds data for both the app and the user. The data container directory is further divided into a number of subdirectories that the app can use to sort and organize its data.

    References: https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/Fi[…]stemOverview/FileSystemOverview.html?utm_source=chatgpt.com

    More importantly, this directory is only accessible when running in the Simulator (or if the device is jailbroken) - on a standard physical device, this path cannot be accessed due to Sandbox protections.

    Could you please share the full path shown in your screenshot and any other details so we can better understand your setup?

    Thanks.

  7. vangelis-vargas commented on Sep 11, 2025

    @vangelis-vargas
    Author

    Thanks for getting back to me. Please try these repro steps on a physical iOS device:

    1. install Splice: Make music now from the App store
    2. Launch the app
    3. Launch the Files app, and navigate to Locations > On My iPhone
    4. Open the folder Splice and you should find the file analytics-flutter-queue_flushing.json

    We have our client config set like this:

    _client = createClient(
          Configuration(segmentWriteKey, debug: false, trackApplicationLifecycleEvents: false, storageJson: false),
        );
    
  8. vangelis-vargas commented on Sep 11, 2025

    @vangelis-vargas
    Author

    Also are you able to clarify what information is contained in the info logs generated by setting debug: true? The Docs are lacking much detail as to what this setting does. Will it have any impact on viewing the events flowing through Segment's debugger?

  9. MichaelGHSeg commented on Sep 11, 2025

    @MichaelGHSeg
    Contributor

    No, logging is on device and has no impact on the Segment Debugger

    Setting debug to true enables debug level log statements in the library to be sent to the default logger or a callback if provided on initialization. It also adds a plugin that prints out detailed event information for all events that are processed to the logger.

  10. vangelis-vargas commented on Sep 15, 2025

    @vangelis-vargas
    Author

    Hey all, we updated to v1.1.9 of the flutter SDK and verified that Json files are no longer generated in the Files app when setting the storageJson flag to false. Thanks again for the fix, much appreciated. This issue can be closed as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

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