Skip to content

Commit 4042030

Browse files
committed
fixup! [cr138] Unsafe SHA256HashString variant deleted
1 parent f118fe2 commit 4042030

File tree

2 files changed

+29
-5
lines changed

2 files changed

+29
-5
lines changed

components/brave_user_agent/browser/brave_user_agent_component_installer.cc

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include <string>
1010
#include <vector>
1111

12-
#include "base/base64.h"
1312
#include "base/functional/bind.h"
1413
#include "base/functional/callback.h"
1514
#include "brave/components/brave_component_updater/browser/brave_on_demand_updater.h"
@@ -64,10 +63,8 @@ BraveUserAgentComponentInstallerPolicy::BraveUserAgentComponentInstallerPolicy()
6463
: component_id_(kBraveUserAgentExceptionsComponentId),
6564
component_name_(kBraveUserAgentExceptionsComponentName) {
6665
// Generate hash from public key.
67-
auto decoded_public_key =
68-
base::Base64Decode(kBraveUserAgentExceptionsComponentBase64PublicKey);
69-
CHECK(decoded_public_key);
70-
component_hash_ = crypto::SHA256Hash(*decoded_public_key);
66+
component_hash_ =
67+
crypto::SHA256Hash(kBraveUserAgentExceptionsComponentPublicKey);
7168
}
7269

7370
BraveUserAgentComponentInstallerPolicy::

components/brave_user_agent/browser/brave_user_agent_component_installer.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,33 @@ inline constexpr char kBraveUserAgentExceptionsComponentBase64PublicKey[] =
2626
"oqe8tiCJBZN1n0usDuOV2/"
2727
"xPc2QAJxCPk4AMVZ3bi0N0GjVwyrdPHiuPttniF83fxpjGQG2aZFDfRv8IkX0VJ9pYXkIcZac1"
2828
"Gpo8vsnG7fHSm6NN/g7LdJuG7NMRUFM6dzgK1HwWyEwIDAQAB";
29+
inline constexpr uint8_t kBraveUserAgentExceptionsComponentPublicKey[] = {
30+
0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
31+
0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00,
32+
0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0x9d, 0x93, 0x39,
33+
0xce, 0x5a, 0x2c, 0x16, 0xa2, 0x7e, 0x48, 0x9f, 0x39, 0x2b, 0x5f, 0xb9,
34+
0xc9, 0x9c, 0xee, 0xbd, 0x39, 0x31, 0x28, 0x34, 0x50, 0xde, 0x8f, 0x8c,
35+
0x05, 0x10, 0xa6, 0x46, 0x92, 0x2b, 0x4f, 0x80, 0xe1, 0x62, 0xe8, 0x58,
36+
0xf3, 0xd5, 0xfe, 0xd0, 0x3b, 0x20, 0xb1, 0xb5, 0x63, 0x30, 0xea, 0xfc,
37+
0x57, 0x71, 0x9e, 0x03, 0x36, 0x59, 0x27, 0x5d, 0x49, 0xbd, 0x05, 0xa3,
38+
0x93, 0xb2, 0x25, 0x30, 0x06, 0x91, 0x8f, 0x1e, 0x07, 0xad, 0x60, 0xc3,
39+
0xc7, 0xb0, 0x25, 0x38, 0xe6, 0xd7, 0x36, 0x5a, 0x5c, 0xa3, 0xa1, 0x36,
40+
0xbe, 0xea, 0x95, 0x20, 0xc0, 0xec, 0xc3, 0x54, 0xdb, 0x85, 0xa0, 0x05,
41+
0x64, 0xda, 0xac, 0xe4, 0xcd, 0x2f, 0x51, 0x48, 0x31, 0xbf, 0xdf, 0x48,
42+
0x6c, 0x60, 0xf6, 0x0d, 0xbe, 0xa5, 0xd9, 0xf4, 0x38, 0x72, 0xbc, 0xf4,
43+
0xd4, 0xec, 0x1c, 0x14, 0xad, 0xa0, 0x3b, 0xd1, 0x0f, 0xa8, 0x58, 0x11,
44+
0x4f, 0x7d, 0xdc, 0xc2, 0x19, 0x6e, 0xd5, 0x49, 0xdb, 0xca, 0x67, 0x95,
45+
0xe2, 0x07, 0xd1, 0xe0, 0x0f, 0xa8, 0xa9, 0xef, 0x2d, 0x88, 0x22, 0x41,
46+
0x64, 0xdd, 0x67, 0xd2, 0xeb, 0x03, 0xb8, 0xe5, 0x76, 0xff, 0x13, 0xdc,
47+
0xd9, 0x00, 0x09, 0xc4, 0x23, 0xe4, 0xe0, 0x03, 0x15, 0x67, 0x76, 0xe2,
48+
0xd0, 0xdd, 0x06, 0x8d, 0x5c, 0x32, 0xad, 0xd3, 0xc7, 0x8a, 0xe3, 0xed,
49+
0xb6, 0x78, 0x85, 0xf3, 0x77, 0xf1, 0xa6, 0x31, 0x90, 0x1b, 0x66, 0x99,
50+
0x14, 0x37, 0xd1, 0xbf, 0xc2, 0x24, 0x5f, 0x45, 0x49, 0xf6, 0x96, 0x17,
51+
0x90, 0x87, 0x19, 0x69, 0xcd, 0x46, 0xa6, 0x8f, 0x2f, 0xb2, 0x71, 0xbb,
52+
0x7c, 0x74, 0xa6, 0xe8, 0xd3, 0x7f, 0x83, 0xb2, 0xdd, 0x26, 0xe1, 0xbb,
53+
0x34, 0xc4, 0x54, 0x14, 0xce, 0x9d, 0xce, 0x02, 0xb5, 0x1f, 0x05, 0xb2,
54+
0x13, 0x02, 0x03, 0x01, 0x00, 0x01,
55+
};
2956

3057
// Registers the BraveUserAgent component with the component updater.
3158
void RegisterBraveUserAgentComponent(

0 commit comments

Comments
 (0)