-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Allow underscores and hypens in the OpenAI key check #3494
Conversation
|
GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
---|---|---|---|---|---|
12853598 | Triggered | Generic High Entropy Secret | e0bbcad | test/oai/test_utils.py | View secret |
12853598 | Triggered | Generic High Entropy Secret | be5b239 | test/oai/test_utils.py | View secret |
10404693 | Triggered | Generic High Entropy Secret | 5d71c8b | test/oai/test_utils.py | View secret |
10404693 | Triggered | Generic High Entropy Secret | be5b239 | test/oai/test_utils.py | View secret |
12853599 | Triggered | Generic High Entropy Secret | be5b239 | test/oai/test_utils.py | View secret |
12853599 | Triggered | Generic High Entropy Secret | 5d71c8b | test/oai/test_utils.py | View secret |
10404694 | Triggered | Generic High Entropy Secret | 5d71c8b | test/oai/test_utils.py | View secret |
- | - | Generic High Entropy Secret | be5b239 | test/oai/test_utils.py | View secret |
- | - | Generic High Entropy Secret | 5d71c8b | test/oai/test_utils.py | View secret |
- | - | Generic High Entropy Secret | be5b239 | test/oai/test_utils.py | View secret |
- | - | Generic High Entropy Secret | 5d71c8b | test/oai/test_utils.py | View secret |
- | - | Generic High Entropy Secret | a03112d | test/oai/test_utils.py | View secret |
- | - | Generic High Entropy Secret | e0bbcad | test/oai/test_utils.py | View secret |
- | - | Generic High Entropy Secret | 6b7053a | test/oai/test_utils.py | View secret |
- | - | Generic High Entropy Secret | d94b9ff | test/oai/test_utils.py | View secret |
- | - | Generic High Entropy Secret | e0bbcad | test/oai/test_utils.py | View secret |
12853600 | Triggered | Generic High Entropy Secret | d94b9ff | test/oai/test_utils.py | View secret |
12853600 | Triggered | Generic High Entropy Secret | a03112d | test/oai/test_utils.py | View secret |
12853600 | Triggered | Generic High Entropy Secret | e0bbcad | test/oai/test_utils.py | View secret |
12853600 | Triggered | Generic High Entropy Secret | 6b7053a | test/oai/test_utils.py | View secret |
12853600 | Triggered | Generic High Entropy Secret | e0bbcad | test/oai/test_utils.py | View secret |
- | - | Generic High Entropy Secret | be5b239 | test/oai/test_utils.py | View secret |
- | - | Generic High Entropy Secret | 5d71c8b | test/oai/test_utils.py | View secret |
12853601 | Triggered | Generic High Entropy Secret | d94b9ff | test/oai/test_utils.py | View secret |
12853601 | Triggered | Generic High Entropy Secret | a03112d | test/oai/test_utils.py | View secret |
12853601 | Triggered | Generic High Entropy Secret | 6b7053a | test/oai/test_utils.py | View secret |
12853601 | Triggered | Generic High Entropy Secret | be5b239 | test/oai/test_utils.py | View secret |
12853601 | Triggered | Generic High Entropy Secret | e0bbcad | test/oai/test_utils.py | View secret |
10404696 | Triggered | Generic High Entropy Secret | 5d71c8b | test/oai/test_utils.py | View secret |
10422482 | Triggered | Generic High Entropy Secret | 5d71c8b | test/oai/test_utils.py | View secret |
10422482 | Triggered | Generic High Entropy Secret | be5b239 | test/oai/test_utils.py | View secret |
12853602 | Triggered | Generic High Entropy Secret | d94b9ff | test/oai/test_utils.py | View secret |
12853602 | Triggered | Generic High Entropy Secret | 6b7053a | test/oai/test_utils.py | View secret |
12853602 | Triggered | Generic High Entropy Secret | e0bbcad | test/oai/test_utils.py | View secret |
12853602 | Triggered | Generic High Entropy Secret | a03112d | test/oai/test_utils.py | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secrets safely. Learn here the best practices.
- Revoke and rotate these secrets.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
@microsoft-github-policy-service agree |
Looks like the GitGuardian is catching the secrets added in the tests, but those are just key examples and not actual keys |
@jackgerrits @afourney what's the fix for the security checks? |
I am not sure. I tried reporting that it was a false alarm and it still triggers. I suppose the alternative is to remove any placeholder values. |
I tried adding #ggignore to the "api keys", but GitGuardian still triggered on those lines. Let me know how you'd like to proceed - another option might be to just ignore the test file path in the .gitguardian.yaml config or adding an ignore-matches for these specific keys |
Also, funnily enough when I went to generate a new API key - I had another instance that which would not pass the regex which is hypens after the prefix so added support for that too Ex. (Deleted key) |
I think we should consider just removing api key validation - if it is wrong then the API call will fail. Would you be interested in working on that @thienlnam ? |
Superseded by #3569 |
Why are these changes needed?
Looks like underscores are now part of the OpenAI API keys, which are not matched in the existing regex.
This was a project API key I just generated that has this underscore (deleted so no longer active)
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
Here's what I was able to find about the API keys prefixes
Legacy User API keys:
sk-[rest]
Project API keys:
sk-proj-[rest]
New User Keys
sk-None-[rest]
Service Account Keys
sk-svcaat-[rest]
This change ensures that:
Related issue number
Closes #3345
Checks