mac: Perform Developer ID certificate reauthorization

The code signing certificate is changing!

Previously, Chrome was signed with a designated requirement binding it
to a specific Developer ID certificate. The designated requirement was
used as the basis for the access control list that protected the Chrome
Safe Storage item in the user's Keychain. Every 5 years, as those
certificates expired and were renewed, these Keychain items needed to be
"reauthorized" to ensure that newer versions of Chrome, signed with the
new certificate, would continue to have access. These projects were
previously conducted under bug 629906 and bug 116210.

Recently, Chrome started being signed with a designated requirement
binding it more traditionally for Developer ID code signing. Rather than
using a specific signing certificate, the requirement is now summarized
as "Apple issued a Developer ID Application certificate to Google
(indicated by team ID)". Provided the team ID doesn't change (it hasn't
since the inception of the Developer ID program), the new requirement
should spell the end of periodic reauthorization projects.

Except for this one. For (hopefully) one last time, the Safe Storage
items in users' Keychains need to be reauthorized according to the new
requirement.

The strategy is quite similar to previous reauthorization projects. In
fact, most of this round was developed on fairly clean reverts of
2c29863d6049 and f54c4ad6c92f, which removed the code used for the
previous reauthorization. Reauthorization can be performed by any
process that has access to Safe Storage items that only allow access to
"old-signed" Chrome. Initially, this includes the browser process (see
REAUTHORIZE_IN_APP) but that will cease to be true when the code signing
certificate changes. To allow reauthorizations to be performed even
after that date, the reauthorization stub executable is introduced. It's
a helper executable that's signed as though it were Chrome, and thus has
the necessary access to old Safe Storage item. Like other Chrome
helpers, the stub loads the framework and jumps to a well-known entry
point. The code signing mechanism (in particular, the "library" option
for library validation, and the "runtime" option for the hardened
runtime) prevent abuse. The stub can be launched by Chrome even after
Chrome's own code signing certificate changes.

In this change, the stub executable is built and signed. Once a signed
stub is available, it will be "frozen" and embedded as a binary
component, signed using the old certificate, and maintaining its
validity because it was signed before that certificate expired. Since
the stub contains no code other than that necessary to load and jump to
the framework, it is anticipated that it will not be a problem for it to
exist as a binary component for the duration of the reauthorization
project.

Another follow-up change will switch REAUTHORIZE_IN_APP to 0 in
anticipation of the certificate change for Chrome code. This will cause
all reauthorizations to be performed by the stub.

In addition to performing reauthorization when Chrome is started, it is
also done at update time when updating from a user ticket (as this is
only possible when the updater is running as the user that runs Chrome)
by launching the stub.

Bug: 1263152
Change-Id: Id26437419cfa9bbd0176430ce65be120aee7fe10
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3445684
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Adam Langley <agl@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Cr-Commit-Position: refs/heads/main@{#969436}
NOKEYCHECK=True
GitOrigin-RevId: b4e1bfc7a9489c4cc4cb01cbb672cba8ac949cc8
4 files changed
tree: 31e5167025eb1a615cc54e05f3a5325fbc90be7f
  1. aead.cc
  2. aead.h
  3. aead_unittest.cc
  4. apple_keychain.h
  5. apple_keychain_ios.mm
  6. apple_keychain_mac.cc
  7. BUILD.gn
  8. capi_util.cc
  9. capi_util.h
  10. chaps_support.cc
  11. chaps_support.h
  12. crypto_export.h
  13. DEPS
  14. DIR_METADATA
  15. ec_private_key.cc
  16. ec_private_key.h
  17. ec_private_key_unittest.cc
  18. ec_signature_creator.cc
  19. ec_signature_creator.h
  20. ec_signature_creator_impl.cc
  21. ec_signature_creator_impl.h
  22. ec_signature_creator_unittest.cc
  23. encryptor.cc
  24. encryptor.h
  25. encryptor_unittest.cc
  26. features.gni
  27. hkdf.cc
  28. hkdf.h
  29. hmac.cc
  30. hmac.h
  31. hmac_unittest.cc
  32. mac_security_services_lock.cc
  33. mac_security_services_lock.h
  34. mock_apple_keychain.cc
  35. mock_apple_keychain.h
  36. mock_apple_keychain_ios.cc
  37. mock_apple_keychain_mac.cc
  38. nss_crypto_module_delegate.h
  39. nss_key_util.cc
  40. nss_key_util.h
  41. nss_key_util_unittest.cc
  42. nss_util.cc
  43. nss_util.h
  44. nss_util_chromeos.cc
  45. nss_util_internal.h
  46. nss_util_unittest.cc
  47. openssl_util.cc
  48. openssl_util.h
  49. OWNERS
  50. p224_spake.cc
  51. p224_spake.h
  52. p224_spake_unittest.cc
  53. random.cc
  54. random.h
  55. random_unittest.cc
  56. rsa_private_key.cc
  57. rsa_private_key.h
  58. rsa_private_key_unittest.cc
  59. scoped_capi_types.h
  60. scoped_mock_unexportable_key_provider.cc
  61. scoped_mock_unexportable_key_provider.h
  62. scoped_nss_types.h
  63. scoped_test_nss_chromeos_user.cc
  64. scoped_test_nss_chromeos_user.h
  65. scoped_test_nss_db.cc
  66. scoped_test_nss_db.h
  67. scoped_test_system_nss_key_slot.cc
  68. scoped_test_system_nss_key_slot.h
  69. secure_hash.cc
  70. secure_hash.h
  71. secure_hash_unittest.cc
  72. secure_util.cc
  73. secure_util.h
  74. sha2.cc
  75. sha2.h
  76. sha2_unittest.cc
  77. signature_creator.cc
  78. signature_creator.h
  79. signature_creator_unittest.cc
  80. signature_verifier.cc
  81. signature_verifier.h
  82. signature_verifier_unittest.cc
  83. symmetric_key.cc
  84. symmetric_key.h
  85. symmetric_key_unittest.cc
  86. unexportable_key.cc
  87. unexportable_key.h
  88. unexportable_key_unittest.cc
  89. unexportable_key_win.cc