You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// if we could not find any signature and the user wants to explicitly
184
188
// confirm whether we run an unsigned cli
185
-
if (signatureDownloadResult.isNotDownloaded()) {
189
+
if (signatureResult.isNotDownloaded()) {
186
190
if (context.settingsStore.allowUnsignedBinaryWithoutPrompt) {
187
191
context.logger.warn("Running unsigned CLI from ${cliResult.source}")
188
192
} else {
@@ -196,15 +200,30 @@ class CoderCLIManager(
196
200
if (acceptsUnsignedBinary) {
197
201
returntrue
198
202
} else {
199
-
// remove the cli, otherwise next time the user tries to login the cached cli is picked up
203
+
// remove the cli, otherwise next time the user tries to login the cached cli is picked up,
200
204
// and we don't verify cached cli signatures
201
205
Files.delete(cliResult.dst)
202
206
throwUnsignedBinaryExecutionDeniedException("Running unsigned CLI from ${cliResult.source} was denied by the user")
203
207
}
204
208
}
205
209
}
206
210
207
-
return cliResult.isDownloaded()
211
+
// we have the cli, and signature is downloaded, let's verify the signature
212
+
signatureResult = signatureResult asDownloaded
213
+
gpgVerifier.verifySignature(cliResult.dst, signatureResult.dst).let { result ->
214
+
when {
215
+
result.isValid() ->returntrue
216
+
result.isInvalid() -> {
217
+
val reason = (result asInvalid).reason
218
+
throwUnsignedBinaryExecutionDeniedException(
219
+
"Signature of ${cliResult.dst} is invalid."+ reason?.let { " Reason: $it" }.orEmpty()
220
+
)
221
+
}
222
+
223
+
result.signatureIsNotFound() ->throwUnsignedBinaryExecutionDeniedException("Can't verify signature of ${cliResult.dst} because ${signatureResult.dst} does not exist")
0 commit comments