[medium] semgrep: A password, token or key is kept in @AppStorage, which stores it in UserDefaults, an unencrypted plist in the app… #912

Closed
opened 2026-11-05 20:13:37 +00:00 by pruefwerk · 2 comments
Member

medium Finding

Scanner: semgrep
Severity: medium
Rule: cra-ai-14-swift-secret-in-appstorage
CWE: CWE-312
CRA: cra-ai-14 — Speicher-Schutz (Data at Rest) (Annex I)

Description

A password, token or key is kept in @AppStorage, which stores it in UserDefaults, an unencrypted plist in the app container that backups and device extraction read (CWE-312). Store it in the Keychain instead.

Location

File: compliance-agent/rules/cra_semgrep_swift.swift (line 25)

Code

    @AppStorage("refreshToken") var refreshToken: String = ""

Remediation

Exclude rule fixture/example paths from secret-storage scans or move examples out of production paths.


Fingerprint: 1ef7fc62cefdac321d23ddabfb6f4e4328532b2f715683ff03905ff76a8cac09
Generated by compliance-scanner
Open in Prüfwerk / In Prüfwerk öffnen

## medium Finding **Scanner:** semgrep **Severity:** medium **Rule:** cra-ai-14-swift-secret-in-appstorage **CWE:** CWE-312 **CRA:** cra-ai-14 — Speicher-Schutz (Data at Rest) (Annex I) ### Description A password, token or key is kept in @AppStorage, which stores it in UserDefaults, an unencrypted plist in the app container that backups and device extraction read (CWE-312). Store it in the Keychain instead. ### Location **File:** `compliance-agent/rules/cra_semgrep_swift.swift` (line 25) ### Code ``` @AppStorage("refreshToken") var refreshToken: String = "" ``` ### Remediation Exclude rule fixture/example paths from secret-storage scans or move examples out of production paths. --- *Fingerprint:* `1ef7fc62cefdac321d23ddabfb6f4e4328532b2f715683ff03905ff76a8cac09` *Generated by compliance-scanner* [Open in Prüfwerk / In Prüfwerk öffnen](https://pruefwerk.breakpilot.com/findings?target=6ae9aa2160f5d8045fc570a7)
pruefwerk added the severity:mediumcra:annex-ipruefwerk labels 2026-11-05 20:13:37 +00:00
Author
Member

Prüfwerk: Die Datei liegt in Testdaten (z. B. fixtures/ oder testdata/), die von der Prüfung ausgenommen sind.

The file lies in test data (such as fixtures/ or testdata/), which is left out of the scan.

**Prüfwerk:** Die Datei liegt in Testdaten (z. B. fixtures/ oder testdata/), die von der Prüfung ausgenommen sind. The file lies in test data (such as fixtures/ or testdata/), which is left out of the scan.
Author
Member

Prüfwerk: Die Datei liegt in Testdaten (z. B. fixtures/ oder testdata/), die von der Prüfung ausgenommen sind.

The file lies in test data (such as fixtures/ or testdata/), which is left out of the scan.

**Prüfwerk:** Die Datei liegt in Testdaten (z. B. fixtures/ oder testdata/), die von der Prüfung ausgenommen sind. The file lies in test data (such as fixtures/ or testdata/), which is left out of the scan.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: platform/pruefwerk#912