feat: allow explicitly setting the credentials#100
feat: allow explicitly setting the credentials#100gpoulin wants to merge 1 commit intoabdolence:masterfrom
Conversation
|
Thanks for the contribution, but I'm sorry this can't be merged since it is intentional design to separate sensitive keys from sbt files. With this design private keys can leak easily to the source code repositories, etc - so it is not recommended and shouldn't be designed this way. |
|
The credentials can be build in various way that don't involve putting the credentials in an sbt file. The use case we have is to be able to reload the credentials when the default application credentials file is updated. Our company has a policy that limit the user credentials lifetime, requiring dev to re-login the default application credentials often. At the moment, they also need to restart any sbt process so the credentials can be updated. This restart of sbt could be avoided if the |
|
I can't see how this change fixes the hot reload issue, since
I disagree, secure by design should be the strategy for all tooling, including sbt plugins. |
|
The For the reloading class ReloadingCredentials(file: File) extends Credentials {
private[this] def buildCredentials = GoogleCredentials.fromStream(new FileInputStream(file))
private[this] var lastModified: Long = 0L
private[this] var underlying: Credentials = buildCredentials
private[this] def reloadIfNeeded(): Unit = if (file.lastModified > lastModified) {
lastModified = file.lastModified
underlying = buildCredentials
}
override def refresh(): Unit = {
reloadIfNeeded()
underlying.refresh()
}
override def getRequestMetadata(uri: URI) = underlying.getRequestMetadata(uri)
...
}A file based credentials is not always the most secure approach based on the environment and this plugins doesn't allow to use other approaches. |
|
I'm well aware that |
Currently the plugin allow to overwrite the google credentials file, however it doesn't allow to setup custom credentials that is not tied to a file.