-
Notifications
You must be signed in to change notification settings - Fork 904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[extensions] Add a switch to generate a publisher proof #12090
Conversation
0e5c058
to
52be4d9
Compare
52be4d9
to
f2d5b58
Compare
publisher_key = \ | ||
ReadInputKey(cmd->GetSwitchValuePath(kPublisherKeySwitch)); \ | ||
if (!publisher_key) \ | ||
return false; \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to state the fact that error_message_
will be set by ReadInputKey
in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a comment.
#include "base/command_line.h" | ||
#include "base/files/file_path.h" | ||
#include "components/crx_file/crx_creator.h" | ||
#include "components/crx_file/id_util.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
result = crx_file::CreateWithPublisherKey(output_path, zip_path, \ | ||
signing_key, publisher_key.get()); | ||
|
||
#include "src/extensions/browser/extension_creator.cc" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#undef BRAVE_CREATE_CRX
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
|
||
// Generate a publish key hash from .pem file in the format used in | ||
// crx_verifier.cc. | ||
std::vector<uint8_t> GetPublicKeyHash(const base::FilePath& pem_path) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put it into fixture or anonymous namespace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
base::FilePath CreateTestCrx() { | ||
base::ScopedAllowBlockingForTesting allow_blocking; | ||
|
||
brave::RegisterPathProvider(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
already done in the constructor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
publisher_key = \ | ||
ReadInputKey(cmd->GetSwitchValuePath(kPublisherKeySwitch)); \ | ||
if (!publisher_key) \ | ||
return false; /* error_message_ was be set by ReadInputKey() */ \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@diracdeltas @fmarier can take a quick look please?
namespace extensions { | ||
|
||
namespace { | ||
// Generate a publish key hash from .pem file in the format used in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By publish key
, do you mean a publisher key or a public key?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean a public key here: the function can fetch a public key and generate it's hash from any PEM file (not only is used for a publisher proof)
Resolves brave/brave-browser#873
This PR adds ability to add a publisher proof during packing an extension or components. This will be used on CI during signing brave components.
How to use it :
brave.exe --pack-extension=.\test-extension --pack-extension-key=.\key.pem --brave-extension-publisher-key=.\publisher.pem
Return zero if all is good.
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
,npm run lint
,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan: