src/cap_portal.rs:249-253
🟡 中
当 dirs::cache_dir() 返回 None 时,回退到 /tmp/wl-webrtc/portal-restore-token。/tmp 是全局共享的临时目录,多用户运行时路径相同,导致:
dirs::cache_dir()
None
/tmp/wl-webrtc/portal-restore-token
/tmp
另外,/tmp 中的文件在系统重启后会被清理,使令牌无法持久化,违背了 PersistMode::ExplicitlyRevoked 的设计意图。
PersistMode::ExplicitlyRevoked
回退路径应包含 UID 以保证用户隔离:
fn token_path() -> PathBuf { let base = dirs::cache_dir().unwrap_or_else(|| { let uid = unsafe { libc::getuid() }; PathBuf::from(format!("/tmp/wl-webrtc-{uid}")) }); base.join("portal-restore-token") }
No dependencies set.
The note is not visible to the blocked user.
位置
src/cap_portal.rs:249-253严重性
🟡 中
问题描述
当
dirs::cache_dir()返回None时,回退到/tmp/wl-webrtc/portal-restore-token。/tmp是全局共享的临时目录,多用户运行时路径相同,导致:另外,
/tmp中的文件在系统重启后会被清理,使令牌无法持久化,违背了PersistMode::ExplicitlyRevoked的设计意图。建议修复
回退路径应包含 UID 以保证用户隔离: