Only allow owner read/write to credentials.toml

This commit is contained in:
Oscar Linderholm
2019-04-04 20:25:21 +02:00
parent c6668aa160
commit 65eb6c905a

View File

@@ -115,11 +115,21 @@ fn main() {
let credentials: Credentials = {
let path = config::config_path("credentials.toml");
::config::load_or_generate_default(path, authentication::create_credentials, true)
let creds =
::config::load_or_generate_default(&path, authentication::create_credentials, true)
.unwrap_or_else(|e| {
eprintln!("{}", e);
process::exit(1);
});
#[cfg(target_family = "unix")]
std::fs::set_permissions(path, std::os::unix::fs::PermissionsExt::from_mode(0o600))
.unwrap_or_else(|e| {
eprintln!("{}", e);
process::exit(1);
})
});
creds
};
let theme = theme::load(&cfg);