From 65ff70ae4e14ed304106a2b00b2004f0e306fe0d Mon Sep 17 00:00:00 2001 From: Liz Rice Date: Mon, 21 Dec 2020 16:25:29 +0000 Subject: [PATCH] Fake test file that GitHub Actions should accept --- app_test.go | 11 +++----- hack/test-definitions/definitions.yaml | 35 ++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 hack/test-definitions/definitions.yaml diff --git a/app_test.go b/app_test.go index 70a67f6..8071c84 100644 --- a/app_test.go +++ b/app_test.go @@ -5,14 +5,9 @@ import ( "testing" ) -var ( - cfgdir = "./cfg" - ver = "1.1.0" -) - // Tests all standard linux-bench defintion files func TestGetDefinitionFilePath(t *testing.T) { - d, err := os.Open(cfgdir) + d, err := os.Open("./cfg") if err != nil { t.Errorf("unexpected error: %s\n", err) } @@ -23,6 +18,7 @@ func TestGetDefinitionFilePath(t *testing.T) { } for _, ver := range vers { + t.Logf("%v", ver) _, err := getDefinitionFilePath(ver) if err != nil { t.Errorf("unexpected error: %s\n", err) @@ -31,7 +27,8 @@ func TestGetDefinitionFilePath(t *testing.T) { } func TestRunControls(t *testing.T) { - path, err := getDefinitionFilePath(ver) + cfgDir = "./hack" + path, err := getDefinitionFilePath("test-definitions") if err != nil { t.Errorf("unexpected error: %s\n", err) } diff --git a/hack/test-definitions/definitions.yaml b/hack/test-definitions/definitions.yaml new file mode 100644 index 0000000..a7ba119 --- /dev/null +++ b/hack/test-definitions/definitions.yaml @@ -0,0 +1,35 @@ +--- +controls: +version: 0.1 +id: 1 +description: "Test YAMl file" +type: "hack" +groups: + - id: 1.1 + description: "Filesystem Configuration" + checks: + - id: 1.1.1 + description: "Disable unused filesystems" + checks: + - id: 1.1.1.1.a + description: "Ensure mounting of cramfs filesystems is disabled" + audit: "echo hello" + tests: + test_items: + - flag: "hello" + set: true + remediation: | + Correct something about this test + scored: true + - id: 1.1.1.1.b + description: "Ensure mounting of cramfs filesystems is disabled" + audit: "echo hello=false" + tests: + test_items: + - flag: "hello" + compare: + op: eq + value: "false" + set: true + remediation: | + Put your remediation here