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

Key validation #219

Merged
merged 3 commits into from
Apr 18, 2023
Merged

Key validation #219

merged 3 commits into from
Apr 18, 2023

Conversation

matthope1
Copy link
Contributor

Added Key validation to the setup script.

The keys from open ai have 51 characters in total and are prefixed with "sk-".
So this regex captures that case ^sk-[a-zA-Z0-9]{48}$

I've also added the same check within the settingsDialog component & It won't save an API key unless it has a valid format.
It will also notify the user with an alert.

@vercel
Copy link

vercel bot commented Apr 18, 2023

@matthope1 is attempting to deploy a commit to the reworkd Team on Vercel.

A member of the Team first needs to authorize it.

@asim-shrestha asim-shrestha merged commit 0004cc8 into reworkd:main Apr 18, 2023
Copy link

@ABH247 ABH247 left a comment

Choose a reason for hiding this comment

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

?,)££7

@jmrada14
Copy link

jmrada14 commented May 6, 2024

The RegExp used /^sk-[a-zA-Z0-9]{48}$/ is returning no match for valid OpenAI API keys.

Valid keys that are failing:
sk-proj-pF9cTsH5RrqQhVQK5kfiT3BlbkFJ3ISRnmVg8d3DKcqL6aPa
sk-proj-40qHJ5ChqF12c1A9l8VrT3BlbkFJt5XkT7qspHLhwPIJk5Ue
sk-proj-nNBQEiRMNrtWhOx1sPxGT3BlbkFJ6GseFSbmeVDVcey0I0GI

"The keys from open ai have 51 characters in total" not sure this is true anymore, all new keys I get are 56 characters in total. but that might change in the future.

I have created a PR to use /^sk-[a-zA-Z0-9]/ which does not validate the length.
#1546

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.

4 participants