icingadb-migrate: Address golangci-lint gosec reports

The latest gosec release brought some new false positives reported in
the icingadb-migrate command.
This commit is contained in:
Alvar Penning 2026-02-18 10:55:45 +01:00
parent d4e399181e
commit 235eca9217
No known key found for this signature in database
2 changed files with 3 additions and 1 deletions

View file

@ -289,7 +289,7 @@ func convertDowntimeRows(
// with factor 1,000 should not overflow anything. In theory, at least. To make sure, invalid values are capped.
var flexibleDuration uint64
if durationSec := row.Duration; durationSec >= 0 && durationSec < math.MaxUint64/1_000 {
flexibleDuration = uint64(durationSec) * 1_000
flexibleDuration = uint64(durationSec) * 1_000 // #nosec G115 -- int64 -> uint64 cannot overflow, check above
}
downtimeHistory = append(downtimeHistory, &history.DowntimeHistory{

View file

@ -129,6 +129,8 @@ func parseConfig(f *Flags) (_ *Config, exit int) {
}
if err := yaml.NewDecoder(cf, yaml.DisallowUnknownField()).Decode(c); err != nil {
// #nosec G705 -- this error message should do no harm in the output, being printed to stderr
// on a terminal and not used as an HTML page or the like
_, _ = fmt.Fprintf(os.Stderr, "can't parse config file: %s\n", err.Error())
return nil, 2
}