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

Unified Diff: chrome/browser/resources/ssl/ssl_error_assistant/gen_ssl_error_assistant_proto.py

Issue 2686173004: Add validation of sha256 hash formats to ssl_error_assistant proto generator (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/ssl/ssl_error_assistant/gen_ssl_error_assistant_proto.py
diff --git a/chrome/browser/resources/ssl/ssl_error_assistant/gen_ssl_error_assistant_proto.py b/chrome/browser/resources/ssl/ssl_error_assistant/gen_ssl_error_assistant_proto.py
index 0b546657c332483e93ce136b00a13c696b7e3ed5..2c69d28867de3aa747a3e3d6d9482f16d6d4804f 100755
--- a/chrome/browser/resources/ssl/ssl_error_assistant/gen_ssl_error_assistant_proto.py
+++ b/chrome/browser/resources/ssl/ssl_error_assistant/gen_ssl_error_assistant_proto.py
@@ -7,6 +7,7 @@
Convert the ASCII ssl_error_assistant.asciipb proto into a binary resource.
"""
+import base64
import os
import sys
@@ -29,6 +30,10 @@ class SSLErrorAssistantProtoGenerator(BinaryProtoGenerator):
def ValidatePb(self, opts, pb):
assert pb.version_id > 0
assert len(pb.captive_portal_cert) > 0
+ for cert in pb.captive_portal_cert:
+ assert(cert.sha256_hash.startswith("sha256/"))
+ decoded_hash = base64.b64decode(cert.sha256_hash[len("sha256/"):])
+ assert(len(decoded_hash) == 32)
def ProcessPb(self, opts, pb):
binary_pb_str = pb.SerializeToString()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698