Skip to content

Commit

Permalink
remove: dst related test
Browse files Browse the repository at this point in the history
  • Loading branch information
dduzgun-security committed Jan 27, 2025
1 parent 9bf13d2 commit 81b5313
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions internal/unpackinfo/unpackinfo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,39 +161,6 @@ func TestNewUnpackInfo(t *testing.T) {
t.Fatalf("expected error to contain %q, got %q", expected, result.Path)
}
})

t.Run("destination starting with ./ followed with ../", func(t *testing.T) {
dst := t.TempDir()
_, err := NewUnpackInfo("./../../"+dst, &tar.Header{
Name: "foo.txt",
Typeflag: tar.TypeSymlink,
})

if err == nil {
t.Fatal("expected error, got nil")
}

expected := "traversal with \"..\" outside of current"
if !strings.Contains(err.Error(), expected) {
t.Fatalf("expected error to contain %q, got %q", expected, err)
}
})
t.Run("destination followed with ../", func(t *testing.T) {
dst := t.TempDir()
_, err := NewUnpackInfo(dst+"../../foo", &tar.Header{
Name: "foo.txt",
Typeflag: tar.TypeSymlink,
})

if err == nil {
t.Fatal("expected error, got nil")
}

expected := "traversal with \"..\" outside of current"
if !strings.Contains(err.Error(), expected) {
t.Fatalf("expected error to contain %q, got %q", expected, err)
}
})
t.Run("empty destination", func(t *testing.T) {
emptyDestination := ""
_, err := NewUnpackInfo(emptyDestination, &tar.Header{
Expand Down

0 comments on commit 81b5313

Please sign in to comment.