Skip to content

Commit

Permalink
Fix nil pointer dereference when allow_unsafe_ids is configured (#2476)…
Browse files Browse the repository at this point in the history
… (#2477)

Signed-off-by: Marc Yang <marc.yang@bytedance.com>
  • Loading branch information
yangmarcyang authored and evan2645 committed Sep 2, 2021
1 parent d994844 commit 1246b07
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cmd/spire-server/cli/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,13 +356,6 @@ func NewServerConfig(c *Config, logOptions []log.Option, allowUnknownConfig bool
return nil, err
}

// This is a terrible hack but is just a short-term band-aid.
// TODO: Deprecated and should be removed in 1.1
if c.Server.AllowUnsafeIDs != nil {
sc.Log.Warn("The insecure allow_unsafe_ids configurable is deprecated and will be removed in a future release.")
idutil.SetAllowUnsafeIDs(*c.Server.AllowUnsafeIDs)
}

logOptions = append(logOptions,
log.WithLevel(c.Server.LogLevel),
log.WithFormat(c.Server.LogFormat),
Expand All @@ -374,6 +367,13 @@ func NewServerConfig(c *Config, logOptions []log.Option, allowUnknownConfig bool
}
sc.Log = logger

// This is a terrible hack but is just a short-term band-aid.
// TODO: Deprecated and should be removed in 1.1
if c.Server.AllowUnsafeIDs != nil {
sc.Log.Warn("The insecure allow_unsafe_ids configurable is deprecated and will be removed in a future release.")
idutil.SetAllowUnsafeIDs(*c.Server.AllowUnsafeIDs)
}

ip := net.ParseIP(c.Server.BindAddress)
if ip == nil {
return nil, fmt.Errorf("could not parse bind_address %q", c.Server.BindAddress)
Expand Down

0 comments on commit 1246b07

Please sign in to comment.