Skip to main content

harden_prefs_file

Function harden_prefs_file 

Source
pub fn harden_prefs_file(app: &AppInfo, key: &str)
Expand description

Restrict the on-disk preferences_serde1 file backing key to owner-only access (Unix mode 0600), warning if it was previously reachable by other local users.

The cookie/token secret is effectively a master credential (it can forge any session and mint any token) and the persisted cookie jars hold live session cookies, so neither should be group- or world-readable. preferences_serde1 creates the file with the process umask (typically 0644); this tightens it after the fact. No-op on non-Unix platforms, whose permission model differs.