Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js

Issue 1589703002: Surface SCT (Signed Certificate Timestamp) counts in the Security panel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js
diff --git a/third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js b/third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js
index b678592b1d8e501e9c63e55d56f554d6d7047022..2bfd30f902d7d20e38570e37f379cbfc7c68683d 100644
--- a/third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js
+++ b/third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js
@@ -178,6 +178,9 @@ WebInspector.SecurityPanel.prototype = {
if (securityDetails) {
originState.securityDetails = securityDetails;
originState.certificateDetailsPromise = request.target().networkManager.certificateDetailsPromise(securityDetails.certificateId);
+
+ if (securityDetails.certificateValidationDetails)
+ originState.certificateTransparencySummaryPromise = request.target().networkManager.certificateTransparencySummaryPromise(securityDetails.certificateValidationDetails);
pfeldman 2016/01/19 17:54:49 You issue the request here, but don't claim the re
lgarron 2016/01/22 22:51:27 I want to issue the request to the proper target f
}
this._origins.set(origin, originState);
@@ -791,6 +794,48 @@ WebInspector.SecurityOriginView = function(panel, origin, originState)
var validFromString = new Date(1000 * certificateDetails.validFrom).toUTCString();
var validUntilString = new Date(1000 * certificateDetails.validTo).toUTCString();
+ var sctValue = WebInspector.UIString("-");
+ if (originState.securityDetails.certificateValidationDetails) {
+
+ var sctTypeList = [];
+ var validationDetails = originState.securityDetails.certificateValidationDetails;
pfeldman 2016/01/19 17:54:49 Extract it above the check.
lgarron 2016/01/22 22:51:28 Done.
+ if (validationDetails.numValidScts > 0)
pfeldman 2016/01/19 17:54:49 if (validationDetails.numValidScts) ...
lgarron 2016/01/22 22:51:27 *grumble* Okay, done.
+ sctTypeList.push(WebInspector.UIString("%d valid SCT%s", validationDetails.numValidScts, (validationDetails.numValidScts > 1) ? "s" : ""));
+ if (validationDetails.numInvalidScts > 0)
+ sctTypeList.push(WebInspector.UIString("%d invalid SCT%s", validationDetails.numInvalidScts, (validationDetails.numInvalidScts > 1) ? "s" : ""));
+ if (validationDetails.numUnknownScts > 0)
+ sctTypeList.push(WebInspector.UIString("%d SCT%s from unknown logs", validationDetails.numUnknownScts, (validationDetails.numUnknownScts > 1) ? "s" : ""));
+
+ var sctTypeCounts = (sctTypeList.length == 0) ? WebInspector.UIString("0 SCTs") : sctTypeList.join(", ");
pfeldman 2016/01/19 17:54:49 sctTypeList.length ? ...
lgarron 2016/01/22 22:51:28 I am checking if the list (of strings) I'm concate
+
+ if (originState.certificateTransparencySummaryPromise) {
pfeldman 2016/01/19 17:54:49 Issue the request here instead.
lgarron 2016/01/22 22:51:28 See above.
+
+ /**
+ * @param {function(string)} resolve
+ * @param {function()} reject - Unused
+ */
+ function executor(resolve, reject)
+ {
+ /**
+ * @param {function(string)} summary
+ */
+ function innerResolve(summary)
+ {
+ resolve(WebInspector.UIString("%s (%s)", summary, sctTypeCounts));
+ }
+ function innerReject()
+ {
+ resolve(sctTypeCounts);
+ }
+ originState.certificateTransparencySummaryPromise.then(innerResolve, innerReject);
+ }
+ sctValue = new Promise(executor);
pfeldman 2016/01/19 17:54:49 Why do you use promise here?
lgarron 2016/01/22 22:51:28 Removed in a refactor.
+ } else {
+ // Fall back and just display the counts.
+ sctValue = sctTypeCounts;
+ }
+ }
+
var table = new WebInspector.SecurityDetailsTable();
certificateSection.appendChild(table.element());
table.addRow("Subject", certificateDetails.subject.name);
@@ -798,8 +843,8 @@ WebInspector.SecurityOriginView = function(panel, origin, originState)
table.addRow("Valid From", validFromString);
table.addRow("Valid Until", validUntilString);
table.addRow("Issuer", certificateDetails.issuer);
+ table.addRow("SCTs", sctValue);
pfeldman 2016/01/19 17:54:49 You should only pass values into the UI components
lgarron 2016/01/22 22:51:28 I wanted to satisfy two design constraints: - Be
table.addRow("", WebInspector.SecurityPanel.createCertificateViewerButton(WebInspector.UIString("Open full certificate details"), originState.securityDetails.certificateId));
- // TODO(lgarron): Make SCT status available in certificate details and show it here.
}
function displayCertificateDetailsUnavailable ()
@@ -903,7 +948,7 @@ WebInspector.SecurityDetailsTable.prototype = {
/**
* @param {string} key
- * @param {string|!Node} value
+ * @param {string|!Node|!Promise<string>} value
pfeldman 2016/01/19 17:54:49 Resolve value prior to getting here, we try to not
lgarron 2016/01/22 22:51:28 Rather than allowing a promise to introduce asynch
*/
addRow: function(key, value)
{
@@ -911,10 +956,23 @@ WebInspector.SecurityDetailsTable.prototype = {
row.createChild("div").textContent = key;
var valueDiv = row.createChild("div");
- if (typeof value === "string") {
- valueDiv.textContent = value;
- } else {
- valueDiv.appendChild(value);
+
+ /**
+ * @param {string|!Node} value
+ */
+ function resolve(value) {
pfeldman 2016/01/19 17:54:49 By now you are formatting {} poorly.
lgarron 2016/01/22 22:51:28 Thanks for catching; some habits die hard without
+ if (typeof value === "string") {
+ valueDiv.textContent = value;
+ } else {
+ valueDiv.appendChild(value);
+ }
}
+
+ function reject() {
+ valueDiv.textContent = WebInspector.UIString("-");
+ }
+
+ // We have to modify the signature of `resolve` to work around a type checker limitation.
+ Promise.resolve(value).then(/** @type {function((string|!Node|!Promise<string>))} */(resolve), reject);
}
}

Powered by Google App Engine
This is Rietveld 408576698