Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

config: LoadConfig panics when not_after is before not_before

Open
#1,456 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

@sebxt is already working on this.

Since Oct 18, 2026.

  • #1457 by @sebxt — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
25/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
go
Domain
backend, security

Research direction

Start in config/config.go at SigningProfile.populate, around the not_before and not_after validation identified in the panic trace. Check how nearby invalid profile values construct and return InvalidPolicy errors, then inspect the related config tests. Done means LoadConfig returns an InvalidPolicy error for the supplied reversed dates without panicking.

Written by the indexing model from the issue text.

Description

What happens

Loading a signing config whose profile sets not_after earlier than not_before panics instead of returning an error:

panic: Wrap needs a supplied error to initialize.

github.com/cloudflare/cfssl/errors.Wrap(...)
	errors/error.go:407
github.com/cloudflare/cfssl/config.(*SigningProfile).populate(...)
	config/config.go:217
github.com/cloudflare/cfssl/config.LoadConfig(...)
	config/config.go:721

cfssl serve -config, cfssl gencert -config and any library caller of config.LoadFile / config.LoadConfig crash on such a file.

What should happen

LoadConfig should return an InvalidPolicy error, like it does for other invalid profile values.

Minimal repro

_, err := config.LoadConfig([]byte(`{
  "signing": {
    "default": {
      "usages": ["digital signature"],
      "expiry": "8760h",
      "not_before": "2030-01-01T00:00:00Z",
      "not_after": "2020-01-01T00:00:00Z"
    }
  }
}`))

Root cause

In SigningProfile.populate the check is:

if !p.NotBefore.IsZero() && !p.NotAfter.IsZero() && p.NotAfter.Before(p.NotBefore) {
	return cferr.Wrap(cferr.PolicyError, cferr.InvalidPolicy, err)
}

err at that point is the result of the successful time.ParseDuration calls above it, so it is always nil, and cferr.Wrap panics when given a nil error. The check needs its own error value.

Dominant language
Go
Stars
9.5k
Forks
1.2k
Avg merge
12h 48m
Merged PRs (30d)
2

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cloudflare/cfssl

All issues in cloudflare/cfssl

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.