Skip to content

Support for encryption of shared preferences #593

@QuintinWillison

Description

@QuintinWillison

We persist secrets (e.g. ABLY_DEVICE_SECRET) and tokens (e.g. ABLY_DEVICE_IDENTITY_TOKEN) to SharedPreferences without encryption or any other form of obfuscation, in terms of both values and the keys they are stored under.

This has been raised by a customer who discovered this when doing a security test after they "rooted" their app.

When Ably first implemented LocalDevice storage, there wasn't anything we deemed suitable that would give any material increase in security, hence the implementation was kept simple.

Perhaps the best solution going forward would be to allow app developers to override the storage I/O in order to provide their own encryption and/or platform service designed for secrets. Such a provider might be as simple as:

interface Storage {
    void write(String key, String value);
    String read(String key, String defaultValue);
}

We would provide a default implementation using shared preferences, as we do currently.

I would also suggest we look at fixing #562 when we work on this as it's in the same area of the codebase.

Metadata

Metadata

Assignees

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