MCPcopy
hub / github.com/BishopFox/jsluice / firebaseMatcher

Function firebaseMatcher

secret-gcp.go:51–83  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

49}
50
51func firebaseMatcher() SecretMatcher {
52 // Firebase objects
53 return SecretMatcher{"(object) @matches", func(n *Node) *Secret {
54 o := n.AsObject()
55
56 mustHave := map[string]bool{
57 "apiKey": true,
58 "authDomain": true,
59 "projectId": true,
60 "storageBucket": true,
61 }
62
63 count := 0
64 for _, k := range o.GetKeys() {
65 if mustHave[k] {
66 count++
67 }
68 }
69 if count != len(mustHave) {
70 return nil
71 }
72
73 if !strings.HasPrefix(o.GetStringI("apiKey", ""), "AIza") {
74 return nil
75 }
76
77 return &Secret{
78 Kind: "firebase",
79 Severity: SeverityHigh,
80 Data: o.AsMap(),
81 }
82 }}
83}

Callers 1

AllSecretMatchersFunction · 0.85

Calls 4

AsObjectMethod · 0.80
GetKeysMethod · 0.80
GetStringIMethod · 0.80
AsMapMethod · 0.45

Tested by

no test coverage detected