Skip to content

Commit ea066cc

Browse files
Issue a warning when the signature verification fails (arduino#2138)
1 parent a8787b8 commit ea066cc

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

Diff for: arduino/cores/packageindex/index.go

+15-11
Original file line numberDiff line numberDiff line change
@@ -381,18 +381,22 @@ func LoadIndex(jsonIndexFile *paths.Path) (*Index, error) {
381381
}
382382

383383
jsonSignatureFile := jsonIndexFile.Parent().Join(jsonIndexFile.Base() + ".sig")
384-
trusted, _, err := security.VerifyArduinoDetachedSignature(jsonIndexFile, jsonSignatureFile)
385-
if err != nil {
386-
logrus.
387-
WithField("index", jsonIndexFile).
388-
WithField("signatureFile", jsonSignatureFile).
389-
WithError(err).Infof("Checking signature")
384+
if jsonSignatureFile.Exist() {
385+
trusted, _, err := security.VerifyArduinoDetachedSignature(jsonIndexFile, jsonSignatureFile)
386+
if err != nil {
387+
logrus.
388+
WithField("index", jsonIndexFile).
389+
WithField("signatureFile", jsonSignatureFile).
390+
WithError(err).Warnf("Checking signature")
391+
} else {
392+
logrus.
393+
WithField("index", jsonIndexFile).
394+
WithField("signatureFile", jsonSignatureFile).
395+
WithField("trusted", trusted).Infof("Checking signature")
396+
index.IsTrusted = trusted
397+
}
390398
} else {
391-
logrus.
392-
WithField("index", jsonIndexFile).
393-
WithField("signatureFile", jsonSignatureFile).
394-
WithField("trusted", trusted).Infof("Checking signature")
395-
index.IsTrusted = trusted
399+
logrus.WithField("index", jsonIndexFile).Infof("Missing signature file")
396400
}
397401
return &index, nil
398402
}

0 commit comments

Comments
 (0)