Skip to content

Commit 0711750

Browse files
committed
Add error logging for command verification and update comment for public key usage
1 parent 497a640 commit 0711750

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

conn.go

+1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ func uploadHandler(pubKey *rsa.PublicKey) func(*gin.Context) {
115115
err := utilities.VerifyInput(data.Commandline, data.Signature, pubKey)
116116

117117
if err != nil {
118+
log.WithField("err", err).Error("Error verifying the command")
118119
c.String(http.StatusBadRequest, "signature is invalid")
119120
return
120121
}

v2/pkgs/tools.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ type Tools struct {
6565
installed map[string]string
6666
mutex sync.RWMutex
6767

68-
verifySignaturePubKey *rsa.PublicKey // public key used to verify the signature when a tools is installed
68+
verifySignaturePubKey *rsa.PublicKey // public key used to verify the signature of a command sent to the boards
6969
}
7070

7171
// New will return a Tool object, allowing the caller to execute operations on it.
@@ -170,7 +170,7 @@ func (t *Tools) Install(ctx context.Context, payload *tools.ToolPayload) (*tools
170170

171171
//if URL is defined and is signed we verify the signature and override the name, payload, version parameters
172172
if payload.URL != nil && payload.Signature != nil && payload.Checksum != nil {
173-
err := utilities.VerifyInput(*payload.URL, *payload.Signature, t.verifySignaturePubKey) // TODO pass the public key
173+
err := utilities.VerifyInput(*payload.URL, *payload.Signature, t.verifySignaturePubKey)
174174
if err != nil {
175175
return nil, err
176176
}

0 commit comments

Comments
 (0)