GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — sensor/seccomp_cmd_test.go at main · openctemio/sensor Expand file tree/ Copy pathseccomp_cmd_test.goMore file actions 51 lines (48 loc) · 1.42 KB / Copy pathseccomp_cmd_test.goFile metadata and controls51 lines (48 loc) · 1.42 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 package main import ( "bytes" "encoding/json" "os" "strings" "testing" ) // The command prints exactly the profile file of the repository (the one CI // tests the image with), as valid JSON that keeps the namespace rule. func TestSeccompProfileCommand(t *testing.T) { want, err := os.ReadFile("docker/seccomp/sensor.json") if err != nil { t.Fatal(err) } var out, errOut bytes.Buffer if code := runSeccompProfileCommand(nil, &out, &errOut); code != 0 { t.Fatalf("exit %d: %s", code, errOut.String()) } if !bytes.Equal(out.Bytes(), want) { t.Fatal("printed profile differs from docker/seccomp/sensor.json") } var doc struct { DefaultAction string `json:"defaultAction"` Syscalls []struct { Names []string `json:"names"` } `json:"syscalls"` } if err := json.Unmarshal(out.Bytes(), &doc); err != nil { t.Fatalf("profile is not JSON: %v", err) } if doc.DefaultAction != "SCMP_ACT_ERRNO" { t.Fatalf("default action %q: the profile must deny by default", doc.DefaultAction) } unshare := false for _, s := range doc.Syscalls { for _, n := range s.Names { unshare = unshare || n == "unshare" } } if !unshare { t.Fatal("the profile lost the unshare rule that network confinement needs") } errOut.Reset() if code := runSeccompProfileCommand([]string{"extra"}, &out, &errOut); code != 2 || !strings.Contains(errOut.String(), "usage") { t.Fatalf("extra argument: exit %d, %q", code, errOut.String()) } } |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |