Updated the code so that the icon for firmware validation links to a RIM

This commit is contained in:
Cyrus 2023-11-29 13:35:42 -05:00
parent 8ae0745ac5
commit 6d4dad2fee
3 changed files with 12 additions and 2 deletions

View File

@ -43,6 +43,7 @@ public interface ReferenceManifestRepository extends JpaRepository<ReferenceMani
List<SupportReferenceManifest> getSupportByManufacturerModel(String manufacturer, String model); List<SupportReferenceManifest> getSupportByManufacturerModel(String manufacturer, String model);
@Query(value = "SELECT * FROM ReferenceManifest WHERE platformModel = ?1 AND DTYPE = 'EventLogMeasurements'", nativeQuery = true) @Query(value = "SELECT * FROM ReferenceManifest WHERE platformModel = ?1 AND DTYPE = 'EventLogMeasurements'", nativeQuery = true)
EventLogMeasurements getLogByModel(String model); EventLogMeasurements getLogByModel(String model);
List<ReferenceManifest> findByDeviceName(String deviceName);
List<ReferenceManifest> findByArchiveFlag(boolean archiveFlag); List<ReferenceManifest> findByArchiveFlag(boolean archiveFlag);
Page<ReferenceManifest> findByArchiveFlag(boolean archiveFlag, Pageable pageable); Page<ReferenceManifest> findByArchiveFlag(boolean archiveFlag, Pageable pageable);
} }

View File

@ -2,6 +2,7 @@ package hirs.attestationca.persist.entity.userdefined;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import hirs.attestationca.persist.entity.ArchivableEntity; import hirs.attestationca.persist.entity.ArchivableEntity;
import hirs.attestationca.persist.entity.userdefined.rim.BaseReferenceManifest;
import hirs.attestationca.persist.enums.AppraisalStatus; import hirs.attestationca.persist.enums.AppraisalStatus;
import jakarta.persistence.Column; import jakarta.persistence.Column;
import jakarta.persistence.Entity; import jakarta.persistence.Entity;
@ -104,7 +105,7 @@ public class SupplyChainValidation extends ArchivableEntity {
this.certificatesUsed = new ArrayList<>(); this.certificatesUsed = new ArrayList<>();
this.rimId = ""; this.rimId = "";
for (ArchivableEntity ae : certificatesUsed) { for (ArchivableEntity ae : certificatesUsed) {
if (ae instanceof ReferenceManifest) { if (ae instanceof BaseReferenceManifest) {
this.rimId = ae.getId().toString(); this.rimId = ae.getId().toString();
break; break;
} else { } else {

View File

@ -9,6 +9,7 @@ import hirs.attestationca.persist.entity.manager.ReferenceManifestRepository;
import hirs.attestationca.persist.entity.userdefined.Certificate; import hirs.attestationca.persist.entity.userdefined.Certificate;
import hirs.attestationca.persist.entity.userdefined.Device; import hirs.attestationca.persist.entity.userdefined.Device;
import hirs.attestationca.persist.entity.userdefined.PolicySettings; import hirs.attestationca.persist.entity.userdefined.PolicySettings;
import hirs.attestationca.persist.entity.userdefined.ReferenceManifest;
import hirs.attestationca.persist.entity.userdefined.SupplyChainValidation; import hirs.attestationca.persist.entity.userdefined.SupplyChainValidation;
import hirs.attestationca.persist.entity.userdefined.certificate.CertificateAuthorityCredential; import hirs.attestationca.persist.entity.userdefined.certificate.CertificateAuthorityCredential;
import hirs.attestationca.persist.entity.userdefined.certificate.ComponentResult; import hirs.attestationca.persist.entity.userdefined.certificate.ComponentResult;
@ -187,6 +188,13 @@ public class ValidationService {
final SupplyChainValidation.ValidationType validationType final SupplyChainValidation.ValidationType validationType
= SupplyChainValidation.ValidationType.FIRMWARE; = 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, AppraisalStatus result = FirmwareScvValidator.validateFirmware(device, policySettings,
rimRepo, rdvRepo, caRepo); rimRepo, rdvRepo, caRepo);
Level logLevel; Level logLevel;
@ -203,7 +211,7 @@ public class ValidationService {
logLevel = Level.ERROR; logLevel = Level.ERROR;
} }
return buildValidationRecord(validationType, result.getAppStatus(), return buildValidationRecord(validationType, result.getAppStatus(),
result.getMessage(), null, logLevel); result.getMessage(), baseRim, logLevel);
} }
/** /**