Skip to content
vetkitChecksChangelogDocumentation

vetkit.swift.storage.secret-in-user-defaults

A password, token, API key or similar secret is stored in UserDefaults / @AppStorage, which is a plain-text plist inside the app container and included in device backups.

Last updated:

Suite: Security

swift

A password, token, API key or similar secret is stored in UserDefaults / @AppStorage, which is a plain-text plist inside the app container and included in device backups.

Category: SECURITY · Engine rule severity: WARNING

How to fix it

Store secrets in the Keychain (SecItemAdd with a WhenUnlockedThisDeviceOnly accessibility class) and keep only non-sensitive preferences in UserDefaults.

References

Source: packages/engine/rules/sast/swift.yml.

Generated from shipped rule definitions at build time. Matching is a review signal, not proof of exploitability. “generic” denotes text matching, not complete language or framework coverage. Runtime configuration and available tools affect whether a rule runs.