mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-11-28 20:09:01 +08:00
DynamicToolManager.list_tools backs the public, unauthenticated GET /api/dynamic_tools endpoint but filtered only on active, not public. Any anonymous caller could list every user's private GalaxyUserTool rows, including the full stored representation (shell_command and all). Filter on DynamicTool.public == true() so the index only ever returns admin-installed dynamic tools.
22 lines
858 B
Python
22 lines
858 B
Python
from galaxy.tool_util_models import UserToolSource
|
|
from galaxy_test.base.populators import (
|
|
DatasetPopulator,
|
|
TOOL_WITH_SHELL_COMMAND,
|
|
)
|
|
from ._framework import ApiTestCase
|
|
|
|
|
|
class TestUnprivilegedToolsApiSurface(ApiTestCase):
|
|
|
|
def setUp(self):
|
|
super().setUp()
|
|
self.dataset_populator = DatasetPopulator(self.galaxy_interactor)
|
|
|
|
def test_public_dynamic_tools_index_excludes_private_udt(self):
|
|
with self.dataset_populator.user_tool_execute_permissions():
|
|
dynamic_tool = self.dataset_populator.create_unprivileged_tool(UserToolSource(**TOOL_WITH_SHELL_COMMAND))
|
|
response = self._get("dynamic_tools", anon=True)
|
|
assert response.status_code == 200, response.text
|
|
listed_uuids = {t["uuid"] for t in response.json()}
|
|
assert dynamic_tool["uuid"] not in listed_uuids, response.text
|