Skip to content

generate-jwt-hs256-key can produce a value that breaks generate-jwt-hs256-server-token CLI parsing #2666

@darallium

Description

@darallium

I ran into an issue while setting up sccache-dist authentication.

generate-jwt-hs256-key can generate a secret key whose first character is -.
When that value is passed to generate-jwt-hs256-server-token --secret-key <KEY>,
the CLI parser treats the key as another flag instead of as the value for --secret-key,
and the command fails.

Reproduction log

Example flow:(the token and keys are already disabled)

sccache-init-1 | + CLIENT_TOKEN=PFaN0gS4ys6BfjPaoATgjO3LDZjazpi_6-zKM8W2zUc 
sccache-init-1 | + sccache-dist auth generate-jwt-hs256-key 
sccache-init-1 | + SERVER_SECRET=-9LcjCfJykRqRV6hR4sb37JFaVEmSiXVPKr-GJGBtkU 
sccache-init-1 | + sccache-dist auth generate-jwt-hs256-server-token --secret-key -9LcjCfJykRqRV6hR4sb37JFaVEmSiXVPKr-GJGBtkU --server 100.112.231.67:10501 
sccache-init-1 | error: unexpected argument '-9' found 
sccache-init-1 | 
sccache-init-1 | Usage: sccache-dist auth generate-jwt-hs256-server-token --server <SERVER_ADDR> <--config <PATH>|--secret-key <KEY>> sccache-init-1 | sccache-init-1 | For more information, try '--help'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions