Close out the repository audit
This commit is contained in:
28
internal/promptdebug/debug_writer_other_test.go
Normal file
28
internal/promptdebug/debug_writer_other_test.go
Normal file
@@ -0,0 +1,28 @@
|
||||
//go:build !unix
|
||||
|
||||
package promptdebug
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestPromptDebugWriterFailsClosedWithoutSecureTraversal(t *testing.T) {
|
||||
root := filepath.Join(t.TempDir(), "debug")
|
||||
writer, err := NewPromptDebugWriter(root)
|
||||
if writer != nil || !errors.Is(err, ErrSecureCaptureUnsupported) {
|
||||
t.Fatalf("NewPromptDebugWriter() = %#v, %v, want unsupported error", writer, err)
|
||||
}
|
||||
if _, statErr := os.Stat(root); !os.IsNotExist(statErr) {
|
||||
t.Fatalf("prompt debug root was accessed: %v", statErr)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDisabledPromptDebugWriterRemainsPortable(t *testing.T) {
|
||||
writer, err := NewPromptDebugWriter("")
|
||||
if err != nil || writer == nil || writer.Enabled() {
|
||||
t.Fatalf("NewPromptDebugWriter(empty) = %#v, %v", writer, err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user