Switches context to Secret struct instead of in Secret.Data
This commit is contained in:
@@ -35,9 +35,8 @@ func awsMatcher() SecretMatcher {
|
||||
}
|
||||
|
||||
data := struct {
|
||||
Key string `json:"key"`
|
||||
Secret string `json:"secret,omitempty"`
|
||||
Context map[string]string `json:"context,omitempty"`
|
||||
Key string `json:"key"`
|
||||
Secret string `json:"secret,omitempty"`
|
||||
}{
|
||||
Key: str,
|
||||
}
|
||||
@@ -62,7 +61,6 @@ func awsMatcher() SecretMatcher {
|
||||
}
|
||||
|
||||
o := grandparent.AsObject()
|
||||
data.Context = o.asMap()
|
||||
|
||||
for _, k := range o.getKeys() {
|
||||
k = strings.ToLower(k)
|
||||
@@ -78,6 +76,7 @@ func awsMatcher() SecretMatcher {
|
||||
Kind: "AWSAccessKey",
|
||||
LeadWorthy: data.Secret != "",
|
||||
Data: data,
|
||||
Context: o.asMap(),
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -22,8 +22,7 @@ func gcpKeyMatcher() SecretMatcher {
|
||||
}
|
||||
|
||||
data := struct {
|
||||
Key string `json:"key"`
|
||||
Context map[string]string `json:"context,omitempty"`
|
||||
Key string `json:"key"`
|
||||
}{
|
||||
Key: str,
|
||||
}
|
||||
@@ -45,8 +44,7 @@ func gcpKeyMatcher() SecretMatcher {
|
||||
return match
|
||||
}
|
||||
|
||||
data.Context = grandparent.AsObject().asMap()
|
||||
match.Data = data
|
||||
match.Context = grandparent.AsObject().asMap()
|
||||
|
||||
return match
|
||||
}}
|
||||
|
||||
@@ -15,8 +15,7 @@ func githubKeyMatcher() SecretMatcher {
|
||||
}
|
||||
|
||||
data := struct {
|
||||
Key string `json:"key"`
|
||||
Context map[string]string `json:"context,omitempty"`
|
||||
Key string `json:"key"`
|
||||
}{
|
||||
Key: str,
|
||||
}
|
||||
@@ -38,8 +37,7 @@ func githubKeyMatcher() SecretMatcher {
|
||||
return match
|
||||
}
|
||||
|
||||
data.Context = grandparent.AsObject().asMap()
|
||||
match.Data = data
|
||||
match.Context = grandparent.AsObject().asMap()
|
||||
|
||||
return match
|
||||
}}
|
||||
|
||||
@@ -8,10 +8,11 @@ import (
|
||||
// data found within a JavaScript file. E.g. an AWS access key and
|
||||
// secret.
|
||||
type Secret struct {
|
||||
Kind string `json:"kind"`
|
||||
Data any `json:"data"`
|
||||
Filename string `json:"filename,omitempty"`
|
||||
LeadWorthy bool `json:"leadWorthy"`
|
||||
Kind string `json:"kind"`
|
||||
Data any `json:"data"`
|
||||
Filename string `json:"filename,omitempty"`
|
||||
LeadWorthy bool `json:"leadWorthy"`
|
||||
Context map[string]string `json:"context"`
|
||||
}
|
||||
|
||||
// GetSecrets uses the parse tree and a set of Matchers (those provided
|
||||
@@ -113,8 +114,7 @@ func AllSecretMatchers() []SecretMatcher {
|
||||
}
|
||||
|
||||
data := struct {
|
||||
Key string `json:"key"`
|
||||
Context map[string]string `json:"context,omitempty"`
|
||||
Key string `json:"key"`
|
||||
}{
|
||||
Key: value.RawString(),
|
||||
}
|
||||
@@ -129,8 +129,7 @@ func AllSecretMatchers() []SecretMatcher {
|
||||
return match
|
||||
}
|
||||
|
||||
data.Context = parent.AsObject().asMap()
|
||||
match.Data = data
|
||||
match.Context = parent.AsObject().asMap()
|
||||
|
||||
return match
|
||||
}},
|
||||
|
||||
Reference in New Issue
Block a user