Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
feat: Write roles fingerprints to /var/log/sysroles.jsonl [citest_skip] #892
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
feat: Write roles fingerprints to /var/log/sysroles.jsonl [citest_skip] #892
Changes from all commits
3158d71630741678da0beFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Trim only the actual overflow and handle oversized records.
_trim_log_file()receiveslen(new_line), but the required space iscur_size + len(new_line) - max_size. When the file is below the limit and records have different lengths, this removes more complete records than required. Ifnew_linealone exceedsmax_size, the function appends it and exceeds the documented maximum.Calculate the overflow before trimming. Reject or explicitly define the behavior for a single record larger than
max_log_size. Add tests for partial overflow and an oversized record.🧰 Tools
🪛 ast-grep (0.45.0)
[warning] 232-232: File path is request-/variable-derived; validate and normalize to prevent path traversal.
Context: open(log_file, "a")
Note: [CWE-22] Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
(open-filename-from-request)
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift
Prevent symlink attacks on the log and lock paths.
If a privileged play writes to a configured path in an attacker-writable directory, a local user can replace
<log_file>.lockwith a symlink. Line 224 follows that symlink and truncates its target beforeflockruns. Line 233 also follows a substitutedlog_file.Use a trusted, non-attacker-writable directory for persistence. Open both files with no-follow semantics and verify regular-file ownership before use. A no-follow open alone is not sufficient if an attacker can replace the lock pathname between writers.
Add a regression test for a symlinked lock sidecar.
🧰 Tools
🪛 ast-grep (0.45.0)
[warning] 223-223: File path is request-/variable-derived; validate and normalize to prevent path traversal.
Context: open(lock_path, "w")
Note: [CWE-22] Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
(open-filename-from-request)
[warning] 232-232: File path is request-/variable-derived; validate and normalize to prevent path traversal.
Context: open(log_file, "a")
Note: [CWE-22] Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
(open-filename-from-request)
🤖 Prompt for AI Agents
Source: Linters/SAST tools
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Escape control characters in syslog fields.
role_name,role_path, and distribution values can contain control characters. The current formatter preserves CR, LF, and NUL because it only handles spaces, quotes, and=. A newline splits the formatted fingerprint into multiple log lines and can inject misleading syslog fields.Escape control characters to visible sequences before joining the key-value pairs. Add tests that assert formatted output contains no raw CR, LF, or NUL.
🤖 Prompt for AI Agents
Uh oh!
There was an error while loading. Please reload this page.