Profile session token should only be readable by the user (#130)

This commit is contained in:
Ulyssa 2023-07-07 20:34:52 -07:00
parent 64891ec68f
commit 3da9835a17
No known key found for this signature in database
GPG key ID: F2873CA2997B83C5
3 changed files with 8 additions and 0 deletions

1
Cargo.lock generated
View file

@ -1527,6 +1527,7 @@ dependencies = [
"html5ever", "html5ever",
"image", "image",
"lazy_static 1.4.0", "lazy_static 1.4.0",
"libc",
"mandown", "mandown",
"markup5ever_rcdom", "markup5ever_rcdom",
"matrix-sdk", "matrix-sdk",

View file

@ -35,6 +35,7 @@ futures = "0.3"
gethostname = "0.4.1" gethostname = "0.4.1"
html5ever = "0.26.0" html5ever = "0.26.0"
image = "0.24.5" image = "0.24.5"
libc = "0.2"
markup5ever_rcdom = "0.2.0" markup5ever_rcdom = "0.2.0"
mime = "^0.3.16" mime = "^0.3.16"
mime_guess = "^2.0.4" mime_guess = "^2.0.4"

View file

@ -694,6 +694,12 @@ fn main() -> IambResult<()> {
// Load configuration and set up the Matrix SDK. // Load configuration and set up the Matrix SDK.
let settings = ApplicationSettings::load(iamb).unwrap_or_else(print_exit); let settings = ApplicationSettings::load(iamb).unwrap_or_else(print_exit);
// Set umask on Unix platforms so that tokens, keys, etc. are only readable by the user.
#[cfg(unix)]
unsafe {
libc::umask(0o077);
};
// Set up the tracing subscriber so we can log client messages. // Set up the tracing subscriber so we can log client messages.
let log_prefix = format!("iamb-log-{}", settings.profile_name); let log_prefix = format!("iamb-log-{}", settings.profile_name);
let log_dir = settings.dirs.logs.as_path(); let log_dir = settings.dirs.logs.as_path();