-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Added deepseek support #3980
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
base: main
Are you sure you want to change the base?
Added deepseek support #3980
Conversation
pkg/detectors/deepseek/deepseek.go
Outdated
var ( | ||
defaultClient = common.SaneHttpClient() | ||
|
||
keyPat = regexp.MustCompile(`\b(sk-[a-z0-9]{32})\b`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bunnyanon can we tighten up the regex using the Prefix helper ? I have a doubt that current regex will be too loose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's needed. The only other key pattern that's somewhat similar to the deepseek one is OpenAI, however OpenAI keys are longer and include uppercase letters. Furthermore, using the OpenAI library to use DeepSeek is a fairly common practice as the API endpoints are compatible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's needed. The only other key pattern that's somewhat similar to the deepseek one is OpenAI, however OpenAI keys are longer and include uppercase letters. Furthermore, using the OpenAI library to use DeepSeek is a fairly common practice as the API endpoints are compatible.
@bunnyanon please use the regex prefix filter. We may add other detectors with the sk-
prefix in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @bunnyanon for adding this detector.
pkg/detectors/deepseek/deepseek.go
Outdated
// Keywords are used for efficiently pre-filtering chunks. | ||
// Use identifiers in the secret preferably, or the provider name. | ||
func (s Scanner) Keywords() []string { | ||
return []string{"sk-"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bunnyanon sk-
is not a sufficient keyword. deepseek
is necessary for filtering out fps.
pkg/detectors/deepseek/deepseek.go
Outdated
var ( | ||
defaultClient = common.SaneHttpClient() | ||
|
||
keyPat = regexp.MustCompile(`\b(sk-[a-z0-9]{32})\b`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's needed. The only other key pattern that's somewhat similar to the deepseek one is OpenAI, however OpenAI keys are longer and include uppercase letters. Furthermore, using the OpenAI library to use DeepSeek is a fairly common practice as the API endpoints are compatible.
@bunnyanon please use the regex prefix filter. We may add other detectors with the sk-
prefix in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add PrefixRegex as recommended by @zricethezav and resolve the conflicts.
* main: (121 commits) Fixed Grafana detector (trufflesecurity#4166) Reduce verbosity of chunk trace logging (trufflesecurity#4161) Increase postman logging verbosity (trufflesecurity#4160) Change github file extension log message verbosity (trufflesecurity#4159) docs: fix typos (trufflesecurity#4158) fix(twitch): Update Twitch detector to handle new RawV2 field and adjust test expectations (trufflesecurity#4150) Add a bunch of Postman logging (trufflesecurity#4154) Added DataBricks Analyzer (trufflesecurity#4135) fixed shopify detector line number (trufflesecurity#4149) chore: run setup-go after checkout (trufflesecurity#4143) Add per-chunk detection logging (trufflesecurity#4152) [Feat] Added Dropbox API OAuth2 Token Analyzer (trufflesecurity#4080) Updated Github Source Validate method (trufflesecurity#4144) replace anthropic reference with groq (trufflesecurity#4147) [Fix] Line number issue for custom detector (trufflesecurity#3997) fix(postman): prevent infinite recursion in variable substitution (trufflesecurity#4145) Add metrics to the Postman source (trufflesecurity#4142) [Feat] Implementation of Posthog Analyzer (trufflesecurity#4103) [Feat] Added Mux API Analyzer (trufflesecurity#4128) fixed name of netlify analyzer in cli output (trufflesecurity#4140) ... # Conflicts: # pkg/pb/detectorspb/detectors.pb.go # proto/detectors.proto
updated the test, to aligned with regex prefix.
Hey @bunnyanon, Thank you for your contribution in adding the As there has been no activity from your side for over a month, I have taken the initiative to resolve the conflicts and implement the necessary changes as a maintainer. Just wanted to keep you informed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @abmussani for fixing the comments and resolving the conflicts and thank you @bunnyanon for the contribution!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Description:
Added support for the DeepSeek API (https://api-docs.deepseek.com/)
Note Before Merging:
Should add a valid
DEEPSEEK
key and an invalidDEEPSEEK_INACTIVE
key to fulfill integration testsChecklist:
make test-community
)?make lint
this requires golangci-lint)?