feat: add approval bound full maintenance script console and executors
Rust development slice / linux (push) Failing after 6s
Rust development slice / linux (push) Failing after 6s
This commit is contained in:
@@ -292,6 +292,21 @@ fn windows_event_log_success_evidence(
|
||||
|
||||
// The profile records the requested process option, never an effective GPO policy.
|
||||
fn script_profile_evidence(action: &Action, evidence: &Value) -> Result<()> {
|
||||
if action.full_maintenance() {
|
||||
let Action::RunScript { script_utf8, .. } = action else {
|
||||
unreachable!()
|
||||
};
|
||||
ensure!(
|
||||
evidence["privileged_script_profile"] == "full_maintenance_v1"
|
||||
&& evidence["script_sha256"] == hash(script_utf8.as_bytes())
|
||||
&& match action.script_platform() {
|
||||
Some("linux") => evidence["execution_uid"] == 0,
|
||||
Some("windows") => evidence["execution_sid"] == "S-1-5-18",
|
||||
_ => false,
|
||||
},
|
||||
"full maintenance identity/profile evidence mismatch"
|
||||
);
|
||||
}
|
||||
if let Action::RunScript {
|
||||
script_utf8,
|
||||
windows_execution_profile: Some(WindowsExecutionProfile::PowerShell51RemoteSigned),
|
||||
@@ -411,6 +426,7 @@ mod script_profile_tests {
|
||||
arguments: vec![],
|
||||
expected_stdout: None,
|
||||
windows_execution_profile: Some(WindowsExecutionProfile::PowerShell51RemoteSigned),
|
||||
privileged_script_profile: None,
|
||||
};
|
||||
let evidence = json!({"windows_execution_profile":"powershell_51_remote_signed",
|
||||
"execution_policy":"process_remote_signed_requested", "execution_policy_requested":"RemoteSigned",
|
||||
@@ -628,7 +644,8 @@ pub async fn permit(
|
||||
if !crate::permissions::allowed(&mut tx, &approver, "plans:approve").await?
|
||||
|| !crate::permissions::allowed(&mut tx, &plan.principal, "operations:submit").await?
|
||||
|| (matches!(payload.action, Action::RunScript { .. })
|
||||
&& !crate::permissions::allowed(&mut tx, &plan.principal, "scripts:execute").await?)
|
||||
&& (!crate::permissions::allowed(&mut tx, &plan.principal, "scripts:execute").await?
|
||||
|| !crate::permissions::allowed(&mut tx, &approver, "scripts:execute").await?))
|
||||
{
|
||||
return Ok(denied("AUTHORIZATION_REVOKED"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user