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 rgmz comments
  • Loading branch information
kashifkhan0771 committed Mar 3, 2025
commit 690d360922e8c2ea97d2fc18eee513d9307a2740
6 changes: 3 additions & 3 deletions pkg/detectors/azure_cosmosdb/azure_cosmosdb.go
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ func (s Scanner) getClient() *http.Client {
var _ detectors.Detector = (*Scanner)(nil)

func (s Scanner) Type() detectorspb.DetectorType {
return detectorspb.DetectorType_AzureCosmosDB
return detectorspb.DetectorType_AzureCosmosDBKeyIdentifiable
}

func (s Scanner) Description() string {
@@ -80,9 +80,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
}

s1 := detectors.Result{
DetectorType: detectorspb.DetectorType_AzureCosmosDB,
DetectorType: detectorspb.DetectorType_AzureCosmosDBKeyIdentifiable,
Raw: []byte(key),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The URL should also be added. #3938 (comment)

ExtraData: make(map[string]string),
RawV2: []byte("key: " + key + " account_url: " + accountUrl), // key: <key> account_url: <account_url>
}

if verify {
3 changes: 2 additions & 1 deletion pkg/detectors/azure_cosmosdb/azure_cosmosdb_test.go
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ package azure_cosmosdb

import (
"context"
"fmt"
"testing"

"github.com/google/go-cmp/cmp"
@@ -38,7 +39,7 @@ func TestCosmosDB_Pattern(t *testing.T) {
{
name: "valid pattern",
input: validPattern,
want: []string{"FakeeP35zYGPXaEUfakeU7S8kcOY7NI7id8ddbHfakeAifake8Bbql1mXhMF2t0wQ0FAKEPQrwZZACDb3msoAg=="},
want: []string{fmt.Sprintf("key: %s account_url: %s", "FakeeP35zYGPXaEUfakeU7S8kcOY7NI7id8ddbHfakeAifake8Bbql1mXhMF2t0wQ0FAKEPQrwZZACDb3msoAg==", "trufflesecurity-fake.documents.azure.com")},
},
{
name: "invalid pattern",
Loading
Oops, something went wrong.
Loading
Oops, something went wrong.