(t *testing.T)
| 44 | } |
| 45 | |
| 46 | func TestAssertSecurePath_ValidAbsolutePath(t *testing.T) { |
| 47 | dir := t.TempDir() |
| 48 | p := filepath.Join(dir, "valid.txt") |
| 49 | if err := os.WriteFile(p, []byte("data"), 0o600); err != nil { |
| 50 | t.Fatalf("write temp file: %v", err) |
| 51 | } |
| 52 | |
| 53 | got, err := AssertSecurePath(AuditParams{ |
| 54 | TargetPath: p, |
| 55 | Label: "test", |
| 56 | AllowInsecurePath: true, |
| 57 | }) |
| 58 | if err != nil { |
| 59 | t.Fatalf("unexpected error: %v", err) |
| 60 | } |
| 61 | if got != p { |
| 62 | t.Errorf("got %q, want %q", got, p) |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | func TestAssertSecurePath_WorldWritable_Rejected(t *testing.T) { |
| 67 | if runtime.GOOS == "windows" { |
nothing calls this directly
no test coverage detected