diff --git a/encoders/firebase-encoders-proto/CHANGELOG.md b/encoders/firebase-encoders-proto/CHANGELOG.md index 62ae4e68ef4..f4e346bb920 100644 --- a/encoders/firebase-encoders-proto/CHANGELOG.md +++ b/encoders/firebase-encoders-proto/CHANGELOG.md @@ -1,4 +1,4 @@ # Unreleased * [changed] Updated protobuf dependency to `3.25.5` to fix - [CVE-2024-7254](https://github.com/advisories/GHSA-735f-pc8j-v9w8). + [CVE-2024-7254](https://nvd.nist.gov/vuln/detail/CVE-2024-7254). diff --git a/firebase-config/CHANGELOG.md b/firebase-config/CHANGELOG.md index 52652dde7ba..4cb4954ecff 100644 --- a/firebase-config/CHANGELOG.md +++ b/firebase-config/CHANGELOG.md @@ -1,6 +1,6 @@ # Unreleased * [changed] Updated protobuf dependency to `3.25.5` to fix - [CVE-2024-7254](https://github.com/advisories/GHSA-735f-pc8j-v9w8). + [CVE-2024-7254](https://nvd.nist.gov/vuln/detail/CVE-2024-7254). # 22.0.0 * [changed] Bump internal dependencies diff --git a/firebase-crashlytics/CHANGELOG.md b/firebase-crashlytics/CHANGELOG.md index bf67a6d8536..2374ac9f9bb 100644 --- a/firebase-crashlytics/CHANGELOG.md +++ b/firebase-crashlytics/CHANGELOG.md @@ -1,6 +1,6 @@ # Unreleased * [changed] Updated protobuf dependency to `3.25.5` to fix - [CVE-2024-7254](https://github.com/advisories/GHSA-735f-pc8j-v9w8). + [CVE-2024-7254](https://nvd.nist.gov/vuln/detail/CVE-2024-7254). # 19.2.0 diff --git a/firebase-dataconnect/CHANGELOG.md b/firebase-dataconnect/CHANGELOG.md index 78d5d548a10..a3400196b8c 100644 --- a/firebase-dataconnect/CHANGELOG.md +++ b/firebase-dataconnect/CHANGELOG.md @@ -1,6 +1,6 @@ # Unreleased * [changed] Updated protobuf dependency to `3.25.5` to fix - [CVE-2024-7254](https://github.com/advisories/GHSA-735f-pc8j-v9w8). + [CVE-2024-7254](https://nvd.nist.gov/vuln/detail/CVE-2024-7254). # 16.0.0-beta01 * [feature] Initial release of the Data Connect SDK (public preview). Learn how to diff --git a/firebase-dataconnect/firebase-dataconnect.gradle.kts b/firebase-dataconnect/firebase-dataconnect.gradle.kts index 9eda17e3623..5f22d5d8489 100644 --- a/firebase-dataconnect/firebase-dataconnect.gradle.kts +++ b/firebase-dataconnect/firebase-dataconnect.gradle.kts @@ -31,8 +31,8 @@ firebaseLibrary { publishJavadoc = false previewMode = "beta" releaseNotes { - name.set("{{firebase_data_connect}}") - versionName.set("dataconnect") + name.set("{{data_connect_short}}") + versionName.set("data-connect") hasKTX.set(false) } diff --git a/firebase-firestore/CHANGELOG.md b/firebase-firestore/CHANGELOG.md index 63ce09be53a..6f56830e31d 100644 --- a/firebase-firestore/CHANGELOG.md +++ b/firebase-firestore/CHANGELOG.md @@ -1,7 +1,7 @@ # Unreleased * [changed] Update Firestore proto definitions. [#6369](//github.com/firebase/firebase-android-sdk/pull/6369) * [changed] Updated protobuf dependency to `3.25.5` to fix - [CVE-2024-7254](https://github.com/advisories/GHSA-735f-pc8j-v9w8). + [CVE-2024-7254](https://nvd.nist.gov/vuln/detail/CVE-2024-7254). # 25.1.0 * [feature] Add support for the VectorValue type. [#6154](//github.com/firebase/firebase-android-sdk/pull/6154) diff --git a/firebase-functions/api.txt b/firebase-functions/api.txt index aaa96f9fbec..8b663f00cbb 100644 --- a/firebase-functions/api.txt +++ b/firebase-functions/api.txt @@ -81,13 +81,9 @@ package com.google.firebase.functions { method public boolean getLimitedUseAppCheckTokens(); method public long getTimeout(); method public void setTimeout(long timeout, @NonNull java.util.concurrent.TimeUnit units); - field @NonNull public static final com.google.firebase.functions.HttpsCallOptions.Companion Companion; field public final boolean limitedUseAppCheckTokens; } - public static final class HttpsCallOptions.Companion { - } - public final class HttpsCallableOptions { method public boolean getLimitedUseAppCheckTokens(); field public final boolean limitedUseAppCheckTokens; diff --git a/firebase-functions/firebase-functions.gradle.kts b/firebase-functions/firebase-functions.gradle.kts index 818bc986371..d7222f0cd79 100644 --- a/firebase-functions/firebase-functions.gradle.kts +++ b/firebase-functions/firebase-functions.gradle.kts @@ -1,3 +1,5 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + // Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -55,6 +57,20 @@ android { testOptions.unitTests.isIncludeAndroidResources = true } +// Enable Kotlin "Explicit API Mode". This causes the Kotlin compiler to fail if any +// classes, methods, or properties have implicit `public` visibility. This check helps +// avoid accidentally leaking elements into the public API, requiring that any public +// element be explicitly declared as `public`. +// https://github.com/Kotlin/KEEP/blob/master/proposals/explicit-api-mode.md +// https://chao2zhang.medium.com/explicit-api-mode-for-kotlin-on-android-b8264fdd76d1 +tasks.withType().all { + if (!name.contains("test", ignoreCase = true)) { + if (!kotlinOptions.freeCompilerArgs.contains("-Xexplicit-api=strict")) { + kotlinOptions.freeCompilerArgs += "-Xexplicit-api=strict" + } + } +} + dependencies { javadocClasspath("org.codehaus.mojo:animal-sniffer-annotations:1.21") javadocClasspath(libs.autovalue.annotations) diff --git a/firebase-functions/src/main/java/com/google/firebase/functions/FirebaseFunctions.kt b/firebase-functions/src/main/java/com/google/firebase/functions/FirebaseFunctions.kt index cd87de4baaa..3f5fe5d63d9 100644 --- a/firebase-functions/src/main/java/com/google/firebase/functions/FirebaseFunctions.kt +++ b/firebase-functions/src/main/java/com/google/firebase/functions/FirebaseFunctions.kt @@ -47,7 +47,7 @@ import org.json.JSONException import org.json.JSONObject /** FirebaseFunctions lets you call Cloud Functions for Firebase. */ -class FirebaseFunctions +public class FirebaseFunctions @AssistedInject internal constructor( context: Context, @@ -105,22 +105,25 @@ internal constructor( } /** Returns a reference to the callable HTTPS trigger with the given name. */ - fun getHttpsCallable(name: String): HttpsCallableReference { + public fun getHttpsCallable(name: String): HttpsCallableReference { return HttpsCallableReference(this, name, HttpsCallOptions()) } /** Returns a reference to the callable HTTPS trigger with the provided URL. */ - fun getHttpsCallableFromUrl(url: URL): HttpsCallableReference { + public fun getHttpsCallableFromUrl(url: URL): HttpsCallableReference { return HttpsCallableReference(this, url, HttpsCallOptions()) } /** Returns a reference to the callable HTTPS trigger with the given name and call options. */ - fun getHttpsCallable(name: String, options: HttpsCallableOptions): HttpsCallableReference { + public fun getHttpsCallable(name: String, options: HttpsCallableOptions): HttpsCallableReference { return HttpsCallableReference(this, name, HttpsCallOptions(options)) } /** Returns a reference to the callable HTTPS trigger with the provided URL and call options. */ - fun getHttpsCallableFromUrl(url: URL, options: HttpsCallableOptions): HttpsCallableReference { + public fun getHttpsCallableFromUrl( + url: URL, + options: HttpsCallableOptions + ): HttpsCallableReference { return HttpsCallableReference(this, url, HttpsCallOptions(options)) } @@ -149,7 +152,7 @@ internal constructor( } @Deprecated("Use {@link #useEmulator(String, int)} to connect to the emulator. ") - fun useFunctionsEmulator(origin: String) { + public fun useFunctionsEmulator(origin: String) { Preconditions.checkNotNull(origin, "origin cannot be null") urlFormat = "$origin/%2\$s/%1\$s/%3\$s" } @@ -162,7 +165,7 @@ internal constructor( * @param host the emulator host (for example, 10.0.2.2) * @param port the emulator port (for example, 5001) */ - fun useEmulator(host: String, port: Int) { + public fun useEmulator(host: String, port: Int) { emulatorSettings = EmulatedServiceSettings(host, port) } @@ -318,7 +321,7 @@ internal constructor( return tcs.task } - companion object { + public companion object { /** A task that will be resolved once ProviderInstaller has installed what it needs to. */ private val providerInstalled = TaskCompletionSource() @@ -370,7 +373,7 @@ internal constructor( * `"us-central1"` or `"https://mydomain.com"`. */ @JvmStatic - fun getInstance(app: FirebaseApp, regionOrCustomDomain: String): FirebaseFunctions { + public fun getInstance(app: FirebaseApp, regionOrCustomDomain: String): FirebaseFunctions { Preconditions.checkNotNull(app, "You must call FirebaseApp.initializeApp first.") Preconditions.checkNotNull(regionOrCustomDomain) val component = app.get(FunctionsMultiResourceComponent::class.java) @@ -384,7 +387,7 @@ internal constructor( * @param app The app for the Firebase project. */ @JvmStatic - fun getInstance(app: FirebaseApp): FirebaseFunctions { + public fun getInstance(app: FirebaseApp): FirebaseFunctions { return getInstance(app, "us-central1") } @@ -395,13 +398,13 @@ internal constructor( * `"us-central1"` or `"https://mydomain.com"`. */ @JvmStatic - fun getInstance(regionOrCustomDomain: String): FirebaseFunctions { + public fun getInstance(regionOrCustomDomain: String): FirebaseFunctions { return getInstance(FirebaseApp.getInstance(), regionOrCustomDomain) } /** Creates a Cloud Functions client with the default app. */ @JvmStatic - fun getInstance(): FirebaseFunctions { + public fun getInstance(): FirebaseFunctions { return getInstance(FirebaseApp.getInstance(), "us-central1") } } diff --git a/firebase-functions/src/main/java/com/google/firebase/functions/FirebaseFunctionsException.kt b/firebase-functions/src/main/java/com/google/firebase/functions/FirebaseFunctionsException.kt index fce7514eca4..1d8653a521c 100644 --- a/firebase-functions/src/main/java/com/google/firebase/functions/FirebaseFunctionsException.kt +++ b/firebase-functions/src/main/java/com/google/firebase/functions/FirebaseFunctionsException.kt @@ -21,13 +21,13 @@ import org.json.JSONObject // TODO: This is a copy of FirebaseFirestoreException. // We should investigate whether we can at least share the Code enum. /** The class for all Exceptions thrown by FirebaseFunctions. */ -class FirebaseFunctionsException : FirebaseException { +public class FirebaseFunctionsException : FirebaseException { /** * The set of error status codes that can be returned from a Callable HTTPS tigger. These are the * canonical error codes for Google APIs, as documented here: * https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto#L26 */ - enum class Code(private val value: Int) { + public enum class Code(private val value: Int) { /** * The operation completed successfully. FirebaseFunctionsException will never have a status of * OK. @@ -105,7 +105,7 @@ class FirebaseFunctionsException : FirebaseException { /** The request does not have valid authentication credentials for the operation. */ UNAUTHENTICATED(16); - companion object { + public companion object { // Create the canonical list of Status instances indexed by their code values. private val STATUS_LIST = buildStatusList() private fun buildStatusList(): SparseArray { @@ -121,7 +121,7 @@ class FirebaseFunctionsException : FirebaseException { } @JvmStatic - fun fromValue(value: Int): Code { + public fun fromValue(value: Int): Code { return STATUS_LIST[value, UNKNOWN] } @@ -134,7 +134,7 @@ class FirebaseFunctionsException : FirebaseException { * @return The corresponding Code, or Code.UNKNOWN if none. */ @JvmStatic - fun fromHttpStatus(status: Int): Code { + public fun fromHttpStatus(status: Int): Code { when (status) { 200 -> return OK 400 -> return INVALID_ARGUMENT @@ -159,14 +159,14 @@ class FirebaseFunctionsException : FirebaseException { * * @return the code for the FirebaseFunctionsException */ - val code: Code + public val code: Code /** * Gets the details object, if one was included in the error response. * * @return the object included in the "details" field of the response. */ - val details: Any? + public val details: Any? internal constructor(message: String, code: Code, details: Any?) : super(message) { this.code = code @@ -183,7 +183,7 @@ class FirebaseFunctionsException : FirebaseException { this.details = details } - companion object { + public companion object { /** * Takes an HTTP response and returns the corresponding Exception if any. * @@ -193,7 +193,7 @@ class FirebaseFunctionsException : FirebaseException { * @return The corresponding Exception, or null if none. */ @JvmStatic - fun fromResponse( + public fun fromResponse( code: Code, body: String?, serializer: Serializer diff --git a/firebase-functions/src/main/java/com/google/firebase/functions/Functions.kt b/firebase-functions/src/main/java/com/google/firebase/functions/Functions.kt index 14ab9dc5809..97d8f2734fd 100644 --- a/firebase-functions/src/main/java/com/google/firebase/functions/Functions.kt +++ b/firebase-functions/src/main/java/com/google/firebase/functions/Functions.kt @@ -24,28 +24,29 @@ import com.google.firebase.components.ComponentRegistrar import java.net.URL /** Returns the [FirebaseFunctions] instance of the default [FirebaseApp]. */ -val Firebase.functions: FirebaseFunctions +public val Firebase.functions: FirebaseFunctions get() = FirebaseFunctions.getInstance() /** Returns the [FirebaseFunctions] instance of a given [regionOrCustomDomain]. */ -fun Firebase.functions(regionOrCustomDomain: String): FirebaseFunctions = +public fun Firebase.functions(regionOrCustomDomain: String): FirebaseFunctions = FirebaseFunctions.getInstance(regionOrCustomDomain) /** Returns the [FirebaseFunctions] instance of a given [FirebaseApp]. */ -fun Firebase.functions(app: FirebaseApp): FirebaseFunctions = FirebaseFunctions.getInstance(app) +public fun Firebase.functions(app: FirebaseApp): FirebaseFunctions = + FirebaseFunctions.getInstance(app) /** Returns the [FirebaseFunctions] instance of a given [FirebaseApp] and [regionOrCustomDomain]. */ -fun Firebase.functions(app: FirebaseApp, regionOrCustomDomain: String): FirebaseFunctions = +public fun Firebase.functions(app: FirebaseApp, regionOrCustomDomain: String): FirebaseFunctions = FirebaseFunctions.getInstance(app, regionOrCustomDomain) /** @suppress */ @Keep -class FirebaseFunctionsKtxRegistrar : ComponentRegistrar { +public class FirebaseFunctionsKtxRegistrar : ComponentRegistrar { override fun getComponents(): List> = listOf() } /** Returns a reference to the Callable HTTPS trigger with the given name and call options. */ -fun FirebaseFunctions.getHttpsCallable( +public fun FirebaseFunctions.getHttpsCallable( name: String, init: HttpsCallableOptions.Builder.() -> Unit ): HttpsCallableReference { @@ -55,7 +56,7 @@ fun FirebaseFunctions.getHttpsCallable( } /** Returns a reference to the Callable HTTPS trigger with the given URL and call options. */ -fun FirebaseFunctions.getHttpsCallableFromUrl( +public fun FirebaseFunctions.getHttpsCallableFromUrl( url: URL, init: HttpsCallableOptions.Builder.() -> Unit ): HttpsCallableReference { diff --git a/firebase-functions/src/main/java/com/google/firebase/functions/FunctionsRegistrar.kt b/firebase-functions/src/main/java/com/google/firebase/functions/FunctionsRegistrar.kt index 3e9d33869a5..ec774d6e479 100644 --- a/firebase-functions/src/main/java/com/google/firebase/functions/FunctionsRegistrar.kt +++ b/firebase-functions/src/main/java/com/google/firebase/functions/FunctionsRegistrar.kt @@ -36,7 +36,7 @@ import java.util.concurrent.Executor * @hide */ @Keep -class FunctionsRegistrar : ComponentRegistrar { +public class FunctionsRegistrar : ComponentRegistrar { override fun getComponents(): List> { val liteExecutor = Qualified.qualified(Lightweight::class.java, Executor::class.java) val uiExecutor = Qualified.qualified(UiThread::class.java, Executor::class.java) @@ -67,7 +67,7 @@ class FunctionsRegistrar : ComponentRegistrar { ) } - companion object { + private companion object { private const val LIBRARY_NAME = "fire-fn" } } diff --git a/firebase-functions/src/main/java/com/google/firebase/functions/HttpsCallOptions.kt b/firebase-functions/src/main/java/com/google/firebase/functions/HttpsCallOptions.kt index 0a180b289a1..6e36efffe18 100644 --- a/firebase-functions/src/main/java/com/google/firebase/functions/HttpsCallOptions.kt +++ b/firebase-functions/src/main/java/com/google/firebase/functions/HttpsCallOptions.kt @@ -17,22 +17,22 @@ import java.util.concurrent.TimeUnit import okhttp3.OkHttpClient /** An internal class for keeping track of options applied to an HttpsCallableReference. */ -class HttpsCallOptions { +public class HttpsCallOptions { // The timeout to use for calls from references created by this Functions. private var timeout = DEFAULT_TIMEOUT private var timeoutUnits = DEFAULT_TIMEOUT_UNITS - @JvmField val limitedUseAppCheckTokens: Boolean + @JvmField public val limitedUseAppCheckTokens: Boolean /** Creates an (internal) HttpsCallOptions from the (external) [HttpsCallableOptions]. */ - constructor(publicCallableOptions: HttpsCallableOptions) { + public constructor(publicCallableOptions: HttpsCallableOptions) { limitedUseAppCheckTokens = publicCallableOptions.limitedUseAppCheckTokens } - constructor() { + public constructor() { limitedUseAppCheckTokens = false } - fun getLimitedUseAppCheckTokens(): Boolean { + public fun getLimitedUseAppCheckTokens(): Boolean { return limitedUseAppCheckTokens } @@ -42,7 +42,7 @@ class HttpsCallOptions { * @param timeout The length of the timeout, in the given units. * @param units The units for the specified timeout. */ - fun setTimeout(timeout: Long, units: TimeUnit) { + public fun setTimeout(timeout: Long, units: TimeUnit) { this.timeout = timeout timeoutUnits = units } @@ -52,12 +52,12 @@ class HttpsCallOptions { * * @return The timeout, in milliseconds. */ - fun getTimeout(): Long { + public fun getTimeout(): Long { return timeoutUnits.toMillis(timeout) } /** Creates a new OkHttpClient with these options applied to it. */ - fun apply(client: OkHttpClient): OkHttpClient { + public fun apply(client: OkHttpClient): OkHttpClient { return client .newBuilder() .callTimeout(timeout, timeoutUnits) @@ -65,7 +65,7 @@ class HttpsCallOptions { .build() } - companion object { + private companion object { // The default timeout to use for all calls. private const val DEFAULT_TIMEOUT: Long = 70 private val DEFAULT_TIMEOUT_UNITS = TimeUnit.SECONDS diff --git a/firebase-functions/src/main/java/com/google/firebase/functions/HttpsCallableOptions.kt b/firebase-functions/src/main/java/com/google/firebase/functions/HttpsCallableOptions.kt index e0952bffa2a..32b05afded2 100644 --- a/firebase-functions/src/main/java/com/google/firebase/functions/HttpsCallableOptions.kt +++ b/firebase-functions/src/main/java/com/google/firebase/functions/HttpsCallableOptions.kt @@ -18,25 +18,25 @@ package com.google.firebase.functions * * These properties are immutable once a callable function reference is instantiated. */ -class HttpsCallableOptions +public class HttpsCallableOptions private constructor( /** * Returns the setting indicating if limited-use App Check tokens are enforced for this function. */ // If true, request a limited-use token from AppCheck. - @JvmField val limitedUseAppCheckTokens: Boolean + @JvmField public val limitedUseAppCheckTokens: Boolean ) { - fun getLimitedUseAppCheckTokens(): Boolean { + public fun getLimitedUseAppCheckTokens(): Boolean { return limitedUseAppCheckTokens } /** Builder class for [com.google.firebase.functions.HttpsCallableOptions] */ - class Builder { - @JvmField var limitedUseAppCheckTokens = false + public class Builder { + @JvmField public var limitedUseAppCheckTokens: Boolean = false /** Returns the setting indicating if limited-use App Check tokens are enforced. */ - fun getLimitedUseAppCheckTokens(): Boolean { + public fun getLimitedUseAppCheckTokens(): Boolean { return limitedUseAppCheckTokens } @@ -44,13 +44,13 @@ private constructor( * Sets whether or not to use limited-use App Check tokens when invoking the associated * function. */ - fun setLimitedUseAppCheckTokens(limitedUse: Boolean): Builder { + public fun setLimitedUseAppCheckTokens(limitedUse: Boolean): Builder { limitedUseAppCheckTokens = limitedUse return this } /** Builds a new [com.google.firebase.functions.HttpsCallableOptions]. */ - fun build(): HttpsCallableOptions { + public fun build(): HttpsCallableOptions { return HttpsCallableOptions(limitedUseAppCheckTokens) } } diff --git a/firebase-functions/src/main/java/com/google/firebase/functions/HttpsCallableReference.kt b/firebase-functions/src/main/java/com/google/firebase/functions/HttpsCallableReference.kt index 9d80bf69b32..90bdb63221b 100644 --- a/firebase-functions/src/main/java/com/google/firebase/functions/HttpsCallableReference.kt +++ b/firebase-functions/src/main/java/com/google/firebase/functions/HttpsCallableReference.kt @@ -19,7 +19,7 @@ import java.net.URL import java.util.concurrent.TimeUnit /** A reference to a particular Callable HTTPS trigger in Cloud Functions. */ -class HttpsCallableReference { +public class HttpsCallableReference { // The functions client to use for making calls. private val functionsClient: FirebaseFunctions @@ -32,7 +32,7 @@ class HttpsCallableReference { private val url: URL? // Options for how to do the HTTPS call. - @VisibleForTesting val options: HttpsCallOptions + @VisibleForTesting public val options: HttpsCallOptions /** Creates a new reference with the given options. */ internal constructor( @@ -95,7 +95,7 @@ class HttpsCallableReference { * * @see FirebaseFunctionsException */ - fun call(data: Any?): Task { + public fun call(data: Any?): Task { return if (name != null) { functionsClient.call(name, data, options) } else { @@ -117,7 +117,7 @@ class HttpsCallableReference { * * @return A Task that will be completed when the HTTPS request has completed. */ - fun call(): Task { + public fun call(): Task { return if (name != null) { functionsClient.call(name, null, options) } else { @@ -131,11 +131,11 @@ class HttpsCallableReference { * @param timeout The length of the timeout, in the given units. * @param units The units for the specified timeout. */ - fun setTimeout(timeout: Long, units: TimeUnit) { + public fun setTimeout(timeout: Long, units: TimeUnit) { options.setTimeout(timeout, units) } - val timeout: Long + public val timeout: Long /** * Returns the timeout for calls from this instance of Functions. * @@ -149,7 +149,7 @@ class HttpsCallableReference { * @param timeout The length of the timeout, in the given units. * @param units The units for the specified timeout. */ - fun withTimeout(timeout: Long, units: TimeUnit): HttpsCallableReference { + public fun withTimeout(timeout: Long, units: TimeUnit): HttpsCallableReference { val other = HttpsCallableReference(functionsClient, name, options) other.setTimeout(timeout, units) return other diff --git a/firebase-functions/src/main/java/com/google/firebase/functions/HttpsCallableResult.kt b/firebase-functions/src/main/java/com/google/firebase/functions/HttpsCallableResult.kt index 69b8aaf5d47..ddda0ea57bb 100644 --- a/firebase-functions/src/main/java/com/google/firebase/functions/HttpsCallableResult.kt +++ b/firebase-functions/src/main/java/com/google/firebase/functions/HttpsCallableResult.kt @@ -14,7 +14,7 @@ package com.google.firebase.functions /** The result of calling a HttpsCallableReference function. */ -class HttpsCallableResult +public class HttpsCallableResult internal constructor( // The actual result data, as generic types decoded from JSON. private val data: Any?) { /** @@ -24,7 +24,7 @@ private val data: Any?) { * this object would be a List. If your trigger returned a JavaScript object with keys and * values, this object would be a Map. */ - fun getData(): Any? { + public fun getData(): Any? { return data } } diff --git a/firebase-functions/src/main/java/com/google/firebase/functions/Serializer.kt b/firebase-functions/src/main/java/com/google/firebase/functions/Serializer.kt index 6157cafd22a..fac34490845 100644 --- a/firebase-functions/src/main/java/com/google/firebase/functions/Serializer.kt +++ b/firebase-functions/src/main/java/com/google/firebase/functions/Serializer.kt @@ -23,7 +23,7 @@ import org.json.JSONException import org.json.JSONObject /** Converts raw Java types into JSON objects. */ -class Serializer { +public class Serializer { private val dateFormat: DateFormat init { @@ -32,7 +32,7 @@ class Serializer { dateFormat.timeZone = TimeZone.getTimeZone("UTC") } - fun encode(obj: Any?): Any { + public fun encode(obj: Any?): Any { if (obj == null || obj === JSONObject.NULL) { return JSONObject.NULL } @@ -113,7 +113,7 @@ class Serializer { throw IllegalArgumentException("Object cannot be encoded in JSON: $obj") } - fun decode(obj: Any): Any? { + public fun decode(obj: Any): Any? { // TODO: Maybe this should throw a FirebaseFunctionsException instead? if (obj is Number) { return obj @@ -170,10 +170,11 @@ class Serializer { throw IllegalArgumentException("Object cannot be decoded from JSON: $obj") } - companion object { - @VisibleForTesting const val LONG_TYPE = "type.googleapis.com/google.protobuf.Int64Value" + public companion object { + @VisibleForTesting + public const val LONG_TYPE: String = "type.googleapis.com/google.protobuf.Int64Value" @VisibleForTesting - const val UNSIGNED_LONG_TYPE = "type.googleapis.com/google.protobuf.UInt64Value" + public const val UNSIGNED_LONG_TYPE: String = "type.googleapis.com/google.protobuf.UInt64Value" } } diff --git a/firebase-functions/src/main/java/com/google/firebase/functions/ktx/Functions.kt b/firebase-functions/src/main/java/com/google/firebase/functions/ktx/Functions.kt index c0a18428f29..c69d487ba05 100644 --- a/firebase-functions/src/main/java/com/google/firebase/functions/ktx/Functions.kt +++ b/firebase-functions/src/main/java/com/google/firebase/functions/ktx/Functions.kt @@ -37,7 +37,7 @@ import java.net.URL * longer release KTX modules. For details, see the * [FAQ about this initiative.](https://firebase.google.com/docs/android/kotlin-migration) */ -val Firebase.functions: FirebaseFunctions +public val Firebase.functions: FirebaseFunctions get() = FirebaseFunctions.getInstance() /** @@ -51,7 +51,7 @@ val Firebase.functions: FirebaseFunctions * longer release KTX modules. For details, see the * [FAQ about this initiative.](https://firebase.google.com/docs/android/kotlin-migration) */ -fun Firebase.functions(regionOrCustomDomain: String): FirebaseFunctions = +public fun Firebase.functions(regionOrCustomDomain: String): FirebaseFunctions = FirebaseFunctions.getInstance(regionOrCustomDomain) /** @@ -65,7 +65,8 @@ fun Firebase.functions(regionOrCustomDomain: String): FirebaseFunctions = * longer release KTX modules. For details, see the * [FAQ about this initiative.](https://firebase.google.com/docs/android/kotlin-migration) */ -fun Firebase.functions(app: FirebaseApp): FirebaseFunctions = FirebaseFunctions.getInstance(app) +public fun Firebase.functions(app: FirebaseApp): FirebaseFunctions = + FirebaseFunctions.getInstance(app) /** * Accessing this object for Kotlin apps has changed; see the @@ -78,7 +79,7 @@ fun Firebase.functions(app: FirebaseApp): FirebaseFunctions = FirebaseFunctions. * longer release KTX modules. For details, see the * [FAQ about this initiative.](https://firebase.google.com/docs/android/kotlin-migration) */ -fun Firebase.functions(app: FirebaseApp, regionOrCustomDomain: String): FirebaseFunctions = +public fun Firebase.functions(app: FirebaseApp, regionOrCustomDomain: String): FirebaseFunctions = FirebaseFunctions.getInstance(app, regionOrCustomDomain) /** @@ -94,7 +95,7 @@ fun Firebase.functions(app: FirebaseApp, regionOrCustomDomain: String): Firebase ReplaceWith("") ) @Keep -class FirebaseFunctionsKtxRegistrar : ComponentRegistrar { +public class FirebaseFunctionsKtxRegistrar : ComponentRegistrar { override fun getComponents(): List> = listOf() } @@ -110,7 +111,7 @@ class FirebaseFunctionsKtxRegistrar : ComponentRegistrar { "Migrate to use the KTX API from the main module: https://firebase.google.com/docs/android/kotlin-migration.", ReplaceWith("") ) -fun FirebaseFunctions.getHttpsCallable( +public fun FirebaseFunctions.getHttpsCallable( name: String, init: HttpsCallableOptions.Builder.() -> Unit ): HttpsCallableReference { @@ -131,7 +132,7 @@ fun FirebaseFunctions.getHttpsCallable( "Migrate to use the KTX API from the main module: https://firebase.google.com/docs/android/kotlin-migration.", ReplaceWith("") ) -fun FirebaseFunctions.getHttpsCallableFromUrl( +public fun FirebaseFunctions.getHttpsCallableFromUrl( url: URL, init: HttpsCallableOptions.Builder.() -> Unit ): HttpsCallableReference { diff --git a/firebase-inappmessaging-display/CHANGELOG.md b/firebase-inappmessaging-display/CHANGELOG.md index 0f1802212bd..37e5082722e 100644 --- a/firebase-inappmessaging-display/CHANGELOG.md +++ b/firebase-inappmessaging-display/CHANGELOG.md @@ -1,6 +1,6 @@ # Unreleased * [changed] Updated protobuf dependency to `3.25.5` to fix - [CVE-2024-7254](https://github.com/advisories/GHSA-735f-pc8j-v9w8). + [CVE-2024-7254](https://nvd.nist.gov/vuln/detail/CVE-2024-7254). # 21.0.0 * [fixed] Fixed bad token exception while showing FIAM diff --git a/firebase-inappmessaging/CHANGELOG.md b/firebase-inappmessaging/CHANGELOG.md index 925b7b5946c..2d4866bdb17 100644 --- a/firebase-inappmessaging/CHANGELOG.md +++ b/firebase-inappmessaging/CHANGELOG.md @@ -1,6 +1,6 @@ # Unreleased * [changed] Updated protobuf dependency to `3.25.5` to fix - [CVE-2024-7254](https://github.com/advisories/GHSA-735f-pc8j-v9w8). + [CVE-2024-7254](https://nvd.nist.gov/vuln/detail/CVE-2024-7254). # 21.0.0 * [fixed] Fixed bad token exception while showing FIAM diff --git a/firebase-messaging/CHANGELOG.md b/firebase-messaging/CHANGELOG.md index 5ada883e7df..b8954ec2a44 100644 --- a/firebase-messaging/CHANGELOG.md +++ b/firebase-messaging/CHANGELOG.md @@ -1,6 +1,6 @@ # Unreleased * [changed] Updated protobuf dependency to `3.25.5` to fix - [CVE-2024-7254](https://github.com/advisories/GHSA-735f-pc8j-v9w8). + [CVE-2024-7254](https://nvd.nist.gov/vuln/detail/CVE-2024-7254). # 24.0.2 diff --git a/firebase-ml-modeldownloader/CHANGELOG.md b/firebase-ml-modeldownloader/CHANGELOG.md index 42b870167fa..c812eb57673 100644 --- a/firebase-ml-modeldownloader/CHANGELOG.md +++ b/firebase-ml-modeldownloader/CHANGELOG.md @@ -1,6 +1,6 @@ # Unreleased * [changed] Updated protobuf dependency to `3.25.5` to fix - [CVE-2024-7254](https://github.com/advisories/GHSA-735f-pc8j-v9w8). + [CVE-2024-7254](https://nvd.nist.gov/vuln/detail/CVE-2024-7254). # 25.0.0 diff --git a/firebase-perf/CHANGELOG.md b/firebase-perf/CHANGELOG.md index 8f376deff25..b41c7be9f3b 100644 --- a/firebase-perf/CHANGELOG.md +++ b/firebase-perf/CHANGELOG.md @@ -1,7 +1,8 @@ # Unreleased -* [fixed] Fix IllegalStateException when starting a trace before Firebase initializes. +* [fixed] Fixed `IllegalStateException` that happened when starting a trace + before Firebase initializes. * [changed] Updated protobuf dependency to `3.25.5` to fix - [CVE-2024-7254](https://github.com/advisories/GHSA-735f-pc8j-v9w8). + [CVE-2024-7254](https://nvd.nist.gov/vuln/detail/CVE-2024-7254). # 21.0.1 * [fixed] Fixed an `ExceptionInInitializerError` where the `url.openStream()` causes a crash if diff --git a/firebase-vertexai/CHANGELOG.md b/firebase-vertexai/CHANGELOG.md index 6a9a7c8b170..0934014cc36 100644 --- a/firebase-vertexai/CHANGELOG.md +++ b/firebase-vertexai/CHANGELOG.md @@ -1,4 +1,18 @@ # Unreleased +* [feature] {{firebase_vertexai}} is now Generally Available (GA) and can be + used in production apps. + + Use the {{firebase_vertexai_sdk}} to call the {{gemini_api_vertexai_long}} + directly from your app. This client SDK is built specifically for use with + Android apps, offering security options against unauthorized clients + as well as integrations with other Firebase services. + + * If you're new to this library, visit the + [getting started guide](/docs/vertex-ai/get-started?platform=android). + + * If you were using the preview version of the library, visit the + [migration guide](/docs/vertex-ai/migrate-to-ga?platform=android) to learn + about some important updates. * [changed] **Breaking Change**: Changed `functionCallingConfig` parameter type to be nullable in `ToolConfig`. (#6373) * [changed] **Breaking Change**: Removed `functionResponse` accessor method from `GenerateContentResponse`. (#6373) * [changed] **Breaking Change**: Migrated `FirebaseVertexAIException` from a sealed class to an abstract class, and marked constructors as internal. (#6368) @@ -18,6 +32,7 @@ * [changed] **Breaking Change**: Replaced sealed classes with abstract classes for `StringFormat`. (#6334) * [changed] **Breaking Change**: Refactored enum classes to be normal classes. (#6340) * [changed] **Breaking Change**: Marked `GenerativeModel` properties as private. (#6309) +* [changed] **Breaking Change**: Changed `method` parameter type to be nullable in `SafetySettings`. (#6379) # 16.0.0-beta05 diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/FirebaseVertexAI.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/FirebaseVertexAI.kt index 5b81177b8d5..ff256482112 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/FirebaseVertexAI.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/FirebaseVertexAI.kt @@ -42,7 +42,7 @@ internal constructor( /** * Instantiates a new [GenerativeModel] given the provided parameters. * - * @param modelName The name of the model to use, for example "gemini-1.5-pro". + * @param modelName The name of the model to use, for example `"gemini-1.5-pro"`. * @param generationConfig The configuration parameters to use for content generation. * @param safetySettings The safety bounds the model will abide to during content generation. * @param tools A list of [Tool]s the model may use to generate content. diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/internal/util/conversions.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/internal/util/conversions.kt index 793aeeae659..80542eebe85 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/internal/util/conversions.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/internal/util/conversions.kt @@ -100,7 +100,7 @@ internal fun SafetySetting.toInternal() = com.google.firebase.vertexai.common.shared.SafetySetting( harmCategory.toInternal(), threshold.toInternal(), - method.toInternal() + method?.toInternal() ) internal fun makeMissingCaseException(source: String, ordinal: Int): SerializationException { diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/java/ChatFutures.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/java/ChatFutures.kt index a6a4212fbd6..2025342ff6e 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/java/ChatFutures.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/java/ChatFutures.kt @@ -21,6 +21,7 @@ import com.google.common.util.concurrent.ListenableFuture import com.google.firebase.vertexai.Chat import com.google.firebase.vertexai.type.Content import com.google.firebase.vertexai.type.GenerateContentResponse +import com.google.firebase.vertexai.type.InvalidStateException import kotlinx.coroutines.reactive.asPublisher import org.reactivestreams.Publisher diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/java/GenerativeModelFutures.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/java/GenerativeModelFutures.kt index 9b7d2b1c1a9..eae7603924b 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/java/GenerativeModelFutures.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/java/GenerativeModelFutures.kt @@ -22,6 +22,7 @@ import com.google.firebase.vertexai.GenerativeModel import com.google.firebase.vertexai.java.ChatFutures.Companion.from import com.google.firebase.vertexai.type.Content import com.google.firebase.vertexai.type.CountTokensResponse +import com.google.firebase.vertexai.type.FirebaseVertexAIException import com.google.firebase.vertexai.type.GenerateContentResponse import kotlinx.coroutines.reactive.asPublisher import org.reactivestreams.Publisher @@ -65,13 +66,13 @@ public abstract class GenerativeModelFutures internal constructor() { public abstract fun countTokens(vararg prompt: Content): ListenableFuture /** - * Creates a [ChatFuture] instance which internally tracks the ongoing conversation with the + * Creates a [ChatFutures] instance which internally tracks the ongoing conversation with the * model. */ public abstract fun startChat(): ChatFutures /** - * Creates a [ChatFuture] instance, initialized using the optionally provided [history]. + * Creates a [ChatFutures] instance, initialized using the optionally provided [history]. * * @param history A list of previous interactions with the model to use as a starting point */ diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Content.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Content.kt index 0168f524de8..ec3e9555741 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Content.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Content.kt @@ -24,8 +24,8 @@ import android.graphics.Bitmap * `Content` is composed of a one or more heterogeneous parts that can be represent data in * different formats, like text or images. * - * @param role The producer of the content. Must be either 'user' or 'model'. By default, it's - * "user". + * @param role The producer of the content. Must be either `"user"` or `"model"`. By default, it's + * `"user"`. * @param parts An ordered list of [Part] that constitute this content. */ public class Content diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/SafetySetting.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/SafetySetting.kt index 752353f8e4f..68d7f93aa99 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/SafetySetting.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/SafetySetting.kt @@ -22,10 +22,11 @@ package com.google.firebase.vertexai.type * * @param harmCategory The relevant [HarmCategory]. * @param threshold The threshold form harm allowable. - * @param method Specify if the threshold is used for probability or severity score. + * @param method Specify if the threshold is used for probability or severity score, if not + * specified it will default to [HarmBlockMethod.PROBABILITY]. */ public class SafetySetting( internal val harmCategory: HarmCategory, internal val threshold: HarmBlockThreshold, - internal val method: HarmBlockMethod = HarmBlockMethod.PROBABILITY + internal val method: HarmBlockMethod? = null, ) diff --git a/smoke-tests/src/androidTest/backend/functions/functions/package-lock.json b/smoke-tests/src/androidTest/backend/functions/functions/package-lock.json index fab7355b419..3a907a07b1a 100644 --- a/smoke-tests/src/androidTest/backend/functions/functions/package-lock.json +++ b/smoke-tests/src/androidTest/backend/functions/functions/package-lock.json @@ -1432,9 +1432,9 @@ "dev": true }, "node_modules/fast-xml-parser": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.3.6.tgz", - "integrity": "sha512-M2SovcRxD4+vC493Uc2GZVcZaj66CCJhWurC4viynVSTvrpErCShNcDz1lAho6n9REQKvL/ll4A4/fw6Y9z8nw==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.5.0.tgz", + "integrity": "sha512-/PlTQCI96+fZMAOLMZK4CWG1ItCbfZ/0jx7UIJFChPNrx7tcEgerUgWbeieCM9MfHInUDyK8DWYZ+YrywDJuTg==", "funding": [ { "type": "github", @@ -4463,9 +4463,9 @@ "dev": true }, "fast-xml-parser": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.3.6.tgz", - "integrity": "sha512-M2SovcRxD4+vC493Uc2GZVcZaj66CCJhWurC4viynVSTvrpErCShNcDz1lAho6n9REQKvL/ll4A4/fw6Y9z8nw==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.5.0.tgz", + "integrity": "sha512-/PlTQCI96+fZMAOLMZK4CWG1ItCbfZ/0jx7UIJFChPNrx7tcEgerUgWbeieCM9MfHInUDyK8DWYZ+YrywDJuTg==", "optional": true, "requires": { "strnum": "^1.0.5" diff --git a/transport/transport-backend-cct/CHANGELOG.md b/transport/transport-backend-cct/CHANGELOG.md index 59b34e15bf1..4b5fdb709aa 100644 --- a/transport/transport-backend-cct/CHANGELOG.md +++ b/transport/transport-backend-cct/CHANGELOG.md @@ -1,6 +1,6 @@ # Unreleased * [changed] Updated protobuf dependency to `3.25.5` to fix - [CVE-2024-7254](https://github.com/advisories/GHSA-735f-pc8j-v9w8). + [CVE-2024-7254](https://nvd.nist.gov/vuln/detail/CVE-2024-7254). # 3.3.0 diff --git a/transport/transport-runtime/CHANGELOG.md b/transport/transport-runtime/CHANGELOG.md index 451c89e3279..37fb32d599a 100644 --- a/transport/transport-runtime/CHANGELOG.md +++ b/transport/transport-runtime/CHANGELOG.md @@ -1,6 +1,6 @@ # Unreleased * [changed] Updated protobuf dependency to `3.25.5` to fix - [CVE-2024-7254](https://github.com/advisories/GHSA-735f-pc8j-v9w8). + [CVE-2024-7254](https://nvd.nist.gov/vuln/detail/CVE-2024-7254). # 3.3.0