Separate SYSTEM policy and verify thirteen policy guards on cloud Linux
Rust development slice / linux (push) Failing after 7s
Rust development slice / linux (push) Failing after 7s
This commit is contained in:
@@ -384,7 +384,10 @@ pub async fn plan(
|
||||
if input.targets.asset_ids.is_empty()
|
||||
|| input.targets.asset_ids.len() > 100
|
||||
|| !input.action.validate_plan_shape()
|
||||
|| !matches!(input.execution_identity.as_str(), "agent_service" | "root")
|
||||
|| !matches!(
|
||||
input.execution_identity.as_str(),
|
||||
"agent_service" | "root" | "system"
|
||||
)
|
||||
|| !(1..=3600).contains(&input.max_runtime_seconds)
|
||||
|| input.max_output_bytes == 0
|
||||
|| input.max_output_bytes > 262144
|
||||
@@ -423,8 +426,8 @@ pub async fn plan(
|
||||
let mut tx = rmm_persistence::tenant_tx(&state.pool, tenant).await?;
|
||||
policy(&mut tx).await?;
|
||||
crate::permissions::require_principal(&mut tx, p, "operations:plan").await?;
|
||||
if input.execution_identity == "root" && !p.permits_scope("root:execute") {
|
||||
return Err(Error(StatusCode::FORBIDDEN, "FORBIDDEN"));
|
||||
if let Some(permission) = crate::root_policy::execution_permission(&input.execution_identity) {
|
||||
crate::permissions::require_principal(&mut tx, p, permission).await?;
|
||||
}
|
||||
if matches!(input.action, Action::AptNativeAcceptance { .. }) {
|
||||
crate::permissions::require_principal(&mut tx, p, "apt:native_acceptance").await?;
|
||||
@@ -661,8 +664,11 @@ pub async fn submit(
|
||||
if matches!(job.payload.action, Action::QueryLogs { .. }) {
|
||||
crate::permissions::require_principal(&mut tx, p, "logs:read").await?;
|
||||
}
|
||||
if job.payload.execution_identity == "root" {
|
||||
crate::permissions::require_principal(&mut tx, p, "root:execute").await?;
|
||||
if let Some(permission) =
|
||||
crate::root_policy::execution_permission(&job.payload.execution_identity)
|
||||
{
|
||||
crate::permissions::require_principal(&mut tx, p, permission).await?;
|
||||
crate::root_policy::authorize(&mut tx, &p.name, &job.payload).await?;
|
||||
}
|
||||
if matches!(job.payload.action, Action::AptNativeAcceptance { .. }) {
|
||||
crate::permissions::require_principal(&mut tx, p, "apt:native_acceptance").await?;
|
||||
@@ -763,6 +769,11 @@ async fn authorize_http(
|
||||
return Err(fail("AUTHORIZATION_REVOKED"));
|
||||
}
|
||||
for job in &plan.jobs {
|
||||
if let Some(permission) =
|
||||
crate::root_policy::execution_permission(&job.payload.execution_identity)
|
||||
{
|
||||
crate::permissions::require_principal(&mut tx, &p, permission).await?;
|
||||
}
|
||||
crate::root_policy::authorize(&mut tx, &p.name, &job.payload).await?;
|
||||
}
|
||||
let authorization = Uuid::new_v4();
|
||||
|
||||
Reference in New Issue
Block a user