Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request Portal upload token (API key) format validation #955

Open
4 tasks
vmasek opened this issue Mar 4, 2025 · 0 comments
Open
4 tasks

Feature request Portal upload token (API key) format validation #955

vmasek opened this issue Mar 4, 2025 · 0 comments
Assignees

Comments

@vmasek
Copy link
Collaborator

vmasek commented Mar 4, 2025

User story

As a user,
I want to be sure the token (API key) I set and use for uploading reports to portal is in correct format,
so I will get quick and understandable feedback that my token is missing or missconfigured.

Acceptance criteria

  • validate the prefix cp_ should always be present
  • validate the hash lenght as it is always 64 hexadecimal characters
  • strip possible the unnecessary surrounding quotes
  • the logic for validation/stripping should live in the @code-pushup/portal-client package and be consumed by the CLI

Implementation details

A regex of /^cp_[0-9a-f]{64}$/ could be used.
Additional pre-check if token is wrapped in " or ' quotes as this could be done if user copy pastes from code or assumes it needs to be in explicit string format. We could recover easily by stripping the quotes.

@vmasek vmasek self-assigned this Mar 4, 2025
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

No branches or pull requests

1 participant