Use AppraisalStatus.additionalInfo as a flag to indicate when a EventMeasurement rim is needed.

This commit is contained in:
chubtub 2024-08-08 10:14:45 -04:00
parent a41b0f2fe4
commit 2e3af24ada
3 changed files with 17 additions and 10 deletions

View File

@ -105,7 +105,7 @@ public class SupplyChainValidation extends ArchivableEntity {
this.certificatesUsed = new ArrayList<>();
this.rimId = "";
for (ArchivableEntity ae : certificatesUsed) {
if (ae instanceof BaseReferenceManifest rm) {
if (ae instanceof ReferenceManifest rm) {
this.rimId = rm.getId().toString();
break;
} else if (ae instanceof Certificate) {

View File

@ -190,16 +190,22 @@ public class ValidationService {
final SupplyChainValidation.ValidationType validationType
= SupplyChainValidation.ValidationType.FIRMWARE;
List<ReferenceManifest> rims = rimRepo.findByDeviceName(device.getName());
ReferenceManifest baseRim = null;
for (ReferenceManifest rim : rims) {
if (rim.getRimType().equals(ReferenceManifest.BASE_RIM)) {
baseRim = rim;
}
}
AppraisalStatus result = FirmwareScvValidator.validateFirmware(device, policySettings,
rimRepo, rdvRepo, caRepo);
Level logLevel;
List<ReferenceManifest> rims = rimRepo.findByDeviceName(device.getName());
ReferenceManifest referenceManifest = null;
String rimType = "";
if (result.getAdditionalInfo().equals(ReferenceManifest.MEASUREMENT_RIM)) {
rimType = ReferenceManifest.MEASUREMENT_RIM;
} else {
rimType = ReferenceManifest.BASE_RIM;
}
for (ReferenceManifest rim : rims) {
if (rim.getRimType().equals(rimType)) {
referenceManifest = rim;
}
}
switch (result.getAppStatus()) {
case PASS:
@ -213,7 +219,7 @@ public class ValidationService {
logLevel = Level.ERROR;
}
return buildValidationRecord(validationType, result.getAppStatus(),
result.getMessage(), baseRim, logLevel);
result.getMessage(), referenceManifest, logLevel);
}
/**

View File

@ -270,7 +270,8 @@ public class FirmwareScvValidator extends SupplyChainCredentialValidator {
fwStatus = new AppraisalStatus(FAIL, String.format("%s%n%s",
fwStatus.getMessage(), sb.toString()));
} else {
fwStatus = new AppraisalStatus(FAIL, sb.toString());
fwStatus = new AppraisalStatus(FAIL,
sb.toString(), ReferenceManifest.MEASUREMENT_RIM);
}
}
}