feat(appcheck): implement RecaptchaEnterpriseProvider and tests#16155
feat(appcheck): implement RecaptchaEnterpriseProvider and tests#16155ncooke3 wants to merge 62 commits into
Conversation
Using Gemini Code AssistThe 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
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 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. |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces the reCAPTCHA Enterprise provider to Firebase App Check, including the provider implementation, a factory for instantiation, and unit tests. The Package.swift file is updated to include the RecaptchaEnterpriseProvider dependency and a helper function for flexible dependency management. Feedback was provided to add error logging when the provider is initialized with an empty site key to assist with debugging.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces the reCAPTCHA Enterprise provider for Firebase App Check, including its implementation, unit tests, and an E2E test application. Key changes involve adding the FIRRecaptchaEnterpriseProvider and its factory, updating the project configuration to support a new test target, and providing documentation for E2E testing. Feedback was provided regarding the requestRecaptchaToken method in the test app's AppDelegate, where the completion handler logic could lead to multiple calls or timeouts if not properly handled.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces the reCAPTCHA Enterprise provider to the Firebase App Check SDK, including its implementation, factory, and unit tests. The test app has been significantly updated with new E2E tests, documentation, and logic to configure providers via environment variables. Additionally, Package.swift now supports local or branch-based dependency overrides for the App Check core library. Review feedback suggests enhancing test reliability by adding explicit non-nil assertions before comparisons and removing an unnecessary empty line in the provider implementation.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces the reCAPTCHA Enterprise provider to the Firebase App Check SDK, including the core implementation, unit tests, and a new E2E test suite within the sample app. The changes also improve dependency management in Package.swift and provide documentation for running E2E tests. Feedback highlights a potential redundancy in the test app's AppDelegate where a custom factory class duplicates functionality already present in the SDK.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces the reCAPTCHA Enterprise provider to Firebase App Check, including its implementation, factory, and unit tests. It also updates the E2E test application with a new test target, automated tests for token acquisition and caching, and comprehensive documentation. Feedback was provided regarding a hardcoded SDK path in the project file that could cause build failures across different environments.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces the reCAPTCHA Enterprise provider to Firebase App Check, including the provider implementation, a factory for instantiation, and comprehensive unit tests. Additionally, it adds a new End-to-End (E2E) test target to the sample app along with documentation on how to configure and run these tests. Feedback was provided regarding the test app's AppDelegate, suggesting a default value for the APP_CHECK_PROVIDER environment variable to prevent the application from crashing when run without specific configurations.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces the reCAPTCHA Enterprise provider to the Firebase App Check SDK, including its implementation, a public factory for instantiation, and comprehensive unit tests. The sample test app is also updated with a new E2E test target, documentation, and logic to switch between providers via environment variables. Review feedback highlights several improvement opportunities: removing hardcoded SDK paths in the project file to ensure build portability, providing default values for environment variables in the test app to improve the developer experience, and using the SDK's public factory implementation instead of a local one within the test app.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces the reCAPTCHA Enterprise provider to Firebase App Check. Key changes include the implementation of the FIRRecaptchaEnterpriseProvider and its corresponding factory, the addition of unit tests for these new components, and updates to the FIRAppCheckTestApp to support end-to-end testing. The project configuration files (Package.swift and .podspec) were also updated to include the necessary dependencies. Feedback was provided regarding a potential issue in the test app's storage reading logic where the completion handler might not be invoked in all execution paths, which could cause tests to hang.
Introduce an exemption in `check_imports.swift` to allow repo-relative quote imports in the `#else` block (CocoaPods) of `SWIFT_PACKAGE` guards for files under `SharedTestUtilities/`. Why now: This PR introduced `SWIFT_PACKAGE` conditional blocks to these shared test utility files to support the new Swift Package Manager infrastructure for `FirebaseAppCheck` unit tests. This enabled importing interop headers via modular angle-bracket syntax in SPM. Why the error happened: The `check_imports.swift` script strictly enforces that all imports within the `#else` block of `SWIFT_PACKAGE` must use angle brackets (`<`). However, because `SharedTestUtilities` files are injected directly into various host test targets in CocoaPods rather than being compiled as a standalone pod with formal dependencies, they must rely on repo-relative quote imports to resolve headers (e.g. `FIRAuthInterop.h`) via the repository root search path. Using angle brackets causes CocoaPods compilation failures, making the exemption necessary.
|
I'm working on final testing. The infra.samples.client_app should be fixed by setting an env var in them via #16253 |
|
What's the explanation for the CI failures? |
Requires AppCheckCore to be released. I should be able to get everything to green with #16253 |
Add reCAPTCHA Enterprise Provider to Firebase App Check
Metadata
app-checkrepository changes on branchnc/target-split.Description
This PR integrates the
RecaptchaEnterpriseProviderinto the Firebase App Check SDK within this repository. It provides the Objective-C wrapper implementation (FIRRecaptchaEnterpriseProvider), a factory for it, and significant updates to the test app to support automated E2E testing. It also updates CI workflows andPackage.swiftto allow testing against specific branches of theapp-checkdependency.Test App & E2E Testing
Significant updates were made to
FIRAppCheckTestAppto enable robust E2E testing:APP_CHECK_PROVIDER,RECAPTCHA_SITE_KEY) passed to the test runner.E2E_TESTING.mddetailing how to configure and run these tests locally.Dependencies
Package.swiftto support resolving theapp-checkdependency from a local path or a specific branch via environment variables (FIREBASE_APP_CHECK_LOCAL_PATH,FIREBASE_APP_CHECK_BRANCH).RecaptchaEnterpriseProviderproduct from theapp-checkpackage.FirebaseStorageto the test app to verify end-to-end flows with a Firebase service.New APIs
FIRRecaptchaEnterpriseProviderFIRAppCheckRecaptchaEnterpriseProviderFactoryCI & Build Workflow
.github/workflows/_spm.ymlto support injecting custom environment variables (via JSON) into the GitHub Actions environment..github/workflows/sdk.appcheck.ymlto use thenc/target-splitbranch of theapp-checkrepo for testing.scripts/build.shto usepython3instead ofpythonfor log exporting.Tests Added
FirebaseAppCheck/Tests/Unit/RecaptchaProvider):FIRRecaptchaEnterpriseProviderTests: Mocks the underlying core provider to verify success and failure completion paths.FIRRecaptchaEnterpriseProviderFactoryTests: Verifies the factory correctly instantiates the provider.FIRAppCheckTestAppTests):Other Changes
CHANGELOG.mdto note the addition of the reCAPTCHA Enterprise provider.FIRAppCheckLoggerfor incomplete options during instantiation.cc: @weixifan @rlazo