Skip to content

hscontrol/grpcv1: persist nil expiration when request omits it#3254

Open
clwluvw wants to merge 1 commit into
juanfont:mainfrom
clwluvw:grpc-preauth
Open

hscontrol/grpcv1: persist nil expiration when request omits it#3254
clwluvw wants to merge 1 commit into
juanfont:mainfrom
clwluvw:grpc-preauth

Conversation

@clwluvw
Copy link
Copy Markdown

@clwluvw clwluvw commented May 9, 2026

CreatePreAuthKey and CreateApiKey declared var expiration time.Time and unconditionally passed &expiration to the database layer. When the gRPC request had no Expiration field, the pointer dereferenced to the zero time.Time, causing the row to be stored with expiration = 0001-01-01 00:00:00 instead of NULL. Both ValidateAPIKey and PreAuthKey.Validate then rejected the key as expired immediately.

Fixes: infradohq/headscale-operator#92

  • have read the CONTRIBUTING.md file
  • raised a GitHub issue or discussed it on the projects chat beforehand
  • added unit tests
  • added integration tests
  • updated documentation if needed
  • updated CHANGELOG.md

CreatePreAuthKey and CreateApiKey declared `var expiration time.Time`
and unconditionally passed `&expiration` to the database layer. When
the gRPC request had no Expiration field, the pointer dereferenced to
the zero time.Time, causing the row to be stored with expiration =
0001-01-01 00:00:00 instead of NULL. Both ValidateAPIKey and
PreAuthKey.Validate then rejected the key as expired immediately.

Signed-off-by: Seena Fallah <seenafallah@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: unexpired keys

1 participant