MCPcopy Index your code
hub / github.com/larksuite/cli / TestAssertSecurePath_ValidAbsolutePath

Function TestAssertSecurePath_ValidAbsolutePath

internal/binding/audit_test.go:46–64  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

44}
45
46func 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
66func TestAssertSecurePath_WorldWritable_Rejected(t *testing.T) {
67 if runtime.GOOS == "windows" {

Callers

nothing calls this directly

Calls 2

AssertSecurePathFunction · 0.85
WriteFileMethod · 0.65

Tested by

no test coverage detected