You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
admin: the audit log is created 0644, so a local user can read the relay's admin history #1187
Found by: the security lens in review round 4 of job 032-admin-console-parity (round-4/review-security.md, note 3). Non-blocking there; filed so the fix is tracked rather than left in a review note.
crates/nostream-admin/src/state.rs:611 creates <config>/admin-audit.jsonl with fs::write, which yields mode 0644 in a 0755 directory. Every other file this change writes — the settings document and settings-audit.jsonl — is created 0600 (crates/nostream-config/src/store.rs:153).
Measured: the lens's probe read the audit file back as mode = 644, dir = 755 on a real config directory.
Why it matters: the audit log records admin actions with {id, at, action, remoteAddress?, detail?}. On a multi-user host, any local account can read the relay's administrative history, including the source addresses of admin logins.
Fix: create the file with OpenOptions and set_permissions(0o600) the way store.rs:153 already does, and assert the mode in the existing audit test. The directory's mode is the deployment's (it is the same config directory the settings file lives in), so the file is the part this change owns.
Oracle it inherits: a case in crates/nostream-admin/tests/ that creates the audit file through the append path and asserts mode & 0o777 == 0o600 — the shape the settings-store test already uses.
Closing: this repository's default branch is main, so Closes #N is inert on a PR targeting rewrite/main; close by hand with the merge sha.
Measured addition (round 6 of job 032-admin-console-parity, round-6/review-security.md): the remedy this issue names is necessary but not sufficient.
state.rs:522 opens admin-audit.jsonl with create+append and no set_permissions, so a fresh file is 0644 in a 0755 directory (re-measured at c2b38613 under umask 0022).
The new compaction path is a second way in: write_audit_lines (state.rs:709-725) creates the staging file with fs::write and renames it over the old one (:703), so a log hardened to 0600reads back 0644 after one compaction — the rename replaces a hardened file with an unhardened one.
So the fix has to set the mode on both paths: the append file's first creation and the staging file before the rename (as crates/nostream-config/src/store.rs:153 already does for the settings files), with the existing audit test asserting mode & 0o777 == 0o600 after an append and after a compaction that crosses the cap.
Activity
chappie-daemon commentedon Nov 19, 2026
Measured addition (round 6 of job
032-admin-console-parity,round-6/review-security.md): the remedy this issue names is necessary but not sufficient.state.rs:522opensadmin-audit.jsonlwithcreate+appendand noset_permissions, so a fresh file is 0644 in a 0755 directory (re-measured atc2b38613underumask 0022).write_audit_lines(state.rs:709-725) creates the staging file withfs::writeand renames it over the old one (:703), so a log hardened to0600reads back 0644 after one compaction — the rename replaces a hardened file with an unhardened one.So the fix has to set the mode on both paths: the append file's first creation and the staging file before the rename (as
crates/nostream-config/src/store.rs:153already does for the settings files), with the existing audit test assertingmode & 0o777 == 0o600after an append and after a compaction that crosses the cap.feat(admin): serve the console's HTTP surface from the relay's one li…