Skip to content

feat(appcheck): implement RecaptchaEnterpriseProvider and tests#16150

Merged
ncooke3 merged 12 commits into
nc/recaptcha-1from
nc/recaptcha
May 4, 2026
Merged

feat(appcheck): implement RecaptchaEnterpriseProvider and tests#16150
ncooke3 merged 12 commits into
nc/recaptcha-1from
nc/recaptcha

Conversation

@ncooke3

@ncooke3 ncooke3 commented May 1, 2026

Copy link
Copy Markdown
Member

Depends on google/app-check#94

@gemini-code-assist

Copy link
Copy Markdown
Contributor
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

@danger-firebase-ios

danger-firebase-ios Bot commented May 1, 2026

Copy link
Copy Markdown
1 Warning
⚠️ New public headers were added, did you remember to add them to the umbrella header?

Generated by 🚫 Danger

@ncooke3

ncooke3 commented May 1, 2026

Copy link
Copy Markdown
Member Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds the reCAPTCHA Enterprise provider to Firebase App Check, including the FIRRecaptchaEnterpriseProvider class, its factory, and unit tests. Feedback identifies a potential runtime crash in the provider's initialization, recommends removing unused code in the test suite, and suggests using standard XCTest macros for consistency.

Comment thread FirebaseAppCheck/Sources/RecaptchaProvider/FIRRecaptchaEnterpriseProvider.m Outdated
@ncooke3

ncooke3 commented May 1, 2026

Copy link
Copy Markdown
Member Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the reCAPTCHA Enterprise provider to Firebase App Check, including the provider and factory implementations, new logging constants, and unit tests. Additionally, the Package.swift file was updated with a helper function to support local or branch-based dependencies for the App Check core. The review feedback suggests refining the API by removing unnecessary nullability from the factory initializer and improving test reliability by using a single NSDate instance for consistent timestamps in unit tests.

@ncooke3

ncooke3 commented May 1, 2026

Copy link
Copy Markdown
Member Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the reCAPTCHA Enterprise provider to Firebase App Check, including the provider implementation, a factory for instantiation, and associated unit tests. It also updates the project's dependency management in Package.swift to support the new provider and allow for more flexible dependency resolution. Feedback was provided regarding code duplication in the completion handlers of the new provider class to improve maintainability.

@ncooke3

ncooke3 commented May 1, 2026

Copy link
Copy Markdown
Member Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the reCAPTCHA Enterprise provider to Firebase App Check, adding the provider and factory implementations, error logging for incomplete configurations, and unit tests. The feedback recommends implementing runtime validation to ensure the siteKey is not empty during initialization and suggests removing an unnecessary empty line in the Package.swift file.

return self;
}

- (nullable instancetype)initWithApp:(FIRApp *)app siteKey:(NSString *)siteKey {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

It is recommended to validate that siteKey is not an empty string before proceeding with initialization. While NS_ASSUME_NONNULL handles nullability at compile-time, a runtime check or assertion for an empty string can prevent issues with the underlying GACRecaptchaEnterpriseProvider.

- (nullable instancetype)initWithApp:(FIRApp *)app siteKey:(NSString *)siteKey {
  if (siteKey.length == 0) {
    return nil;
  }


@implementation FIRAppCheckRecaptchaEnterpriseProviderFactory

- (instancetype)initWithSiteKey:(NSString *)siteKey {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

Similar to the provider initialization, it is good practice to ensure the siteKey provided to the factory is not empty.

Suggested change
- (instancetype)initWithSiteKey:(NSString *)siteKey {
- (instancetype)initWithSiteKey:(NSString *)siteKey {
NSParameterAssert(siteKey.length > 0);
self = [super init];

Comment thread Package.swift
Comment on lines +1265 to 1268
.product(name: "RecaptchaEnterpriseProvider", package: "app-check"),
.product(name: "GULEnvironment", package: "GoogleUtilities"),

.product(name: "GULUserDefaults", package: "GoogleUtilities"),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

There is an unnecessary empty line introduced here. It's better to keep the dependency list compact.

Suggested change
.product(name: "RecaptchaEnterpriseProvider", package: "app-check"),
.product(name: "GULEnvironment", package: "GoogleUtilities"),
.product(name: "GULUserDefaults", package: "GoogleUtilities"),
.product(name: "RecaptchaEnterpriseProvider", package: "app-check"),
.product(name: "GULEnvironment", package: "GoogleUtilities"),
.product(name: "GULUserDefaults", package: "GoogleUtilities"),

@ncooke3

ncooke3 commented May 1, 2026

Copy link
Copy Markdown
Member Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds the reCAPTCHA Enterprise provider to Firebase App Check, including provider and factory implementations, logging, and unit tests. The Package.swift file was also updated to support dynamic dependency resolution. Feedback identifies minor style issues, specifically unnecessary blank lines and inconsistent indentation.

Comment on lines +54 to +56
NSArray<NSString *> *missingOptionsFields =

[FIRAppCheckValidator tokenExchangeMissingFieldsInOptions:app.options];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

There is an unnecessary blank line and inconsistent indentation here. It's better to keep the assignment clean and follow standard continuation indentation.

Suggested change
NSArray<NSString *> *missingOptionsFields =
[FIRAppCheckValidator tokenExchangeMissingFieldsInOptions:app.options];
NSArray<NSString *> *missingOptionsFields =
[FIRAppCheckValidator tokenExchangeMissingFieldsInOptions:app.options];

Comment thread Package.swift
Comment on lines 1267 to 1269
.product(name: "GULUserDefaults", package: "GoogleUtilities"),

],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

Unnecessary blank line at the end of the dependencies list.

              .product(name: "GULUserDefaults", package: "GoogleUtilities"),
            ],

@ncooke3 ncooke3 changed the base branch from main to nc/recaptcha-1 May 4, 2026 15:56
@ncooke3 ncooke3 marked this pull request as ready for review May 4, 2026 15:56
@ncooke3 ncooke3 requested a review from a team as a code owner May 4, 2026 15:57
@ncooke3 ncooke3 merged commit 33905d4 into nc/recaptcha-1 May 4, 2026
358 of 634 checks passed
@ncooke3 ncooke3 deleted the nc/recaptcha branch May 4, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant