Skip to content
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

Rebase on top of v1.3.36.111 #36

Closed
wants to merge 164 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
164 commits
Select commit Hold shift + click to select a range
9f6e3cc
Update ServerProtocolV3.md
jpawlicki Sep 23, 2020
11ad44f
Fix paths in .gitignore. It does not look like ** is needed since
sorinj Sep 17, 2020
a894ca2
C++ compliance fixes for VC 16.7.3.
sorinj Sep 18, 2020
61c270a
Libzip 1.7.3 compatibility fix for the Omaha Open Source build.
sorinj Sep 17, 2020
cac998a
Restrict ACLs on the crash handler named pipe.
sorinj Sep 17, 2020
a6997b2
TargetChannel policy for Google Update.
sorinj Sep 17, 2020
69b144b
Enable DM code for TargetChannel policy changes for Google Update.
sorinj Sep 17, 2020
ea9d453
Add Updater Version and the last checked time to IPolicyStatus2.
sorinj Sep 17, 2020
cf736ac
Add Enterprise detection of MDM enrolled machines.
sorinj Sep 17, 2020
76d79fa
Add Google Update support for Azure AD joined machines.
sorinj Sep 17, 2020
f5c124d
Report ExtraCode1 for install success.
sorinj Sep 17, 2020
70afa04
Report Policy Source via Policy Status COM interface.
sorinj Sep 17, 2020
4561ae5
PolicyStatus COM changes: Service Host, OnDemand, User Omaha support.
sorinj Sep 17, 2020
5d486b3
Fix *GetPackageCache* unit tests.
sorinj Sep 17, 2020
ffce302
Change Domain detection for Group Policy.
sorinj Sep 18, 2020
fb73a05
Increase the limit of file size for signature verification.
sorinj Sep 18, 2020
5c467d9
Increase the size of read buffer for hash verification in Omaha.
sorinj Sep 18, 2020
0deb4cb
Improve the user experience when downloading large files in Omaha.
sorinj Sep 18, 2020
9cea6e0
Add new IPolicyStatus2 interface; Support multiple policy source fall…
sorinj Sep 24, 2020
53a7e1f
Fix broken WebServicesClientTest.SendUsingCup test.
sorinj Sep 24, 2020
6b3f12d
Omaha must not upload usagestats.
sorinj Sep 24, 2020
2ae994b
Update SaveArguments.exe file.
sorinj Sep 24, 2020
9fe61bd
Fix OmahaCustomizationTest*.* for the open source build.
sorinj Sep 25, 2020
64ea375
Refactor proxy detection policies, and expose via IPolicyStatus2.
sorinj Sep 25, 2020
f10078a
Fix NetworkConfigPolicyTest unit tests.
sorinj Sep 28, 2020
f8c4d6b
Update VERSION to 1.3.36.31.
sorinj Sep 28, 2020
9c0fe7b
Update DeveloperSetupGuide.md
sorinj Sep 28, 2020
ab3d202
Search for DLLs only in System32 folder.
Oct 1, 2020
cbef35a
Use LOAD_LIBRARY_SEARCH_SYSTEM32 when loading system dlls
Oct 2, 2020
dd9902e
Use ::LoadLibraryEx instead of ::LoadLibraryEx{A,W}.
sorinj Oct 2, 2020
89cba16
Merge branch 'master' into m36
sorinj Oct 5, 2020
1b49906
Update VERSION to 1.3.36.41
sorinj Oct 5, 2020
d3b6a94
Integrate changes in certificate_tag{_test}.go from google3 to google…
sorinj Nov 19, 2020
0d5dff2
Update README to reflect support for MSI files in Omaha's certificate…
sorinj Nov 19, 2020
dee55cd
Integrate changes to Omaha's certificate tagger to the googleclient d…
sorinj Nov 19, 2020
935694a
Integrate print-tag-details in Omaha cert tagger from google3 to goog…
sorinj Nov 19, 2020
c84e1b3
Integrate change to support reading from mini stream for Omaha taggin…
sorinj Nov 19, 2020
de20d3a
Enable Omaha to read tag from the superfluous certificate in the MSI …
sorinj Nov 19, 2020
354ccce
Apply wait before DM registration.
sorinj Nov 19, 2020
7a84e55
Use LOAD_LIBRARY_SEARCH_SYSTEM32 only when available.
sorinj Nov 19, 2020
7f564ca
Merge branch 'master' into m36
sorinj Nov 19, 2020
7213974
Update VERSION
sorinj Nov 19, 2020
910c0c8
Make update3web_demo.js available in the open source build.
sorinj Nov 24, 2020
907189e
Change the signing servers in Omaha OSS build.
sorinj Jan 15, 2021
e3d8903
Omaha: Support Windows "High Contrast" modes.
sorinj Jan 16, 2021
4d0e033
Display Progress Text in the Title Bar.
sorinj Jan 16, 2021
4375aa6
Omaha Enterprise: DMPolicyManager fallback not accurate in some cases
sorinj Jan 16, 2021
17d3874
Remove the Helper MSI and MSP from Omaha3.
sorinj Jan 16, 2021
7411d09
Send DM policy validation errors back to DM server.
sorinj Jan 16, 2021
2be1861
Use CreateProcess instead of ShellExecute for background process laun…
sorinj Jan 16, 2021
f17f51a
Use new SimpleRequest for each DM error report.
sorinj Jan 17, 2021
42262d6
Update SaveArguments.exe file.
sorinj Jan 19, 2021
00de9ef
Make update3web_demo.js available in the open source build.
sorinj Nov 24, 2020
c1ebdc0
Change the signing servers in Omaha OSS build.
sorinj Jan 15, 2021
6223a61
Omaha: Support Windows "High Contrast" modes.
sorinj Jan 16, 2021
494441c
Display Progress Text in the Title Bar.
sorinj Jan 16, 2021
7a41309
Omaha Enterprise: DMPolicyManager fallback not accurate in some cases
sorinj Jan 16, 2021
4030526
Remove the Helper MSI and MSP from Omaha3.
sorinj Jan 16, 2021
fbf6550
Send DM policy validation errors back to DM server.
sorinj Jan 16, 2021
6d8b9a8
Use CreateProcess instead of ShellExecute for background process laun…
sorinj Jan 16, 2021
d3219b5
Use new SimpleRequest for each DM error report.
sorinj Jan 17, 2021
a736bd0
Update SaveArguments.exe file.
sorinj Jan 19, 2021
0530e7e
Update VERSION to 1.3.36.61.
sorinj Jan 19, 2021
005dca4
base/security: Spelling correction in README
linux4life798 Dec 29, 2020
9d27eec
Fix Chrome standalone installer fails: GoogleUpdateHelper.msi is miss…
sorinj Jan 20, 2021
53b0f81
Fix Chrome standalone installer fails: GoogleUpdateHelper.msi is miss…
sorinj Jan 20, 2021
169a4f1
Fix memory leak when DM network request is not sent.
sorinj Jan 23, 2021
bece74c
Fix crash in omaha::goopdate_utils::StartGoogleUpdateWithArgs at line…
sorinj Jan 23, 2021
918c6b3
base/security: Spelling correction in README
linux4life798 Dec 29, 2020
84676e9
Fix memory leak when DM network request is not sent.
sorinj Jan 23, 2021
f48c139
Fix crash in omaha::goopdate_utils::StartGoogleUpdateWithArgs at line…
sorinj Jan 23, 2021
3c3ae48
Update VERSION to 1.3.36.71.
sorinj Jan 23, 2021
b6477e1
Fix flag parsing in certificate_tag_test; add Windows example
roander-msft Mar 5, 2021
2b781c4
Remove binary name; windows can run a non-exe executable just fine
roander-msft Mar 5, 2021
38918b4
Fallback to checking HasGoopdateTaskEverRun if last exit code != TASK…
roander-msft Mar 1, 2021
a6874ed
Cleanup exe after ping test
roander-msft Mar 10, 2021
018ef8c
EXPECT_SUCCEEDED the File::Remove for safety
roander-msft Mar 11, 2021
ca6106b
Fix comment line length to <= 80 chars.
sorinj Mar 18, 2021
ef91287
Validate Omaha policy values before accepting.
sorinj Mar 23, 2021
45c6994
Code refactor for Omaha policy validation:
sorinj Mar 23, 2021
e0e3c13
Add PROGRAMFILESDIR support to Chrome's msi installer.
sorinj Mar 23, 2021
08a3ebb
Fix hidden ProgramFileDirSubstitution property.
sorinj Mar 23, 2021
ad7d568
Remove dead code related to the MSI Helper.
sorinj Mar 24, 2021
fae9f4f
DM: Only update the cached information if the server returns a valid …
sorinj Mar 24, 2021
0db1d40
Rollback of Add PROGRAMFILESDIR support to Chrome's msi installer.
sorinj Mar 24, 2021
e3ae43a
Remove code that uninstalls the Legacy MSI helper.
sorinj Mar 24, 2021
90aac3a
Fix Downgrade to a more stable channel via TargetChannel does not work.
sorinj Mar 24, 2021
0c91b50
Typo error when calculating the aggregated error report status.
sorinj Mar 24, 2021
83918d1
Deploy Enterprise Applications via Omaha
sorinj Mar 25, 2021
7e4e2ab
Update the DM unit tests to account for the new InstallDefaultValue e…
sorinj Apr 1, 2021
1e9e412
Added DM support for deploying Enterprise Applications via Omaha.
sorinj Apr 1, 2021
62934df
Fixed unit test for DM support for deploying Enterprise Applications …
sorinj Apr 1, 2021
35ae40d
Fixed some unit tests to account for DM changes.
sorinj Apr 1, 2021
768cf32
Add a default application name to the apps within the Force Install B…
sorinj Apr 1, 2021
bfe7e00
Single sign test MSIs
roander-msft Apr 8, 2021
82246da
MsiTagExtractorTest: read unittest_support files from direct relative…
roander-msft Apr 8, 2021
e6ab647
Fix Security Arbitrary file read when caching file CallAsSelfAndImper…
sorinj Apr 1, 2021
30f4e74
Better error handling: Do not delete reparse points.
sorinj Apr 1, 2021
8c25006
Enterprise App Deployment: Separate ForceInstall controls for User an…
sorinj Apr 28, 2021
101e4e9
Fix formatting for the Group Policy adm/admx templates.
sorinj Apr 28, 2021
45cd1fc
Merge remote-tracking branch 'origin/master' into m36
sorinj Apr 28, 2021
2f015d5
Update VERSION to 1.3.36.81
sorinj Apr 28, 2021
557fa14
Expose Enterprise App Deployment forceInstallApps policies via new in…
sorinj Apr 28, 2021
5284d03
Omaha DM Registration: add serial number in the registration
sorinj Apr 28, 2021
b8f0aa6
Omaha DM Registration: add serial number in the policy fetch
sorinj Apr 29, 2021
2c53d93
Omaha should not use cached policies if DMtoken is removed
sorinj Apr 29, 2021
533fc37
Fix DeviceManagementTest_RollbackToTargetVersion fails.
sorinj Apr 29, 2021
80af318
Delete cached policies when no valid DM token is available.
sorinj Apr 29, 2021
f90fc58
Change the default value of the "Auto-update check period override" p…
sorinj Apr 29, 2021
3f3cc1c
Update SaveArguments.exe file.
sorinj Apr 30, 2021
a6db762
2021 CUP key rotation.
sorinj Apr 30, 2021
510b036
Build a branded test_foo_v1.0.101.0.msi; rip out dead test/build.scons
roander-msft Apr 28, 2021
0d9965c
take change from upstream pull 265
roander-msft Apr 28, 2021
e52004e
Verify registry key/value exists: fixes updater crash in debug mode
mmxw11 May 29, 2021
83a9084
Update GitHub URLs which have moved.
fmarier Jun 8, 2021
2d721e3
remove unused includes in com_register_shell.cc
roander-msft Jun 8, 2021
3c9350a
remove unused libs in ComRegisterShell build target
roander-msft Jun 8, 2021
549ff7b
Update ClientLog.md
GitHubGanesh Jun 16, 2021
3ec84c7
Security: Local Elevation of Privilege vulnerability in Google Update…
sorinj Jun 2, 2021
3b84490
Update the description of Omaha's "Auto-update check period override"…
sorinj Jul 15, 2021
9a1e353
Fix Race condition leads to lack of policy control
sorinj Jul 15, 2021
bc589c2
Fix unit test failures.
sorinj Jul 16, 2021
688ca03
BITS: More logging and fallback faster on error
sorinj Jul 16, 2021
52027cc
Report the current version "pv" for new installs and over-installs.
sorinj Jul 16, 2021
e0e37ac
Remove unneeded assert.
sorinj Jul 16, 2021
d323920
Take 2: Report the current version "pv" for new installs and over-ins…
sorinj Jul 16, 2021
c574492
Fix unit test.
sorinj Jul 16, 2021
4ad20ad
Added signature and validation for the new SHA256 certificate.
sorinj Jul 16, 2021
eebc8b6
Merge branch 'master' into m36
sorinj Jul 19, 2021
c3e5207
Update VERSION to 1.3.36.91
sorinj Jul 19, 2021
d89f66e
Disable calling ::EnterCriticalPolicySection/::LeaveCriticalPolicySec…
sorinj Jul 28, 2021
e0a83e9
Revert sending the current version "pv" for over-installs
sorinj Jul 28, 2021
8bb0325
Switch to the new SHA256 certificate.
sorinj Jul 28, 2021
47d3fbd
Update VERSION to 1.3.36.101 in Github.
sorinj Aug 9, 2021
d3a217f
Update SaveArguments.exe file.
sorinj Jul 29, 2021
236f33a
C++ compliance changes for VS2019 v16.10.4.
sorinj Aug 4, 2021
db26f4d
Updated VS supported version to 16.10.4
sorinj Aug 4, 2021
8c8c34b
Fix flaky tests due to group policy preloading.
sorinj Jul 21, 2021
bca4649
Update VERSION to 1.3.99.0
sorinj Jul 29, 2021
6e8209b
Extend Authenticode signature verification (#296)
mherrmann Aug 9, 2021
8185cf8
Fix LNK2019 unresolved external ArenaStringPtr::SetLite.
sorinj Aug 11, 2021
1bdfa07
Sort base:libprotobuf cc_sources lexically.
sorinj Aug 11, 2021
93ee34d
Update DeveloperSetupGuide.md
sorinj Aug 11, 2021
bce6408
Update DeveloperSetupGuide.md
sorinj Aug 11, 2021
26d2254
Update DeveloperSetupGuide.md
sorinj Aug 11, 2021
a24b466
Update ClientUpdateProtocolEcdsa.md
jpawlicki Sep 20, 2021
e19e78d
Fix Take Group Policy Critical Section to prevent race conditions
sorinj Sep 22, 2021
b1b6c95
A test tool for interacting with the Update3Web interfaces.
sorinj Sep 22, 2021
9a71adf
[py3] Use range instead of xrange.
sorinj Sep 23, 2021
4d327c9
Python3 fixes for Omaha builds scripts.
sorinj Sep 23, 2021
a6c4f41
Fix crbug/1245879: Security: Incomplete fix for CVE-2021-30577
sorinj Oct 19, 2021
b6d5380
Enable Omaha logging to file even in the absence of a GoogleUpdate.ini.
sorinj Oct 19, 2021
a264706
Update VERSION to 1.3.36.111 in Github.
sorinj Oct 20, 2021
af7bedf
Rebase Brave's changes on top of v1.3.36.111
mherrmann Nov 3, 2021
ba3f2ab
Fix build by removing obsolete build arg
mherrmann Nov 11, 2021
58fb86e
Fetch submodules in build_omaha.py
mherrmann Nov 11, 2021
28f0b94
Use DEPS file instead of Git submodules
mherrmann Nov 12, 2021
f01b153
Fix DEPS
mherrmann Nov 12, 2021
d82d7c7
Add zlib to DEPS file
mherrmann Nov 15, 2021
1e0b82d
Remove ClickOnce
mherrmann Nov 16, 2021
20c4a9b
Remove hammer-brave.bat
mherrmann Nov 16, 2021
f8f0622
Update VERSION for testing
mherrmann Nov 17, 2021
b6153c0
Fix patch number in VERSION for testing
mherrmann Nov 17, 2021
a199d4a
Revert VERSION to 1.3.361.111 for prod
mherrmann Nov 17, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
.vscode/
omaha/common/omaha_customization_proxy_clsid.h
omaha/proxy_clsids.txt
omaha/scons-out/**
third_party/breakpad/**
third_party/googletest/**
third_party/libzip/**
omaha/scons-out/
omaha/standalone/*
third_party/lzma/files/**/obj/
third_party/zlib/**
63 changes: 63 additions & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.

import("//brave/build/config.gni")

assert(is_win)

group("omaha") {
deps = [ ":build_omaha_installer" ]
}

action("build_omaha_installer") {
script="build_omaha.py"

inputs = [ "build_omaha.py" ]

sources = [ "$root_out_dir/$brave_installer_exe" ]

_install_switch = ""
_tag_app_name = "Brave-Release"
if (brave_channel == "beta") {
_install_switch = "--chrome-beta"
_tag_app_name = "Brave-Browser-Beta"
} else if (brave_channel == "dev") {
_install_switch = "--chrome-dev"
_tag_app_name = "Brave-Browser-Dev"
} else if (brave_channel == "nightly") {
_install_switch = "--chrome-sxs"
_tag_app_name = "Brave-Browser-Nightly"
} else {
assert(brave_channel == "", "Unknown channel name")
}

out_dir = rebase_path(root_out_dir)

args = [
"--root_out_dir=$out_dir",
"--brave_installer_exe=$brave_installer_exe",
"--stub_installer_exe=$brave_stub_installer_exe",
"--stub_untagged_exe=$brave_untagged_stub_installer_exe",
"--standalone_installer_exe=$brave_standalone_installer_exe",
"--silent_installer_exe=$brave_silent_installer_exe",
"--untagged_installer_exe=$brave_untagged_installer_exe",
"--guid=$brave_app_guid",
"--install_switch=$_install_switch",
"--tag_ap=$tag_ap",
"--tag_app_name=$_tag_app_name",
"--brave_full_version=$chrome_version_major.$brave_version_major.$brave_version_minor.$brave_version_build",
]

outputs = [
"$root_out_dir/$brave_stub_installer_exe",
"$root_out_dir/$brave_standalone_installer_exe",
"$root_out_dir/$brave_silent_installer_exe",
"$root_out_dir/$brave_untagged_installer_exe",
]

deps = [
"//brave/build/win:create_signed_installer",
]
}

6 changes: 6 additions & 0 deletions DEPS
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
deps = {
"omaha/third_party/breakpad": "https://github.com/google/breakpad.git@bc7ddae23425cee8999e4e8ed61f77a62f058cbf",
"omaha/third_party/googletest": "https://github.com/google/googletest.git@47f819c3ca54fb602f432904443e00a0a1fe2f42",
"omaha/third_party/libzip": "https://github.com/nih-at/libzip.git@66e496489bdae81bfda8b0088172871d8fda0032",
"omaha/third_party/zlib": "https://github.com/madler/zlib.git@cacf7f1d4e3d44d871b605da3b647f07d718623f"
}
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Omaha

## This is not an official Google product.
## This is not an official Google product. ##
## How to build ##
See https://github.com/brave/brave-browser/wiki/Brave-omaha

Omaha is the open-source version of Google Update, a program to install requested software and keep it up to date. The Google-branded version of Omaha is used to support software patching (both background updating, and on-demand update checks) for Google Chrome, Earth, and a variety of other Google products on Windows 7, 8, and 10.

Expand Down
184 changes: 184 additions & 0 deletions build_omaha.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.

import argparse
import os
import os.path
import shutil
import subprocess as sp
import sys


def build(omaha_dir, build_all):
# move to omaha/omaha and start build.
os.chdir(os.path.join(omaha_dir, 'omaha'))

# set signing environment variables
key_pfx_path = os.environ.get('KEY_PFX_PATH', '')
key_cer_path = os.environ.get('KEY_CER_PATH', '')
authenticode_password = os.environ.get('AUTHENTICODE_PASSWORD', '')

mode = 'opt-win'
if build_all:
mode = 'all'
command = ['hammer.bat', 'MODE=' + mode, '--all', '--sha2_authenticode_file=' + key_pfx_path,
'--sha2_authenticode_password=' + authenticode_password, '--sha1_authenticode_file=' + key_pfx_path,
'--sha1_authenticode_password=' + authenticode_password, '--authenticode_file=' + key_pfx_path,
'--authenticode_password=' + authenticode_password]

sp.check_call(command, stderr=sp.STDOUT)

def copy_untagged_installers(args, omaha_dir, debug):
last_win_dir = 'opt-win'
if debug:
last_win_dir = 'dbg-win'
omaha_out_dir = os.path.join(omaha_dir, 'omaha', 'scons-out', last_win_dir)

source_untagged_installer = os.path.join(omaha_out_dir, 'Test_Installers', 'UNOFFICIAL_' + args.untagged_installer_exe[0])
target_untagged_installer_file = args.untagged_installer_exe[0]
if debug:
target_untagged_installer_file = 'Debug' + target_untagged_installer_file
target_untagged_installer = os.path.join(args.root_out_dir[0], target_untagged_installer_file)

shutil.copyfile(source_untagged_installer, target_untagged_installer)

source_untagged_stub_installer = os.path.join(omaha_out_dir, 'staging', 'BraveUpdateSetup.exe')
target_untagged_stub_installer_file = args.stub_untagged_exe[0]
if debug:
target_untagged_stub_installer_file = 'Debug' + target_untagged_stub_installer_file
target_untagged_stub_installer = os.path.join(args.root_out_dir[0], target_untagged_stub_installer_file)

shutil.copyfile(source_untagged_stub_installer, target_untagged_stub_installer)

def prepare_untagged_standalone(args, omaha_dir):
prepare_untagged(omaha_dir, args.root_out_dir[0], args.brave_installer_exe[0], args.guid[0], args.install_switch[0], args.brave_full_version[0],
[(args.standalone_installer_exe[0], args.brave_installer_exe[0]),
(args.untagged_installer_exe[0], args.untagged_installer_exe[0])]
)

def prepare_untagged_silent(args, omaha_dir):
prepare_untagged(
omaha_dir, args.root_out_dir[0], args.brave_installer_exe[0], args.guid[0], '--do-not-launch-chrome ' + args.install_switch[0], args.brave_full_version[0],
[(args.silent_installer_exe[0], args.silent_installer_exe[0])]
)

def prepare_untagged(omaha_dir, root_out_dir, brave_installer_exe, app_guid, install_switch, brave_full_version, details):
# copy brave installer to create standalone installer.
installer_file = os.path.join(root_out_dir, brave_installer_exe)

# prepare manifset file.
f = open(os.path.join(omaha_dir, 'manifest_template.gup'),'r')
filedata = f.read()
f.close()

newdata = filedata.replace("APP_GUID", app_guid)
newdata = newdata.replace("BRAVE_INSTALLER_EXE", brave_installer_exe)
newdata = newdata.replace("INSTALL_SWITCH", install_switch)

target_manifest_file = app_guid + '.gup'
target_manifest_path = os.path.join(omaha_dir, 'omaha', 'standalone', 'manifests', target_manifest_file)
f = open(target_manifest_path,'w')
f.write(newdata)
f.close()

target_installer_text_path = os.path.join(omaha_dir, 'omaha', 'standalone', 'standalone_installers.txt')

# Clear the file:
open(target_installer_text_path,'w').close()

for file_name, installer_exe in details:
add_to_standalone_installers_txt(target_installer_text_path, file_name, app_guid, installer_exe, brave_full_version)
shutil.copyfile(installer_file, os.path.join(omaha_dir, 'omaha', 'standalone', installer_exe))

def add_to_standalone_installers_txt(target_installer_text_path, file_name, app_guid, brave_installer_exe, brave_version):
installer_text = "('FILE_NAME', 'FILE_NAME', [('BRAVE_VERSION', '$MAIN_DIR/standalone/BRAVE_INSTALLER_EXE', 'APP_GUID')], None, None, None, False, '', '')"
installer_text = installer_text.replace("FILE_NAME", os.path.splitext(file_name)[0])
installer_text = installer_text.replace("APP_GUID", app_guid)
installer_text = installer_text.replace("BRAVE_INSTALLER_EXE", brave_installer_exe)
installer_text = installer_text.replace("BRAVE_VERSION", brave_version)
f = open(target_installer_text_path,'a+')
f.write(installer_text + '\n')
f.close()

def tag_standalone(args, omaha_dir, debug):
tag_admin = os.environ.get('TAG_ADMIN', 'prefers')
tag = 'appguid=APP_GUID&appname=TAG_APP_NAME&needsadmin=TAG_ADMIN&ap=TAG_AP'
tag = tag.replace("TAG_ADMIN", tag_admin)
tag = tag.replace("APP_GUID", args.guid[0])
tag = tag.replace("TAG_APP_NAME", args.tag_app_name[0])
tag = tag.replace("TAG_AP", args.tag_ap[0])

apply_tag(omaha_dir, debug, 'Test_Installers/UNOFFICIAL_' + args.standalone_installer_exe[0], args.standalone_installer_exe[0], tag, args.root_out_dir[0])
apply_tag(omaha_dir, debug, 'staging/BraveUpdateSetup.exe', args.stub_installer_exe[0], tag, args.root_out_dir[0])

def tag_silent(args, omaha_dir, debug):
silent_tag = 'appguid=APP_GUID&appname=TAG_APP_NAME&needsadmin=TAG_ADMIN&ap=TAG_AP&silent'
silent_tag = silent_tag.replace("TAG_ADMIN", 'False')
silent_tag = silent_tag.replace("APP_GUID", args.guid[0])
silent_tag = silent_tag.replace("TAG_APP_NAME", args.tag_app_name[0])
silent_tag = silent_tag.replace("TAG_AP", args.tag_ap[0])

apply_tag(omaha_dir, debug, 'Test_Installers/UNOFFICIAL_' + args.silent_installer_exe[0], args.silent_installer_exe[0], silent_tag, args.root_out_dir[0])

def apply_tag(omaha_dir, debug, source_installer, target_installer_file, tag, root_out_dir):
last_win_dir = 'opt-win'
if debug:
last_win_dir = 'dbg-win'
omaha_out_dir = os.path.join(omaha_dir, 'omaha', 'scons-out', last_win_dir)
apply_tag_exe = os.path.join(omaha_out_dir, 'obj', 'tools', 'ApplyTag', 'ApplyTag.exe')

source_installer_path = os.path.join(omaha_out_dir, *source_installer.split('/'))
if debug:
target_installer_file = 'Debug' + target_installer_file
target_installer_path = os.path.join(root_out_dir, target_installer_file)
command = [apply_tag_exe, source_installer_path, target_installer_path, tag]
sp.check_call(command, stderr=sp.STDOUT)

def parse_args():
parser = argparse.ArgumentParser(description='build omaha installer')
parser.add_argument('--root_out_dir',
nargs=1)
parser.add_argument('--brave_installer_exe',
nargs=1)
parser.add_argument('--stub_installer_exe',
nargs=1)
parser.add_argument('--stub_untagged_exe',
nargs=1)
parser.add_argument('--standalone_installer_exe',
nargs=1)
parser.add_argument('--silent_installer_exe',
nargs=1)
parser.add_argument('--untagged_installer_exe',
nargs=1)
parser.add_argument('--guid',
nargs=1)
parser.add_argument('--install_switch',
nargs=1)
parser.add_argument('--tag_ap',
nargs=1)
parser.add_argument('--tag_app_name',
nargs=1)
parser.add_argument('--brave_full_version',
nargs=1)
return parser.parse_args()

def main():
args = parse_args()
omaha_dir = os.path.join(args.root_out_dir[0], '..', '..', 'brave', 'vendor', 'omaha')

prepare_untagged_standalone(args, omaha_dir)
build(omaha_dir, False)
tag_standalone(args, omaha_dir, False)

prepare_untagged_silent(args, omaha_dir)
build(omaha_dir, False)
tag_silent(args, omaha_dir, False)

copy_untagged_installers(args, omaha_dir, False)

return 0


if __name__ == '__main__':
sys.exit(main())
6 changes: 6 additions & 0 deletions common/certificate_tag/README
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@ arbitrary data in extensions. Since they are also not hashed when verifying
signatures, that data can also be changed without invalidating it.

More details are here: http://b/12236017

The tool was updated in 2020 to support MSI files: b/172261939, b/165818147.

The test file is integrated from google3, but is modified here to make it
easier to run outside of google3; see the comment near the beginning of
certificate_tag_test.go
Loading