Skip to content

Commit

Permalink
Merge pull request #768 from Icinga/icingadb-migrate-check-env-id-length
Browse files Browse the repository at this point in the history
icingadb-migrate: Verify env ID length
  • Loading branch information
julianbrost authored Jul 30, 2024
2 parents b2203b9 + b6839ce commit 80ef12b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/icingadb-migrate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"context"
"crypto/sha1"
"database/sql"
_ "embed"
"encoding/hex"
Expand Down Expand Up @@ -71,6 +72,10 @@ func main() {
_, _ = fmt.Fprintf(os.Stderr, "bad env ID: %s\n", err.Error())
os.Exit(2)
}
if len(envId) != sha1.Size {
_, _ = fmt.Fprintf(os.Stderr, "bad env ID: must be %d bytes long, has %d bytes\n", sha1.Size, len(envId))
os.Exit(2)
}

defer func() { _ = log.Sync() }()

Expand Down

0 comments on commit 80ef12b

Please sign in to comment.