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

Function TestAnalyzerBasicSecrets

analyzer_test.go:23–42  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

21}
22
23func TestAnalyzerBasicSecrets(t *testing.T) {
24 a := NewAnalyzer([]byte(`
25 function foo(){
26 return {
27 awsKey: "AKIAIOSFODNN7EXAMPLE",
28 secret: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
29 }
30 }
31 `))
32
33 secrets := a.GetSecrets()
34
35 if len(secrets) != 1 {
36 t.Errorf("Expected exactly 1 secret; got %d", len(secrets))
37 }
38
39 if secrets[0].Kind != "AWSAccessKey" {
40 t.Errorf("Expected first secret kind to be AWSAccessKey; got %s", secrets[0].Kind)
41 }
42}
43
44func TestIsProbablyHTML(t *testing.T) {
45 cases := []struct {

Callers

nothing calls this directly

Calls 2

GetSecretsMethod · 0.95
NewAnalyzerFunction · 0.85

Tested by

no test coverage detected