When a delta has the component that is bad, not the base, it wasn't highlighting. This is because the component failures wasn't be updated and then the certificate needed to be updated as well.

This commit is contained in:
Cyrus 2021-02-25 06:59:56 -05:00
parent 7912ff2f2e
commit 8a571f1788
2 changed files with 9 additions and 1 deletions

View File

@ -720,6 +720,8 @@ public class SupplyChainValidationServiceImpl implements SupplyChainValidationSe
base.setComponentFailures(result.getAdditionalInfo());
this.certificateManager.update(base);
}
// we are adding things to componentFailures
this.certificateManager.update(delta);
return buildValidationRecord(validationType, AppraisalStatus.Status.FAIL,
result.getMessage(), delta, Level.WARN);
case ERROR:

View File

@ -696,7 +696,7 @@ public final class SupplyChainCredentialValidator implements CredentialValidator
}
}
if (!fieldValidation) {
if (!fieldValidation || !deltaSb.toString().isEmpty()) {
return new AppraisalStatus(FAIL, resultMessage.toString(), deltaSb.toString());
}
@ -1452,6 +1452,8 @@ public final class SupplyChainCredentialValidator implements CredentialValidator
failureMsg.append(String.format(
"%s attempted MODIFIED with no prior instance.%n",
ciSerial));
delta.setComponentFailures(String.format("%s,%d",
delta.getComponentFailures(), ciV2.hashCode()));
scv = deltaMapping.get(delta);
if (scv != null
&& scv.getResult() != AppraisalStatus.Status.PASS) {
@ -1469,6 +1471,8 @@ public final class SupplyChainCredentialValidator implements CredentialValidator
failureMsg.append(String.format(
"%s attempted REMOVED with no prior instance.%n",
ciSerial));
delta.setComponentFailures(String.format("%s,%d",
delta.getComponentFailures(), ciV2.hashCode()));
scv = deltaMapping.get(delta);
if (scv != null
&& scv.getResult() != AppraisalStatus.Status.PASS) {
@ -1489,6 +1493,8 @@ public final class SupplyChainCredentialValidator implements CredentialValidator
failureMsg.append(String.format(
"%s was ADDED, the serial already exists.%n",
ciSerial));
delta.setComponentFailures(String.format("%s,%d",
delta.getComponentFailures(), ciV2.hashCode()));
scv = deltaMapping.get(delta);
if (scv != null
&& scv.getResult() != AppraisalStatus.Status.PASS) {