Updated the error message for no associated RIM not found, cleaned up display of the event content and adjusted the column of the digest display.

This commit is contained in:
Cyrus 2020-10-06 07:42:15 -04:00
parent b42dfb577f
commit 17728d3019
4 changed files with 34 additions and 10 deletions

View File

@ -327,6 +327,7 @@ public class SupplyChainValidationServiceImpl implements SupplyChainValidationSe
AppraisalStatus fwStatus = null; AppraisalStatus fwStatus = null;
String manufacturer = device.getDeviceInfo() String manufacturer = device.getDeviceInfo()
.getHardwareInfo().getManufacturer(); .getHardwareInfo().getManufacturer();
String model = device.getDeviceInfo().getHardwareInfo().getProductName();
ReferenceManifest baseRim = null; ReferenceManifest baseRim = null;
Set<ReferenceManifest> rims = ReferenceManifest Set<ReferenceManifest> rims = ReferenceManifest
.select(referenceManifestManager).getRIMs(); .select(referenceManifestManager).getRIMs();
@ -407,8 +408,8 @@ public class SupplyChainValidationServiceImpl implements SupplyChainValidationSe
} else { } else {
fwStatus = new AppraisalStatus(FAIL, fwStatus = new AppraisalStatus(FAIL,
String.format("Firmware validation failed: " String.format("Firmware validation failed: "
+ "No associated RIM file could be found for %s", + "No associated RIM file could be found for %s:%s",
manufacturer)); manufacturer, model));
} }
return buildValidationRecord(SupplyChainValidation.ValidationType.FIRMWARE, return buildValidationRecord(SupplyChainValidation.ValidationType.FIRMWARE,

View File

@ -40,10 +40,10 @@
<table id="eventLog"> <table id="eventLog">
<thead> <thead>
<tr class="header"> <tr class="header">
<th style="width: 5%">Event #</th> <th>Event #</th>
<th style="width: 10%">PCR Index</th> <th>PCR Index</th>
<th style="width: 20%">Event Type</th> <th style="width: 20%">Event Type</th>
<th style="width: 20%">Digest</th> <th>Digest</th>
<th style="width: 50%">Event Content</th> <th style="width: 50%">Event Content</th>
</tr> </tr>
</thead> </thead>
@ -52,11 +52,11 @@
<c:set var="count" value="1" scope="page"/> <c:set var="count" value="1" scope="page"/>
<c:forEach items="${initialData.events}" var="event"> <c:forEach items="${initialData.events}" var="event">
<tr> <tr>
<td>${count}</td> <td style="width: 75px">${count}</td>
<td>PCR${event.getPcrIndex()}</td> <td class="pcrCell">PCR${event.getPcrIndex()}</td>
<td>${event.getEventTypeStr()}</td> <td>${event.getEventTypeStr()}</td>
<td class="digestCell">${event.getEventDigestStr()}</td> <td class="digestCell">${event.getEventDigestStr()}</td>
<td class="dataCell" title="${event.getEventContentStr()}">${event.getEventContentStr()}</td> <td title="${event.getEventContentStr()}"><div style="height: 50px; overflow: auto">${event.getEventContentStr()}</div></td>
</tr> </tr>
<c:set var="count" value="${count + 1}" scope="page"/> <c:set var="count" value="${count + 1}" scope="page"/>
</c:forEach> </c:forEach>

View File

@ -46,6 +46,10 @@
} }
.digestCell { .digestCell {
max-width: 150px; max-width: 200px;
word-wrap: break-word; word-wrap: break-word;
}
.pcrCell {
max-width: 50px;
} }

View File

@ -414,7 +414,7 @@ public class TpmPcrEvent {
sb.append("Unknown Event found\n"); sb.append("Unknown Event found\n");
} }
return sb.toString(); return cleanTextContent(sb.toString());
} }
/** /**
@ -741,4 +741,23 @@ public class TpmPcrEvent {
} }
return sb.toString() + "\n"; return sb.toString() + "\n";
} }
/**
* Remove bad visual value text.
* @param text content to operate over.
* @return cleared string
*/
public String cleanTextContent(final String text) {
String result;
// strips off all non-ASCII characters
result = text.replaceAll("[^\\x00-\\x7F]", "");
// erases all the ASCII control characters
result = result.replaceAll("[\\p{Cntrl}&&[^\r\n\t]]", "");
// removes non-printable characters from Unicode
result = result.replaceAll("\\p{C}", "");
return result.trim();
}
} }