-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add detection for OpenAI API keys #1148
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
Conversation
Can confirm, looks like |
@becojo Just curious, what was the reason for removing the |
@rgmz It was there mostly because I copy pasted another rule. I figured |
They have API keys in the scope of their bug bounty program I would imagine they make some noise if they change the format. |
Fair enough. The
...That being said, the fact that it's I just wanted to clarify because I noticed it was in |
oh, good catch my bad |
Azure's OpenAI Service seems to use a different token format. I discovered an instance where a private Azure endpoint was authenticated with a 32 alphanumeric characters. It's possible the api_key used an Azure AD token; I'm not familiar enough to with Azure to say for certain. """
Reference: https://github.com/openai/openai-python#microsoft-azure-active-directory-authentication
"""
import openai
# Setup parameters
openai.api_type = "azure_ad" # I need to double-check what api_type was specified.
openai.api_base = "https://example-endpoint.openai.azure.com/"
openai.api_key = "se23rtrbvtydjt30r0cwspdcpg8a4548" (I'd expect this to get picked up by the generic rule.) |
* Add detection for OpenAI API keys * Remove `sk-` keyword
Description:
Add detection for OpenAI API keys. Interestingly, their API keys look made up of base64 and contains the encoded string "OpenAI" (
T3BlbkFJ
) between 2 blocks of random bytes so this rule should be pretty precise.Checklist: