mirror of
https://github.com/telemt/telemt.git
synced 2026-11-02 05:42:00 +03:00
Runtime paths symlink preserved + User Admission Registration
This commit is contained in:
+1
-1
@@ -67,7 +67,7 @@ impl BoundedFileAppender {
|
||||
let start = now();
|
||||
let current_path = active_path_for(&dir, &base_name, options.rotation, &start);
|
||||
#[cfg(unix)]
|
||||
let dir_fd = crate::util::secure_fs::open_dir_nofollow_or_create(&dir, 0o750)?;
|
||||
let dir_fd = crate::util::secure_fs::open_trusted_dir_nofollow_or_create(&dir, 0o750)?;
|
||||
#[cfg(unix)]
|
||||
let (file, current_size) = open_append_file(&dir_fd, ¤t_path)?;
|
||||
#[cfg(not(unix))]
|
||||
|
||||
@@ -123,3 +123,24 @@ fn rotation_stays_bound_to_opened_directory_after_path_replacement() {
|
||||
assert!(!matching_logs(&moved).is_empty());
|
||||
assert!(matching_logs(&redirect).is_empty());
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn appender_rejects_group_writable_log_directory() {
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
|
||||
let current = std::env::current_dir().unwrap();
|
||||
let dir = tempfile::Builder::new()
|
||||
.prefix("telemt-untrusted-log-")
|
||||
.tempdir_in(current)
|
||||
.unwrap();
|
||||
fs::set_permissions(dir.path(), fs::Permissions::from_mode(0o770)).unwrap();
|
||||
|
||||
assert!(
|
||||
BoundedFileAppender::with_now(
|
||||
options(dir.path().join("telemt.log")),
|
||||
Box::new(fixed_now),
|
||||
)
|
||||
.is_err()
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user