From 78627b59594127ab1056cfe78ac0759814a02eb1 Mon Sep 17 00:00:00 2001 From: Thom Chiovoloni Date: Wed, 5 Feb 2020 13:15:41 -0800 Subject: [PATCH 1/3] Don't use a bool argument over the FFI in fxa_migrate_from_session_token --- .../java/mozilla/appservices/fxaclient/FirefoxAccount.kt | 4 ++-- .../java/mozilla/appservices/fxaclient/rust/LibFxAFFI.kt | 2 +- components/fxa-client/ffi/src/lib.rs | 4 ++-- components/fxa-client/ios/FxAClient/RustFxAFFI.h | 7 +++++++ 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/components/fxa-client/android/src/main/java/mozilla/appservices/fxaclient/FirefoxAccount.kt b/components/fxa-client/android/src/main/java/mozilla/appservices/fxaclient/FirefoxAccount.kt index 407f17fea..954662201 100644 --- a/components/fxa-client/android/src/main/java/mozilla/appservices/fxaclient/FirefoxAccount.kt +++ b/components/fxa-client/android/src/main/java/mozilla/appservices/fxaclient/FirefoxAccount.kt @@ -329,7 +329,7 @@ class FirefoxAccount(handle: FxaHandle, persistCallback: PersistCallback?) : Aut sessionToken, kSync, kXCS, - false, + 0, e ) }.getAndConsumeRustString() @@ -366,7 +366,7 @@ class FirefoxAccount(handle: FxaHandle, persistCallback: PersistCallback?) : Aut fun copyFromSessionToken(sessionToken: String, kSync: String, kXCS: String): JSONObject { try { val json = rustCallWithLock { e -> - LibFxAFFI.INSTANCE.fxa_migrate_from_session_token(this.handle.get(), sessionToken, kSync, kXCS, true, e) + LibFxAFFI.INSTANCE.fxa_migrate_from_session_token(this.handle.get(), sessionToken, kSync, kXCS, 1, e) }.getAndConsumeRustString() return JSONObject(json) } finally { diff --git a/components/fxa-client/android/src/main/java/mozilla/appservices/fxaclient/rust/LibFxAFFI.kt b/components/fxa-client/android/src/main/java/mozilla/appservices/fxaclient/rust/LibFxAFFI.kt index 49202029f..7051ebb7b 100644 --- a/components/fxa-client/android/src/main/java/mozilla/appservices/fxaclient/rust/LibFxAFFI.kt +++ b/components/fxa-client/android/src/main/java/mozilla/appservices/fxaclient/rust/LibFxAFFI.kt @@ -90,7 +90,7 @@ internal interface LibFxAFFI : Library { sessionToken: String, kSync: String, kXCS: String, - copySessionToken: Boolean, + copySessionToken: Byte, e: RustError.ByReference ): Pointer? diff --git a/components/fxa-client/ffi/src/lib.rs b/components/fxa-client/ffi/src/lib.rs index 7f9a92950..bbd4b14da 100644 --- a/components/fxa-client/ffi/src/lib.rs +++ b/components/fxa-client/ffi/src/lib.rs @@ -238,7 +238,7 @@ pub extern "C" fn fxa_migrate_from_session_token( session_token: FfiStr<'_>, k_sync: FfiStr<'_>, k_xcs: FfiStr<'_>, - copy_session_token: bool, + copy_session_token: u8, error: &mut ExternError, ) -> *mut c_char { log::debug!("fxa_migrate_from_session_token"); @@ -247,7 +247,7 @@ pub extern "C" fn fxa_migrate_from_session_token( let k_sync = k_sync.as_str(); let k_xcs = k_xcs.as_str(); let migration_metrics = - fxa.migrate_from_session_token(session_token, k_sync, k_xcs, copy_session_token)?; + fxa.migrate_from_session_token(session_token, k_sync, k_xcs, copy_session_token != 0)?; let result = serde_json::to_string(&migration_metrics)?; Ok(result) }) diff --git a/components/fxa-client/ios/FxAClient/RustFxAFFI.h b/components/fxa-client/ios/FxAClient/RustFxAFFI.h index 9efbfe77e..dd6afa1ba 100644 --- a/components/fxa-client/ios/FxAClient/RustFxAFFI.h +++ b/components/fxa-client/ios/FxAClient/RustFxAFFI.h @@ -80,6 +80,13 @@ FxARustBuffer fxa_profile(FirefoxAccountHandle handle, bool ignore_cache, FxAError *_Nonnull out); +void fxa_migrate_from_session_token(FirefoxAccountHandle handle, + const char *_Nonnull sessionToken, + const char *_Nonnull kSync, + const char *_Nonnull kXCS, + uint8_t copySessionToken, + FxAError *_Nonnull out); + char *_Nullable fxa_get_token_server_endpoint_url(FirefoxAccountHandle handle, FxAError *_Nonnull out); From fcad7fa833179b768cd287e57efc4f2f0cc78f7e Mon Sep 17 00:00:00 2001 From: Ryan Kelly Date: Thu, 6 Feb 2020 08:41:07 +1100 Subject: [PATCH 2/3] Release v0.50.1 --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e82a2daf7..c7e8a281a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +# v0.50.1 (_2020-02-06_) + +[Full Changelog](https://github.com/mozilla/application-services/compare/v0.50.0...v0.50.1) + +## FxA Client + +### What's changed + +- Fixed a potentially-unsafe use of a boolean in the FFI interface for `migrateFromSessionToken`. + ([#2592](https://github.com/mozilla/application-services/pull/2592)). + + # v0.50.0 (_2020-02-05_) [Full Changelog](https://github.com/mozilla/application-services/compare/v0.49.0...v0.50.0) From 6b622ec68b7ff00539cf6529e14357c627e1f840 Mon Sep 17 00:00:00 2001 From: Ryan Kelly Date: Thu, 6 Feb 2020 09:51:16 +1100 Subject: [PATCH 3/3] Release v0.50.2 --- .buildconfig-android.yml | 2 +- CHANGELOG.md | 9 +++++++++ CHANGES_UNRELEASED.md | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.buildconfig-android.yml b/.buildconfig-android.yml index 77be9fbc2..85130cf43 100644 --- a/.buildconfig-android.yml +++ b/.buildconfig-android.yml @@ -1,4 +1,4 @@ -libraryVersion: 0.50.0 +libraryVersion: 0.50.2 groupId: org.mozilla.appservices projects: fxaclient: diff --git a/CHANGELOG.md b/CHANGELOG.md index c7e8a281a..398c164e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +# v0.50.2 (_2020-02-06_) + +[Full Changelog](https://github.com/mozilla/application-services/compare/v0.50.1...v0.50.2) + +### What's changed + +- Re-releasing to fix misconfigured build options in v0.50.1. + + # v0.50.1 (_2020-02-06_) [Full Changelog](https://github.com/mozilla/application-services/compare/v0.50.0...v0.50.1) diff --git a/CHANGES_UNRELEASED.md b/CHANGES_UNRELEASED.md index cd923790f..ac594b98a 100644 --- a/CHANGES_UNRELEASED.md +++ b/CHANGES_UNRELEASED.md @@ -2,4 +2,4 @@ # Unreleased Changes -[Full Changelog](https://github.com/mozilla/application-services/compare/v0.50.0...master) +[Full Changelog](https://github.com/mozilla/application-services/compare/v0.50.2...master)