Bind approved Windows PowerShell process policy and prove Linux-first contracts
Rust development slice / linux (push) Failing after 6s

This commit is contained in:
2026-11-14 10:06:10 +01:00
parent 8a315706ea
commit abea4eb4d9
28 changed files with 1275 additions and 32 deletions
+31
View File
@@ -40,6 +40,7 @@ fn fixture() -> (Binding, Request, ExecutionPermitPayload, DateTime<Utc>) {
script_utf8: "printf 'Hello\\n'\n".into(),
arguments: vec![],
expected_stdout: Some("Hello\n".into()),
windows_execution_profile: None,
},
execution_identity: "agent_service".into(),
not_before: now - Duration::minutes(1),
@@ -170,6 +171,36 @@ fn exact_permit_bytes_time_and_all_identity_hash_bindings_are_required() {
let mut changed = request;
changed.signature.truncate(63);
assert!(binding.verify(&changed, now).is_err());
// Changing only the process policy is a payload mutation, even with the
// same script/attempt and a still valid original signature.
let (_, mut request, mut permit, _) = fixture();
let mut job: JobPayload = serde_json::from_slice(&request.job_bytes).unwrap();
job.action = Action::RunScript {
interpreter: "powershell".into(),
script_utf8: "Write-Output 'Hello'\r\n".into(),
arguments: vec![],
expected_stdout: Some("Hello\r\n".into()),
windows_execution_profile: None,
};
request.job_bytes = encode(&job).unwrap();
permit.job_payload_hash = hash(&request.job_bytes);
request.permit_bytes = encode(&permit).unwrap();
request.signature = key.sign(&request.permit_bytes).to_bytes().to_vec();
binding.verify(&request, now).unwrap();
if let Action::RunScript {
windows_execution_profile,
..
} = &mut job.action
{
*windows_execution_profile =
Some(rmm_domain::jobs::WindowsExecutionProfile::PowerShell51RemoteSigned);
}
request.job_bytes = encode(&job).unwrap();
assert!(binding.verify(&request, now).is_err());
permit.job_payload_hash = hash(&request.job_bytes);
request.permit_bytes = encode(&permit).unwrap();
request.signature = key.sign(&request.permit_bytes).to_bytes().to_vec();
binding.verify(&request, now).unwrap();
}
#[cfg(unix)]
@@ -867,6 +867,7 @@ fn script() -> Action {
script_utf8: "printf hello".into(),
arguments: vec![],
expected_stdout: Some("hello".into()),
windows_execution_profile: None,
}
}
fn success() -> ReconciledOutcome {
+1
View File
@@ -605,6 +605,7 @@ fn script() -> Action {
script_utf8: "printf hello".into(),
arguments: vec![],
expected_stdout: Some("hello".into()),
windows_execution_profile: None,
}
}
fn success() -> ReconciledOutcome {