Skip to content

Add local JWT development server with key generation scripts#9647

Open
simvlad wants to merge 2 commits intotemporalio:mainfrom
simvlad:simvlad/jwt-server-with-local-filesystem
Open

Add local JWT development server with key generation scripts#9647
simvlad wants to merge 2 commits intotemporalio:mainfrom
simvlad:simvlad/jwt-server-with-local-filesystem

Conversation

@simvlad
Copy link
Copy Markdown
Contributor

@simvlad simvlad commented Mar 24, 2026

What changed?

  • Added development-jwt.yaml config that runs Temporal with JWT authorization enabled using a JWKS file loaded from local disk. Loading from local disk is added in Support file scheme for JWT key provider #9590.
  • Added config/jwt/setup-keys.sh to generate an RSA key pair and JWKS file in /tmp/temporal-jwt-test/.
  • Added config/jwt/generate-token.sh to create signed JWTs for testing.
  • Added make start-jwt target.

Why?

Testing JWT authentication currently requires an external identity provider or manual key/token setup. This provides a self-contained local workflow: make start-jwt generates keys automatically and starts the server with auth enforced, and generate-token.sh produces tokens on demand.

How did you test it?

  • built
  • run locally and tested manually
  • covered by existing tests
  • added new unit test(s)
  • added new functional test(s)

Tested this in conjunction with #9582. Was able to list the workflows by passing the token and dumping their history. When the token is not used, the auth fails with "Request denied".

Potential risks

Keys are stored in /tmp/temporal-jwt-test/ which is world-readable. This is acceptable for local development but the scripts should not be used in shared or production environments.

@simvlad simvlad requested review from a team as code owners March 24, 2026 20:53
@simvlad simvlad requested review from picatz and yycptt March 24, 2026 20:53
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 698b205891

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


# Collect permissions (default to system:admin if none specified)
if [ $# -eq 0 ]; then
PERMISSIONS='["system:admin"]'
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Use temporal-system scope for default admin permission

The default permission emitted when no permission arguments are passed is system:admin, but the default JWT claim mapper only treats temporal-system as the system-wide scope (permissionScopeSystem), so this token is interpreted as namespace system admin instead of cluster/system admin. In practice, running ./config/jwt/generate-token.sh with defaults can produce tokens that are denied for cluster-level APIs and normal namespace operations unless explicit permissions are provided.

Useful? React with 👍 / 👎.

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.

1 participant