Skip to content

Commit

Permalink
feat(app, sdk)!: android-sdk v32 - app-check safetyNet provider is re…
Browse files Browse the repository at this point in the history
…moved

Note that forcing server retrieval of firestore named queries against loaded
firestore data bundles may fail on android with this SDK version. It appears
results will always come from the local cache.

BREAKING CHANGE: the "safetyNet" provider for App Check has been removed
from the underlying firebase-android-sdk and we have removed it here. You
should upgrade to the "playIntegrity" provider for App Check
  • Loading branch information
mikehardy committed Jun 5, 2023
1 parent 86dc4d5 commit a0e76ec
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ project.ext {
// Overriding Library SDK Versions
firebase: [
// Override Firebase SDK Version
bom : "31.5.0"
bom : "32.1.0"
],
],
])
Expand Down
1 change: 0 additions & 1 deletion packages/app-check/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ dependencies {
api appProject
implementation platform("com.google.firebase:firebase-bom:${ReactNative.ext.getVersion('firebase', 'bom')}")
implementation 'com.google.firebase:firebase-appcheck-playintegrity'
implementation "com.google.firebase:firebase-appcheck-safetynet"
implementation "com.google.firebase:firebase-appcheck-debug"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import com.google.firebase.appcheck.debug.InternalDebugSecretProvider;
import com.google.firebase.appcheck.debug.internal.DebugAppCheckProvider;
import com.google.firebase.appcheck.playintegrity.PlayIntegrityAppCheckProviderFactory;
import com.google.firebase.appcheck.safetynet.SafetyNetAppCheckProviderFactory;
import com.google.firebase.inject.Provider;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
Expand Down Expand Up @@ -87,10 +86,6 @@ public String getDebugSecret() {
}
}

if ("safetyNet".equals(providerName)) {
delegateProvider = SafetyNetAppCheckProviderFactory.getInstance().create(app);
}

if ("playIntegrity".equals(providerName)) {
delegateProvider = PlayIntegrityAppCheckProviderFactory.getInstance().create(app);
}
Expand Down
8 changes: 4 additions & 4 deletions packages/app-check/lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ export namespace FirebaseAppCheckTypes {
export interface ReactNativeFirebaseAppCheckProviderAndroidOptions
extends ReactNativeFirebaseAppCheckProviderOptions {
/**
* The android provider to use, either `safetyNet` or `playIntegrity`. default is `playIntegrity`, `safetyNet` is deprecated.
* The android provider to use, either `debug` or `playIntegrity`. default is `playIntegrity`.
*/
provider?: 'debug' | 'safetyNet' | 'playIntegrity';
provider?: 'debug' | 'playIntegrity';
}

export interface ReactNativeFirebaseAppCheckProvider extends AppCheckProvider {
Expand Down Expand Up @@ -212,14 +212,14 @@ export namespace FirebaseAppCheckTypes {
* Activate App Check
* On iOS App Check is activated with DeviceCheck provider simply by including the module, using the token auto refresh default or
* the specific value (if configured) in firebase.json, but calling this does no harm.
* On Android you must call this and it will install the SafetyNet provider in release builds, the Debug provider if debuggable.
* On Android if you call this it will install the PlayIntegrity provider in release builds, the Debug provider if debuggable.
* On both platforms you may use this method to alter the token refresh setting after startup.
* On iOS if you want to set a specific AppCheckProviderFactory (for instance to FIRAppCheckDebugProviderFactory or
* FIRAppAttestProvider) you must manually do that in your AppDelegate.m prior to calling [FIRApp configure]
*
* @deprecated use initializeAppCheck to gain access to all platform providers and firebase-js-sdk v9 compatibility
* @param siteKeyOrProvider - This is ignored, Android uses DebugProviderFactory if the app is debuggable (https://firebase.google.com/docs/app-check/android/debug-provider)
* Android uses SafetyNetProviderFactory for release builds.
* Android uses PlayIntegrityProviderFactory for release builds.
* iOS uses DeviceCheckProviderFactory by default unless altered in AppDelegate.m manually
* @param isTokenAutoRefreshEnabled - If true, enables SDK to automatically
* refresh AppCheck token as needed. If undefined, the value will default
Expand Down
2 changes: 1 addition & 1 deletion packages/app-check/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class FirebaseAppCheckModule extends FirebaseModule {
rnfbProvider = new ReactNativeFirebaseAppCheckProvider();
rnfbProvider.configure({
android: {
provider: 'safetyNet',
provider: 'playIntegrity',
},
apple: {
provider: 'deviceCheck',
Expand Down
2 changes: 1 addition & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"minSdk": 19,
"targetSdk": 33,
"compileSdk": 33,
"firebase": "31.5.0",
"firebase": "32.1.0",
"firebaseCrashlyticsGradle": "2.9.2",
"firebasePerfGradle": "1.4.2",
"gmsGoogleServicesGradle": "4.3.15",
Expand Down
4 changes: 4 additions & 0 deletions packages/firestore/e2e/Bundle/namedQuery.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ describe('firestore().namedQuery()', function () {
});

it('returns QuerySnapshot from firestore backend when omitting "source: cache"', async function () {
// TODO: log upstream issue - this broke with BoM >= 32.0.0, source always appears to be cache now
if (device.getPlatform() === 'android') {
this.skip();
}
const docRef = firebase.firestore().collection(BUNDLE_COLLECTION).doc();
await docRef.set({ number: 4 });

Expand Down

0 comments on commit a0e76ec

Please sign in to comment.