From f53b5984107b129772a20e1951c48d83b465a21c Mon Sep 17 00:00:00 2001 From: Gabriel Feo Date: Thu, 28 Mar 2024 17:04:58 +0000 Subject: [PATCH] Deprecate keychain support (#164) Keychain support can be removed to simplify the library, considering that there are numerous ways to use an environment variable without storing the key as plain-text. For example, using password manager CLIs or exporting from keychain to variable each time `TOKEN=$(security ...) my-script.main.kts`. --- .../gabrielfeo/gradle/enterprise/api/internal/Keychain.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/library/src/main/kotlin/com/gabrielfeo/gradle/enterprise/api/internal/Keychain.kt b/library/src/main/kotlin/com/gabrielfeo/gradle/enterprise/api/internal/Keychain.kt index 1fec3fc9..78b4ac10 100644 --- a/library/src/main/kotlin/com/gabrielfeo/gradle/enterprise/api/internal/Keychain.kt +++ b/library/src/main/kotlin/com/gabrielfeo/gradle/enterprise/api/internal/Keychain.kt @@ -26,9 +26,15 @@ internal class RealKeychain( if (status != 0) { return KeychainResult.Error("exit $status") } + println(KEYCHAIN_DEPRECATION_WARNING) val token = process.inputStream.bufferedReader().use { it.readText().trim() } return KeychainResult.Success(token) } } + +private const val KEYCHAIN_DEPRECATION_WARNING = + "WARNING: passing token via macOS keychain is deprecated. Please pass it as the " + + "GRADLE_ENTERPRISE_API_TOKEN environment variable instead. Keychain support will be " + + "removed in the next release. See release notes for details and alternatives."