[ios] Implement profile-level client certificate provisioning [chromium/src : main]

0 views
Skip to first unread message

Sébastien Lalancette (Gerrit)

unread,
Feb 19, 2026, 12:59:38 PM (5 days ago) Feb 19
to Anatoli Hancharou, AyeAye Python Dispatcher, Chromium LUCI CQ, chromium...@chromium.org, eic+...@google.com, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org
Attention needed from Anatoli Hancharou

Sébastien Lalancette added 5 comments

File ios/chrome/browser/enterprise/client_certificates/certificate_provisioning_service_factory_ios.mm
Line 53, Patchset 3 (Latest): ProfileSelection::kOwnInstanceInIncognito) {
Sébastien Lalancette . unresolved

This is different than for other non-iOS platforms. Is that expected?
https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/enterprise/client_certificates/certificate_provisioning_service_factory.cc;l=61

For the other platforms, this is the service creation pattern w.r.t. Profile types:
https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/profiles/profile_selections.h;l=75-84

Seems like `kNoInstanceInIncognito` is more inline with non-iOS?

Line 60, Patchset 3 (Latest):
Sébastien Lalancette . unresolved

I think you'll want to also override `ServiceIsCreatedWithBrowserContext` and have it return true. The idea is that the provisioning service watches the policy value and will start provisioning the client cert as soon as the policy becomes enabled. This is an optimization to have the certificate get created/loaded before it is needed for a connection (which the user will then see as a loading spinner).

By overriding `ServiceIsCreatedWithBrowserContext`, the service will be created whenever the profile objects gets created, and then the service will start monitoring the policy preference.

Also, if you do override `ServiceIsCreatedWithBrowserContext`, I would suggest also overriding `ServiceIsNULLWhileTesting` to reduce side-effects in other people's EarlGrey/Browser tests :-).

File ios/chrome/browser/enterprise/client_certificates/certificate_store_factory.mm
Line 28, Patchset 3 (Latest): ProfileSelection::kOwnInstanceInIncognito) {
Sébastien Lalancette . unresolved

Same comment as for the other factory.

File ios/chrome/browser/enterprise/client_certificates/profile_context_delegate_ios.mm
Line 18, Patchset 3 (Latest): CHECK(profile_);
Sébastien Lalancette . unresolved

Do you actually need the Profile?

It's generally preferred to inject the dependencies you need from a Profile in the constructor instead of the whole Profile's pointer, to reduce coupling.

Line 25, Patchset 3 (Latest): // TODO: flush stored certificates
Sébastien Lalancette . unresolved
Add a bug for TODOs.
```suggestion
// TODO(crbug.com/XXXX): Flush stored certificates.
```

https://google.github.io/styleguide/cppguide.html#TODO_Comments

Open in Gerrit

Related details

Attention is currently required from:
  • Anatoli Hancharou
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I9bb64362f84e58d19602ca97b65fb0045c9733bf
Gerrit-Change-Number: 7531757
Gerrit-PatchSet: 3
Gerrit-Owner: Anatoli Hancharou <ant...@google.com>
Gerrit-Reviewer: Anatoli Hancharou <ant...@google.com>
Gerrit-CC: AyeAye Python Dispatcher <android-build-ayeay...@system.gserviceaccount.com>
Gerrit-CC: Sébastien Lalancette <seblal...@chromium.org>
Gerrit-Attention: Anatoli Hancharou <ant...@google.com>
Gerrit-Comment-Date: Thu, 19 Feb 2026 17:59:33 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Sylvain Defresne (Gerrit)

unread,
Feb 23, 2026, 4:40:57 AM (yesterday) Feb 23
to Anatoli Hancharou, Sébastien Lalancette, AyeAye Python Dispatcher, Chromium LUCI CQ, chromium...@chromium.org, eic+...@google.com, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org
Attention needed from Anatoli Hancharou

Sylvain Defresne added 1 comment

File ios/chrome/browser/enterprise/client_certificates/certificate_provisioning_service_factory_ios.mm
Sébastien Lalancette . unresolved

I think you'll want to also override `ServiceIsCreatedWithBrowserContext` and have it return true. The idea is that the provisioning service watches the policy value and will start provisioning the client cert as soon as the policy becomes enabled. This is an optimization to have the certificate get created/loaded before it is needed for a connection (which the user will then see as a loading spinner).

By overriding `ServiceIsCreatedWithBrowserContext`, the service will be created whenever the profile objects gets created, and then the service will start monitoring the policy preference.

Also, if you do override `ServiceIsCreatedWithBrowserContext`, I would suggest also overriding `ServiceIsNULLWhileTesting` to reduce side-effects in other people's EarlGrey/Browser tests :-).

Sylvain Defresne

drive-by:

Those methods are not overridable when you inherit `ProfileKeyedServiceFactoryIOS`.

Instead you need to pass `ServiceCreation::kCreateWithProfile` (to force creation with the profile) and `TestingCreation::kNoServiceForTests` (to avoid creating the service for tests, and required if you use `ServiceCreation::kCreateWithProfile`).

Anyway, this is just a minor tweak to what suggested Sébastien (and I agree with his comments).

Open in Gerrit

Related details

Attention is currently required from:
  • Anatoli Hancharou
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I9bb64362f84e58d19602ca97b65fb0045c9733bf
Gerrit-Change-Number: 7531757
Gerrit-PatchSet: 3
Gerrit-Owner: Anatoli Hancharou <ant...@google.com>
Gerrit-Reviewer: Anatoli Hancharou <ant...@google.com>
Gerrit-Reviewer: Sébastien Lalancette <seblal...@chromium.org>
Gerrit-CC: AyeAye Python Dispatcher <android-build-ayeay...@system.gserviceaccount.com>
Gerrit-CC: Sylvain Defresne <sdef...@chromium.org>
Gerrit-Attention: Anatoli Hancharou <ant...@google.com>
Gerrit-Comment-Date: Mon, 23 Feb 2026 09:40:45 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Sébastien Lalancette <seblal...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Anatoli Hancharou (Gerrit)

unread,
11:11 AM (5 hours ago) 11:11 AM
to Sylvain Defresne, Sébastien Lalancette, AyeAye Python Dispatcher, Chromium LUCI CQ, chromium...@chromium.org, eic+...@google.com, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org
Attention needed from Sylvain Defresne and Sébastien Lalancette

Anatoli Hancharou added 5 comments

File ios/chrome/browser/enterprise/client_certificates/certificate_provisioning_service_factory_ios.mm
Line 53, Patchset 3: ProfileSelection::kOwnInstanceInIncognito) {
Sébastien Lalancette . resolved

This is different than for other non-iOS platforms. Is that expected?
https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/enterprise/client_certificates/certificate_provisioning_service_factory.cc;l=61

For the other platforms, this is the service creation pattern w.r.t. Profile types:
https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/profiles/profile_selections.h;l=75-84

Seems like `kNoInstanceInIncognito` is more inline with non-iOS?

Anatoli Hancharou

Done

Line 60, Patchset 3:
Sébastien Lalancette . resolved

I think you'll want to also override `ServiceIsCreatedWithBrowserContext` and have it return true. The idea is that the provisioning service watches the policy value and will start provisioning the client cert as soon as the policy becomes enabled. This is an optimization to have the certificate get created/loaded before it is needed for a connection (which the user will then see as a loading spinner).

By overriding `ServiceIsCreatedWithBrowserContext`, the service will be created whenever the profile objects gets created, and then the service will start monitoring the policy preference.

Also, if you do override `ServiceIsCreatedWithBrowserContext`, I would suggest also overriding `ServiceIsNULLWhileTesting` to reduce side-effects in other people's EarlGrey/Browser tests :-).

Sylvain Defresne

drive-by:

Those methods are not overridable when you inherit `ProfileKeyedServiceFactoryIOS`.

Instead you need to pass `ServiceCreation::kCreateWithProfile` (to force creation with the profile) and `TestingCreation::kNoServiceForTests` (to avoid creating the service for tests, and required if you use `ServiceCreation::kCreateWithProfile`).

Anyway, this is just a minor tweak to what suggested Sébastien (and I agree with his comments).

Anatoli Hancharou

Done

File ios/chrome/browser/enterprise/client_certificates/certificate_store_factory.mm
Line 28, Patchset 3: ProfileSelection::kOwnInstanceInIncognito) {
Sébastien Lalancette . resolved

Same comment as for the other factory.

Anatoli Hancharou

Done

File ios/chrome/browser/enterprise/client_certificates/profile_context_delegate_ios.mm
Line 18, Patchset 3: CHECK(profile_);
Sébastien Lalancette . resolved

Do you actually need the Profile?

It's generally preferred to inject the dependencies you need from a Profile in the constructor instead of the whole Profile's pointer, to reduce coupling.

Anatoli Hancharou

Done

Line 25, Patchset 3: // TODO: flush stored certificates
Sébastien Lalancette . resolved
Add a bug for TODOs.
```suggestion
// TODO(crbug.com/XXXX): Flush stored certificates.
```

https://google.github.io/styleguide/cppguide.html#TODO_Comments

Anatoli Hancharou

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Sylvain Defresne
  • Sébastien Lalancette
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I9bb64362f84e58d19602ca97b65fb0045c9733bf
    Gerrit-Change-Number: 7531757
    Gerrit-PatchSet: 5
    Gerrit-Owner: Anatoli Hancharou <ant...@google.com>
    Gerrit-Reviewer: Anatoli Hancharou <ant...@google.com>
    Gerrit-Reviewer: Sébastien Lalancette <seblal...@chromium.org>
    Gerrit-CC: AyeAye Python Dispatcher <android-build-ayeay...@system.gserviceaccount.com>
    Gerrit-CC: Sylvain Defresne <sdef...@chromium.org>
    Gerrit-Attention: Sébastien Lalancette <seblal...@chromium.org>
    Gerrit-Attention: Sylvain Defresne <sdef...@chromium.org>
    Gerrit-Comment-Date: Tue, 24 Feb 2026 16:11:39 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Sébastien Lalancette <seblal...@chromium.org>
    Comment-In-Reply-To: Sylvain Defresne <sdef...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Sébastien Lalancette (Gerrit)

    unread,
    11:30 AM (5 hours ago) 11:30 AM
    to Anatoli Hancharou, Sylvain Defresne, AyeAye Python Dispatcher, Chromium LUCI CQ, chromium...@chromium.org, eic+...@google.com, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org
    Attention needed from Anatoli Hancharou and Sylvain Defresne

    Sébastien Lalancette voted Code-Review+1

    Code-Review+1
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Anatoli Hancharou
    • Sylvain Defresne
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I9bb64362f84e58d19602ca97b65fb0045c9733bf
      Gerrit-Change-Number: 7531757
      Gerrit-PatchSet: 6
      Gerrit-Owner: Anatoli Hancharou <ant...@google.com>
      Gerrit-Reviewer: Anatoli Hancharou <ant...@google.com>
      Gerrit-Reviewer: Sébastien Lalancette <seblal...@chromium.org>
      Gerrit-CC: AyeAye Python Dispatcher <android-build-ayeay...@system.gserviceaccount.com>
      Gerrit-CC: Sylvain Defresne <sdef...@chromium.org>
      Gerrit-Attention: Anatoli Hancharou <ant...@google.com>
      Gerrit-Attention: Sylvain Defresne <sdef...@chromium.org>
      Gerrit-Comment-Date: Tue, 24 Feb 2026 16:30:35 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Sylvain Defresne (Gerrit)

      unread,
      11:59 AM (5 hours ago) 11:59 AM
      to Anatoli Hancharou, Gauthier Ambard, Sébastien Lalancette, AyeAye Python Dispatcher, Chromium LUCI CQ, chromium...@chromium.org, eic+...@google.com, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org
      Attention needed from Anatoli Hancharou and Gauthier Ambard

      Sylvain Defresne voted and added 1 comment

      Votes added by Sylvain Defresne

      Code-Review+1

      1 comment

      Patchset-level comments
      File-level comment, Patchset 6 (Latest):
      Sylvain Defresne . resolved

      lgtm

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Anatoli Hancharou
      • Gauthier Ambard
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I9bb64362f84e58d19602ca97b65fb0045c9733bf
      Gerrit-Change-Number: 7531757
      Gerrit-PatchSet: 6
      Gerrit-Owner: Anatoli Hancharou <ant...@google.com>
      Gerrit-Reviewer: Anatoli Hancharou <ant...@google.com>
      Gerrit-Reviewer: Gauthier Ambard <gam...@chromium.org>
      Gerrit-Reviewer: Sylvain Defresne <sdef...@chromium.org>
      Gerrit-Reviewer: Sébastien Lalancette <seblal...@chromium.org>
      Gerrit-CC: AyeAye Python Dispatcher <android-build-ayeay...@system.gserviceaccount.com>
      Gerrit-Attention: Anatoli Hancharou <ant...@google.com>
      Gerrit-Attention: Gauthier Ambard <gam...@chromium.org>
      Gerrit-Comment-Date: Tue, 24 Feb 2026 16:59:38 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages