Integrate strict Windows MSI manifests tenant catalog and SYSTEM package policy
Rust development slice / linux (push) Failing after 7s
Rust development slice / linux (push) Failing after 7s
This commit is contained in:
@@ -480,3 +480,96 @@ fn completion_cas_preserves_original_bytes_and_recovers_only_verified_bound_evid
|
||||
.is_err()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn historical_msi_nonstart_keeps_full_signature_binding_and_never_becomes_root_authority() {
|
||||
use rmm_agent_core::auth::HelperIdentity;
|
||||
use rmm_domain::windows_execution::*;
|
||||
let (binding, mut request, mut permit, now) = fixture();
|
||||
let mut job: JobPayload = serde_json::from_slice(&request.job_bytes).unwrap();
|
||||
let recipe = WindowsMsiRecipe {
|
||||
schema_version: 1,
|
||||
recipe_id: MSI_RECIPE_ID.into(),
|
||||
recipe_version: "1".into(),
|
||||
platform: "windows".into(),
|
||||
upgrade_code: MSI_UPGRADE_CODE.into(),
|
||||
architecture: Architecture::X64,
|
||||
context: InstallContext::Machine,
|
||||
command_profile: MsiCommandProfile::FixtureQuietNoRebootV1,
|
||||
artifact: MsiArtifact {
|
||||
artifact_id: Uuid::from_u128(19),
|
||||
sha256: "ab".repeat(32),
|
||||
bytes: 32,
|
||||
},
|
||||
postcondition: MsiPostcondition {
|
||||
product_code: MSI_PRODUCT_CODE.into(),
|
||||
product_version: MSI_VERSION.into(),
|
||||
payload_path: MSI_PAYLOAD.into(),
|
||||
payload_sha256: MSI_PAYLOAD_10_SHA256.into(),
|
||||
payload_bytes: MSI_PAYLOAD_BYTES,
|
||||
},
|
||||
no_reboot: true,
|
||||
package_code: None,
|
||||
predecessor: None,
|
||||
};
|
||||
let manifest = ResolvedWindowsMsi {
|
||||
recipe_sha256: recipe.sha256().unwrap(),
|
||||
recipe,
|
||||
};
|
||||
job.action = Action::EnsurePackage {
|
||||
provider: "msi".into(),
|
||||
package: MSI_PACKAGE_ID.into(),
|
||||
version: MSI_VERSION.into(),
|
||||
architecture: "x64".into(),
|
||||
recipe_version: "1".into(),
|
||||
installation_context: "machine".into(),
|
||||
recipe_id: Some(MSI_RECIPE_ID.into()),
|
||||
apt_manifest: None,
|
||||
windows_msi_manifest: Some(Box::new(manifest)),
|
||||
};
|
||||
job.execution_identity = "system".into();
|
||||
request.job_bytes = encode(&job).unwrap();
|
||||
permit.action = "ensure_package".into();
|
||||
permit.execution_identity = "system".into();
|
||||
permit.job_payload_hash = hash(&request.job_bytes);
|
||||
request.permit_bytes = encode(&permit).unwrap();
|
||||
request.signature = SigningKey::from_bytes(&[9; 32])
|
||||
.sign(&request.permit_bytes)
|
||||
.to_bytes()
|
||||
.to_vec();
|
||||
binding
|
||||
.verify_historical_for_denial_with(
|
||||
&request,
|
||||
HelperIdentity::System,
|
||||
&rmm_agent_core::crypto::DalekVerifier,
|
||||
)
|
||||
.unwrap();
|
||||
assert!(
|
||||
binding
|
||||
.verify_historical_for_denial_with(
|
||||
&request,
|
||||
HelperIdentity::Root,
|
||||
&rmm_agent_core::crypto::DalekVerifier
|
||||
)
|
||||
.is_err()
|
||||
);
|
||||
assert!(binding.verify(&request, now + Duration::hours(1)).is_err()); // historical denial is never live authorization
|
||||
if let Action::EnsurePackage {
|
||||
windows_msi_manifest: Some(m),
|
||||
..
|
||||
} = &mut job.action
|
||||
{
|
||||
m.recipe.artifact.bytes += 1;
|
||||
m.recipe_sha256 = m.recipe.sha256().unwrap();
|
||||
}
|
||||
request.job_bytes = encode(&job).unwrap();
|
||||
assert!(
|
||||
binding
|
||||
.verify_historical_for_denial_with(
|
||||
&request,
|
||||
HelperIdentity::System,
|
||||
&rmm_agent_core::crypto::DalekVerifier
|
||||
)
|
||||
.is_err()
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user