mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-24 02:04:04 +08:00
Move test for local files to invalid urls
Only https and http schemes are allowed so any other scheme will be considered invalid.
This commit is contained in:
@@ -52,12 +52,6 @@ class TestProxyApi(ApiTestCase):
|
||||
self._assert_status_code_is(response, 403)
|
||||
assert response.json()["err_msg"] == "Anonymous users are not allowed to access this endpoint"
|
||||
|
||||
def test_user_cannot_access_local_file(self):
|
||||
local_file_url = "file://etc/passwd"
|
||||
response = self._get(f"proxy?url={local_file_url}")
|
||||
self._assert_status_code_is(response, 403)
|
||||
assert response.json()["err_msg"] == "Action requires admin account."
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"invalid_url",
|
||||
[
|
||||
@@ -65,10 +59,12 @@ class TestProxyApi(ApiTestCase):
|
||||
"http:/missing-slash.com",
|
||||
"//missing-scheme.com",
|
||||
"invalid-url",
|
||||
"ftp://not-allowed.com",
|
||||
"https://first.url\nhttps://second.url",
|
||||
"https://first.url https://second.url",
|
||||
"https://first.urlhttps://second.url",
|
||||
# Schemes other than http and https are not allowed
|
||||
"ftp://not-allowed.com",
|
||||
"file://etc/passwd",
|
||||
],
|
||||
)
|
||||
def test_invalid_url_format(self, invalid_url: str):
|
||||
|
||||
Reference in New Issue
Block a user