Skip to content

[Bug] [cli] Pulsar Tokens Create is mishandling time units (specifically, treating seconds as milliseconds) #22811

@entvex

Description

@entvex

Search before asking

  • I searched in the issues and found nothing similar.

Read release policy

  • I understand that unsupported versions don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker.

Version

The versions affected 3.2.0 3.2.1 3.2.2 and 3.2.3

Minimal reproduce step

Create a JWT token using an affected version.
bin/pulsar tokens create --secret-key /pulsar/secret.key --subject test-user --expiry-time 3600s
Use a JWT decoder and you will see that the expiry time is wrong.

What did you expect to see?

A JWT token with the desired --expiry-time

What did you see instead?

As a workaround, you can multiply the --expiry-time by 1000 if you specify s in at the end of --expiry-time. To convert it to mili sec.

The mentioned bug affects all time units, not just seconds.

Anything else?

It appears that the bug was introduced in this pull request: GitHub link. I'll work on fixing it and submit a pull request. Additionally, I'll look into adding test coverage.

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

Labels

type/bugThe PR fixed a bug or issue reported a bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions