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

Unified Diff: extensions/browser/verified_contents.cc

Issue 585583003: Fix case-sensitivity problems in extension content verification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: undo change to extension_protocols.cc Created 6 years, 3 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 | « extensions/browser/verified_contents.h ('k') | extensions/browser/verified_contents_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/verified_contents.cc
diff --git a/extensions/browser/verified_contents.cc b/extensions/browser/verified_contents.cc
index 47c94662a166ca18d999ef9a32992318d9b4e9ad..f55abc91ad538359b4904b90e8633d516a656372 100644
--- a/extensions/browser/verified_contents.cc
+++ b/extensions/browser/verified_contents.cc
@@ -186,8 +186,9 @@ bool VerifiedContents::InitFrom(const base::FilePath& path,
return false;
base::FilePath file_path =
base::FilePath::FromUTF8Unsafe(file_path_string);
- root_hashes_[file_path] = std::string();
- root_hashes_[file_path].swap(root_hash);
+ RootHashes::iterator i = root_hashes_.insert(std::make_pair(
+ base::StringToLowerASCII(file_path.value()), std::string()));
+ i->second.swap(root_hash);
}
break;
@@ -195,14 +196,36 @@ bool VerifiedContents::InitFrom(const base::FilePath& path,
return true;
}
+bool VerifiedContents::HasTreeHashRoot(
+ const base::FilePath& relative_path) const {
+ base::FilePath::StringType path = base::StringToLowerASCII(
+ relative_path.NormalizePathSeparatorsTo('/').value());
+ return root_hashes_.find(path) != root_hashes_.end();
+}
+
+bool VerifiedContents::TreeHashRootEquals(const base::FilePath& relative_path,
+ const std::string& expected) const {
+ base::FilePath::StringType path = base::StringToLowerASCII(
+ relative_path.NormalizePathSeparatorsTo('/').value());
+ for (RootHashes::const_iterator i = root_hashes_.find(path);
+ i != root_hashes_.end();
+ ++i) {
+ if (expected == i->second)
+ return true;
+ }
+ return false;
+}
+
+#if 0
const std::string* VerifiedContents::GetTreeHashRoot(
Ken Rockot(use gerrit already) 2014/09/26 18:48:13 Do you really want to keep this around for some re
asargent_no_longer_on_chrome 2014/09/26 18:51:55 No.
const base::FilePath& relative_path) {
- std::map<base::FilePath, std::string>::const_iterator i =
+ RootHashes::const_iterator i =
root_hashes_.find(relative_path.NormalizePathSeparatorsTo('/'));
if (i == root_hashes_.end())
return NULL;
return &i->second;
}
+#endif
// We're loosely following the "JSON Web Signature" draft spec for signing
// a JSON payload:
« no previous file with comments | « extensions/browser/verified_contents.h ('k') | extensions/browser/verified_contents_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698