Skip to content

chore: refactor license validation#20411

Merged
mtojek merged 3 commits into
mainfrom
fix-license-1
Oct 22, 2025
Merged

chore: refactor license validation#20411
mtojek merged 3 commits into
mainfrom
fix-license-1

Conversation

@mtojek
Copy link
Copy Markdown
Member

@mtojek mtojek commented Oct 22, 2025

This PR refines the logic used to validate license claims.

@mtojek mtojek marked this pull request as ready for review October 22, 2025 12:08
@mtojek mtojek requested a review from johnstcn October 22, 2025 12:08
}
if claims.LicenseExpires == nil {

yearsHardLimit := time.Now().Add(5 /* years */ * 365 * 24 * time.Hour)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some context on this hard limit?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can take it offline.

Comment on lines +709 to +714
if claims.AccountType == "" {
return nil, ErrMissingAccountType
}
if claims.AccountID == "" {
return nil, ErrMissingAccountID
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any risk of breaking existing licenses?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There shouldn't be. Coder-issued licenses have these fields populated:

  "license_expires": 1223242222,
  "account_type": "trial", // or something else
  "account_id": "user@domain.tld", // or something special

Copy link
Copy Markdown
Member

@johnstcn johnstcn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stamp 👍

@mtojek mtojek merged commit caeca10 into main Oct 22, 2025
29 checks passed
@mtojek mtojek deleted the fix-license-1 branch October 22, 2025 14:12
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants