-
-
Notifications
You must be signed in to change notification settings - Fork 18.9k
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/fetch openaiKey via overrideConfig (vars) #2018
feature/fetch openaiKey via overrideConfig (vars) #2018
Conversation
@HenryHengZJ please review |
@HenryHengZJ can you please review? I really need this to be part of upcoming release 🙏 |
@niztal What's the result if a user passes in a customer_id value that's not in the credentials table? Also, what prevents someone from changing the overrideconfig value and using someone else's customer_id, which would allow them to use someone else's API Key? Implemented as is, appears to me, would create a vulnerability into Flowise. |
yeah I agree with @Jaredude, we can't tie the logic of retrieving credential to values set in
|
If user will provide the openai API key as plain text it won't be safe , rather than store it encrypted on flowise and fetch it by some unique id. |
If user will provide non existing customer_id, the fallback would be to the provided API key over the node @HenryHengZJ |
in that case, are you dynamically generating new credential for every user? does that means if you have 1000 users, you will have 1000 credentials? |
No, I won't dynamically generate new credentials for every user. Each customer has its own API key, and will get charge to openai by his usage. Imagine one customer use 10 tokens a month and another one will use 10K tokens a month they will get charged accordingly. Moreover I really think moving a variable named "openAiKey" will be vulnerable since it will be visible publicly to everyone, where "customer_id" is less explicit. WDYT? @Jaredude @HenryHengZJ |
Guys, I feel there are few options here, please let me know what's your favorite:
I prefer solutions 2/4 👍 Thanks |
So if we go with solution 2, you'll have to implement your logic to retrieve the credential ID for the customer and pass in as:
Then we can implement the logic in
|
@HenryHengZJ it's works like a charm ✨ Please review, highly appreciated 🙏 |
Glad to hear! |
In order to support multi-tenancy and having the ability that a single chatFlow will support multiple customers with each customer potentially providing their own OpenAI key, we can implement the "customer_id" overrideConfig (as shown in the screenshot below). In this setup, the Flowise server will attempt to locate the corresponding credential in the Credentials table based on the provided
customer_id
. Thecustomer_id
supplied should match the name of the credential in the table.For instance, if we use this embed code:
and assuming I have an openai key credential already persisted by the name of "test" (for example in the below screenshot):
Then flowise server will decrypt this row's value and use this openai key.