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

Added azure COSMOSDB detector #3951

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
resolved comments
  • Loading branch information
kashifkhan0771 committed Feb 28, 2025
commit f6d26e03cc5cc94565a1f922f62c74442652d000
4 changes: 2 additions & 2 deletions pkg/detectors/azure_cosmosdb/azure_cosmosdb.go
Original file line number Diff line number Diff line change
@@ -25,9 +25,9 @@ type Scanner struct {
var (
defaultClient = common.SaneHttpClient()

dbKeyPattern = regexp.MustCompile(`([A-Za-z0-9+/=]{88})`)
dbKeyPattern = regexp.MustCompile(`([A-Za-z0-9+/]{86}==)`)
// account name can contain only lowercase letters, numbers and the `-` character, must be between 3 and 44 characters long.
accountUrlPattern = regexp.MustCompile(`(https://[a-z0-9-]{3,44}.documents\.azure\.com:[0-9]{3})`)
accountUrlPattern = regexp.MustCompile(`(https://[a-z0-9-]{3,44}.documents\.azure\.com:443)`)
)

func (s Scanner) getClient() *http.Client {
4 changes: 2 additions & 2 deletions pkg/detectors/azure_cosmosdb/azure_cosmosdb_test.go
Original file line number Diff line number Diff line change
@@ -17,12 +17,12 @@ var (
The cluster name must not start or end in a hyphen.
// config
cosmosKey: FakeeP35zYGPXaEUfakeU7S8kcOY7NI7id8ddbHfakeAifake8Bbql1mXhMF2t0wQ0FAKEPQrwZZACDb3msoAg==
https://trufflesecurity-fake.documents.azure.com:341
https://trufflesecurity-fake.documents.azure.com:443
`

invalidPattern = `
FakeeP35zYGPXaEUfakeU7S8kcOY7I7id8ddbHfakeAifake8Bbql1mXhMF2t0wQ0FAKEPQrwZZACDb3msoAg==
https://not-a-host.documents.azure.com:445
https://not-a-host.documents.azure.com:443
`
)

127 changes: 61 additions & 66 deletions pkg/pb/detectorspb/detectors.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion proto/detectors.proto
Original file line number Diff line number Diff line change
@@ -980,7 +980,6 @@ enum DetectorType {
Postgres = 968;
AzureActiveDirectoryApplicationSecret = 969;
AzureCacheForRedisAccessKey = 970;
AzureCosmosDBKeyIdentifiable = 971;
AzureDevopsPersonalAccessToken = 972;
AzureFunctionKey = 973;
AzureMLWebServiceClassicIdentifiableKey = 974;
Loading
Oops, something went wrong.