Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(enterprise): add license auto-import from file on server startup#20939

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
ausbru87 wants to merge11 commits intomain
base:main
Choose a base branch
Loading
fromfeature/license-auto-import

Conversation

@ausbru87
Copy link
Contributor

Implements automatic license import from a file during server startup, addressing the need for automated license deployment in Helm/Kubernetes environments without requiring admin API tokens.

Backend Changes:

  • AddLicenseFile configuration option to deployment settings
  • ImplementImportLicenseFromFile() function in enterprise/coderd/licenses.go
  • Integrate license import into server startup flow in enterprise/cli/server.go
  • Use system context with limited RBAC permissions for startup operations

Helm Chart Changes:

  • Add license secret configuration to values.yaml
  • Mount license secret as volume in pod
  • Set CODER_LICENSE_FILE environment variable when secret is configured

Key Features:

  • Idempotent: only imports when no licenses exist
  • Validates license JWT signature and deployment ID restrictions
  • Proper error handling and logging
  • Works with CLI flag, environment variable, or Helm secrets
  • No authentication required (runs during server startup)

Resolves:#20259

ausbru87and others added6 commitsNovember 26, 2025 02:30
Implements automatic license import from a file during server startup,addressing the need for automated license deployment in Helm/Kubernetesenvironments without requiring admin API tokens.**Backend Changes:**- Add `LicenseFile` configuration option to deployment settings- Implement `ImportLicenseFromFile()` function in enterprise/coderd/licenses.go- Integrate license import into server startup flow in enterprise/cli/server.go- Use system context with wildcard RBAC permissions for startup operations**Helm Chart Changes:**- Add license secret configuration to values.yaml- Mount license secret as volume in pod- Set CODER_LICENSE_FILE environment variable when secret is configured**Key Features:**- Idempotent: only imports when no licenses exist- Validates license JWT signature and deployment ID restrictions- Proper error handling and logging- Works with CLI flag, environment variable, or Helm secrets- No authentication required (runs during server startup)Resolves:#20259🤖 Generated with [Claude Code](https://claude.com/claude-code)Co-Authored-By: Claude <noreply@anthropic.com>
…se importReplace wildcard permissions with least-privilege approach:- Only grant ActionCreate and ActionRead on ResourceLicense- Removes unnecessary access to all other resources- Follows principle of least privilege- Reduces attack surface if code is refactoredThe license import operation only needs to:1. Read existing licenses (ActionRead)2. Create new license (ActionCreate)No other permissions are required, so wildcard was unnecessarily broad.
…se importReplace wildcard permissions with least-privilege approach:- Only grant ActionCreate and ActionRead on ResourceLicense- Removes unnecessary access to all other resources- Follows principle of least privilegeThe license import operation only needs to:1. Read existing licenses (ActionRead on License)2. Create new license (ActionCreate on License)
Add 12 test cases covering:- Successful license import on first startup- Idempotency (skips re-import when licenses exist)- Empty file path handling- Missing file handling (file doesn't exist)- Empty file content- Whitespace-only file content- Invalid license JWT format- Deployment ID restrictions (both mismatch and match)- Expired license handling- License UUID preservation- Skipping import when licenses already exist in databaseTests validate proper error handling, file I/O, license validation,and idempotent behavior. All tests use proper parallel executionand follow existing codebase patterns.
@ausbru87ausbru87 self-assigned thisNov 26, 2025
@ausbru87ausbru87 changed the titleFeature/license auto importfeat(cli): add license-file flag for auto-import license file on startNov 26, 2025
@ausbru87ausbru87 changed the titlefeat(cli): add license-file flag for auto-import license file on startfeat(enterprise): add license auto-import from file on server startupNov 26, 2025
- Fix gocritic lint error by renaming license_uuid to license_uuid_id- Fix helm template nil pointer by adding existence check for coder.license values
Expired licenses are properly rejected by the license parser as they failvalidation. Updated the test to expect an error and verify no license isimported, which is the correct behavior.
Changed from 'and' conditionals to 'with' statements to safely handleoptional nested values. This prevents nil pointer errors when thecoder.license object doesn't exist in values, while still properlyhandling the license configuration when it is provided.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

@ausbru87ausbru87

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Add optional license key parameter to Helm chart values.yaml

2 participants

@ausbru87

[8]ページ先頭

©2009-2025 Movatter.jp