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

Unified Diff: chrome/browser/ui/webui/net_internals_ui.cc

Issue 6793026: Initial support for HSTS certificate locking. This isn't a finished work, but (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 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: chrome/browser/ui/webui/net_internals_ui.cc
===================================================================
--- chrome/browser/ui/webui/net_internals_ui.cc (revision 80114)
+++ chrome/browser/ui/webui/net_internals_ui.cc (working copy)
@@ -16,6 +16,7 @@
#include "base/path_service.h"
#include "base/string_number_conversions.h"
#include "base/string_piece.h"
+#include "base/string_split.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
@@ -1065,6 +1066,8 @@
result->SetBoolean("subdomains", state.include_subdomains);
result->SetBoolean("preloaded", state.preloaded);
result->SetString("domain", state.domain);
+ result->SetString("cert_locks",
+ JoinString(state.cert_locks, ','));
}
}
}
@@ -1074,7 +1077,7 @@
void NetInternalsMessageHandler::IOThreadImpl::OnHSTSAdd(
const ListValue* list) {
- // |list| should be: [<domain to query>, <include subdomains>].
+ // |list| should be: [<domain to query>, <include subdomains>, <cert locks>].
std::string domain;
CHECK(list->GetString(0, &domain));
if (!IsStringASCII(domain)) {
@@ -1084,6 +1087,8 @@
}
bool include_subdomains;
CHECK(list->GetBoolean(1, &include_subdomains));
+ std::string cert_locks_str;
+ CHECK(list->GetString(2, &cert_locks_str));
net::TransportSecurityState* transport_security_state =
context_getter_->GetURLRequestContext()->transport_security_state();
@@ -1093,6 +1098,18 @@
net::TransportSecurityState::DomainState state;
state.expiry = state.created + base::TimeDelta::FromDays(1000);
state.include_subdomains = include_subdomains;
+ state.cert_locks.clear();
+ if (!cert_locks_str.empty()) {
+ std::vector<std::string> cert_locks;
+ base::SplitString(cert_locks_str, ',', &cert_locks);
+ std::vector<std::string>::const_iterator i = cert_locks.begin();
+ for (; i != cert_locks.end(); ++i) {
+ std::string lock = *i;
+ RemoveChars(lock, " \t\r\n", &lock);
+ StringToUpperASCII(&lock);
+ state.cert_locks.push_back(lock);
+ }
+ }
transport_security_state->EnableHost(domain, state);
}

Powered by Google App Engine
This is Rietveld 408576698