Qualify atomic deny-only helper abandonment on actual Linux VM
Rust development slice / linux (push) Failing after 7s
Rust development slice / linux (push) Failing after 7s
This commit is contained in:
@@ -52,6 +52,40 @@ impl Binding {
|
||||
request: &Request,
|
||||
now: DateTime<Utc>,
|
||||
verifier: &impl Ed25519Verifier,
|
||||
) -> Result<(JobPayload, ExecutionPermitPayload)> {
|
||||
let (job, p) = self.verify_signed_request(request, verifier)?;
|
||||
ensure!(
|
||||
permit_window(&job, &p) && now >= p.not_before && now < p.start_before,
|
||||
"PERMIT_TIME"
|
||||
);
|
||||
Ok((job, p))
|
||||
}
|
||||
/// Evidence-only verification. This never supplies a current start window
|
||||
/// and cannot be substituted for verify_with at an execution boundary.
|
||||
pub fn verify_historical_for_denial_with(
|
||||
&self,
|
||||
request: &Request,
|
||||
identity: HelperIdentity,
|
||||
verifier: &impl Ed25519Verifier,
|
||||
) -> Result<VerifiedHistoricalDenial> {
|
||||
let (job, permit) = self.verify_signed_request(request, verifier)?;
|
||||
ensure!(permit_window(&job, &permit), "PERMIT_TIME");
|
||||
ensure!(
|
||||
job.execution_identity == identity.as_str()
|
||||
&& matches!(&job.action, rmm_domain::jobs::Action::SetServiceState { state, .. }
|
||||
if matches!(state.as_str(), "running" | "stopped")),
|
||||
"DENIAL_HELPER_SCOPE"
|
||||
);
|
||||
Ok(VerifiedHistoricalDenial {
|
||||
request: request.clone(),
|
||||
permit,
|
||||
request_sha256: hash(&serde_json::to_vec(request)?),
|
||||
})
|
||||
}
|
||||
fn verify_signed_request(
|
||||
&self,
|
||||
request: &Request,
|
||||
verifier: &impl Ed25519Verifier,
|
||||
) -> Result<(JobPayload, ExecutionPermitPayload)> {
|
||||
let job = self.job(&request.job_bytes)?;
|
||||
ensure!(
|
||||
@@ -91,19 +125,25 @@ impl Binding {
|
||||
&& p.max_runtime_seconds == job.max_runtime_seconds,
|
||||
"PERMIT_BINDING"
|
||||
);
|
||||
ensure!(
|
||||
p.not_before >= job.not_before
|
||||
&& p.start_before <= job.start_before
|
||||
&& p.not_before < p.start_before
|
||||
&& (p.start_before - p.not_before).num_seconds() <= 60
|
||||
&& now >= p.not_before
|
||||
&& now < p.start_before,
|
||||
"PERMIT_TIME"
|
||||
);
|
||||
Ok((job, p))
|
||||
}
|
||||
}
|
||||
|
||||
fn permit_window(job: &JobPayload, p: &ExecutionPermitPayload) -> bool {
|
||||
p.not_before >= job.not_before
|
||||
&& p.start_before <= job.start_before
|
||||
&& p.not_before < p.start_before
|
||||
&& (p.start_before - p.not_before).num_seconds() <= 60
|
||||
}
|
||||
|
||||
/// Not serializable or constructible by an IPC caller. Only the deny-only
|
||||
/// helper path consumes this evidence; it is never an execution authorization.
|
||||
pub struct VerifiedHistoricalDenial {
|
||||
pub(crate) request: Request,
|
||||
pub(crate) permit: ExecutionPermitPayload,
|
||||
pub(crate) request_sha256: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct Request {
|
||||
|
||||
Reference in New Issue
Block a user