Skip to content

Commit

Permalink
Add RawV2 Results to the JSON Output (#1273)
Browse files Browse the repository at this point in the history
* Add RawV2 to JSON Output

* Adding RawV2 results to Azure, Datadog and GCP Detectors
  • Loading branch information
yilmi committed Apr 20, 2023
1 parent cec1543 commit a002ba9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/detectors/azure/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
s := detectors.Result{
DetectorType: detectorspb.DetectorType_Azure,
Raw: []byte(clientSecret[2]),
RawV2: []byte(clientID[2] + clientSecret[2] + tenantID[2]),
Redacted: clientID[2],
}

Expand Down
1 change: 1 addition & 0 deletions pkg/detectors/datadogtoken/datadogtoken.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
s1 := detectors.Result{
DetectorType: detectorspb.DetectorType_DatadogToken,
Raw: []byte(resMatch),
RawV2: []byte(resMatch + resApiMatch),
}

if verify {
Expand Down
4 changes: 4 additions & 0 deletions pkg/output/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ func PrintJSON(r *detectors.ResultWithMetadata) error {
Verified bool
// Raw contains the raw secret data.
Raw string
// RawV2 contains the raw secret identifier that is a combination of both the ID and the secret.
// This is used for secrets that are multi part and could have the same ID. Ex: AWS credentials
RawV2 string
// Redacted contains the redacted version of the raw secret identification data for display purposes.
// A secret ID should be used if available.
Redacted string
Expand All @@ -44,6 +47,7 @@ func PrintJSON(r *detectors.ResultWithMetadata) error {
DecoderName: r.DecoderType.String(),
Verified: r.Verified,
Raw: string(r.Raw),
RawV2: string(r.RawV2),
Redacted: r.Redacted,
ExtraData: r.ExtraData,
StructuredData: r.StructuredData,
Expand Down

0 comments on commit a002ba9

Please sign in to comment.