protect unlock api endpoint
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -24,6 +24,11 @@ func Unlock(c *gin.Context) {
|
||||
}
|
||||
log.Println("Unlock received JSON input")
|
||||
|
||||
if models.CheckKeyProvided() {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "secret key can only be provided once after service start"})
|
||||
return
|
||||
}
|
||||
|
||||
// check that the key is 32 bytes long
|
||||
if len(input.SecretKey) != 32 {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "secret key provided is invalid, must be exactly 32 bytes long"})
|
||||
|
Reference in New Issue
Block a user