()
| 49 | } |
| 50 | |
| 51 | func 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 | } |
no test coverage detected