Insecure local storage

From thejefflarson/soundcheck · View interactive version

Insecure local storage is an AI agent skill from the GitHub repository thejefflarson/soundcheck. Detects sensitive data written to unprotected local files, preference stores, or SQLite. Use when writing code that stores sensitive data (credentials, tokens, PII) to local files, platform preference stores (NSUserDefaults, SharedPreferences, UserDefaults), SQLite databases, or localStorage without

How to use this skill

Skill file

Insecure Local Data Storage (A02:2025)

What this checks

Detects sensitive data written to unprotected local storage. Cleartext storage lets any

process with file-system access, or a device backup restore, harvest credentials and

tokens without authentication.

Vulnerable patterns

Fix immediately

Flag the vulnerable code and explain the risk. Translate the principles below to the

audited file's platform and language — use that platform's documented secure-storage

API (keychain, EncryptedSharedPreferences, DPAPI, HttpOnly cookie, etc.).

For each finding, establish these properties:

  1. **Sensitive values go to platform-managed secure storage, not a plain file or

pref store.** OS keychain, Android EncryptedSharedPreferences, Windows DPAPI

or Credential Manager, Linux secret service. These encrypt at rest and scope

access to the owning process.

  1. **Web clients do not store long-lived credentials in localStorage or

sessionStorage.** These are readable by any script on the origin — one XSS

and the token is gone. Use a Secure, HttpOnly, SameSite cookie for session

tokens, or a short-lived in-memory token refreshed from the server.

  1. **If secure storage is unavailable, data is encrypted with a key that also

lives in secure storage** — not hardcoded, not in the same file, not derived

from device-static values. Symmetric encryption with a keychain-held key is

the baseline.

  1. Temp files for sensitive data are avoided, or created with restrictive

user-only permissions, written to a user-only directory, and deleted in a

finally/cleanup block — never left in a world-writable directory with default

permissions.

Verification

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.