Recheck the submitting principal and protect stored log output

This commit is contained in:
2026-11-18 10:10:06 +01:00
parent db2f5b407d
commit 0f15f91f65
16 changed files with 788 additions and 209 deletions
+19 -4
View File
@@ -184,7 +184,12 @@ fn classification_cannot_be_bypassed_by_another_scope_or_empty_env() {
other.agent_id = job.agent_id;
other.principals = vec!["another-actor".into()];
policy.scopes.push(other);
assert!(policy.sensitive_log_unit(&job, "rmm-acceptance.service", Some(&[])));
assert!(sensitive_log_unit(
Some(&policy),
&job,
"rmm-acceptance.service",
Some(&[])
));
for unit in [
"ssh.service",
"sshd.service",
@@ -192,10 +197,20 @@ fn classification_cannot_be_bypassed_by_another_scope_or_empty_env() {
"auditd.service",
"systemd-logind.service",
] {
assert!(policy.sensitive_log_unit(&job, unit, Some(&[])));
assert!(sensitive_log_unit(Some(&policy), &job, unit, Some(&[])));
}
assert!(policy.sensitive_log_unit(&job, "custom.service", Some(&["custom.service".into()])));
assert!(!policy.sensitive_log_unit(&job, "ordinary.service", None));
assert!(sensitive_log_unit(
Some(&policy),
&job,
"custom.service",
Some(&["custom.service".into()])
));
assert!(!sensitive_log_unit(
Some(&policy),
&job,
"ordinary.service",
None
));
}
#[test]
fn permissions_are_separate_root_read_and_sensitive_requirements() {