Skip to content

Commit 2c81929

Browse files
committed
Remove unsafe-paths test obsoleted by hex_core 0.16.0
hex_core 0.16.0 validates paths at the public API boundary in both :hex_tarball.create_docs/1 and :hex_tarball.unpack_docs/2. The test relied on create_docs accepting unsafe paths so it could exercise the unpacker's rejection. With validation now enforced at create, the case the test covered is no longer reachable through the library's contract.
1 parent 507ba75 commit 2c81929

1 file changed

Lines changed: 0 additions & 29 deletions

File tree

test/hexdocs/queue_test.exs

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -80,35 +80,6 @@ defmodule Hexdocs.QueueTest do
8080
assert Store.get(@public_bucket, "package_names.csv") == "package1\npackage2\n"
8181
end
8282

83-
test "unsafe paths", %{test: test} do
84-
Mox.expect(HexpmMock, :get_package, fn repo, package ->
85-
assert repo == "hexpm"
86-
assert package == "#{test}"
87-
88-
%{"releases" => []}
89-
end)
90-
91-
tar =
92-
Hexdocs.Tar.create([
93-
{"dir/./foo.html", ""},
94-
{"dir/../bar.html", ""},
95-
{"dir/../../baz.html", ""}
96-
])
97-
98-
key = "docs/#{test}-1.0.0.tar.gz"
99-
Store.put!(:repo_bucket, key, tar)
100-
101-
log =
102-
ExUnit.CaptureLog.capture_log(fn ->
103-
ref = Broadway.test_message(Hexdocs.Queue, put_message(key))
104-
assert_receive {:ack, ^ref, [_], []}
105-
end)
106-
107-
assert log =~ "Failed unpack"
108-
assert log =~ "unsafe_path"
109-
assert ls(@public_bucket, "#{test}/1.0.0/") == []
110-
end
111-
11283
test "overwrite main docs with newer versions", %{test: test} do
11384
Mox.expect(HexpmMock, :get_package, fn repo, package ->
11485
assert repo == "queuetest"

0 commit comments

Comments
 (0)