61 Commits
Author SHA1 Message Date
mvdbeek ee3358c890 Merge branch 'release_26.2' into dev 2026-11-20 06:17:17 +01:00
mvdbeek a4f1d23075 Merge branch 'release_26.1' into release_26.2 2026-11-20 06:10:51 +01:00
mvdbeek 92e2e4da8c Merge branch 'release_26.0' into release_26.1 2026-11-20 06:04:47 +01:00
mvdbeek a836a1a59f Merge branch 'release_25.1' into release_26.0 2026-11-20 06:01:05 +01:00
Luís Felipe de Oliveira 45506afc45 Assert one-day cache policy for tool icon responses 2026-11-17 13:13:46 -03:00
guerler ca31ff8c00 Serve saved visualizations as widgets 2026-11-13 10:54:30 +03:00
guerler 820f15384b Reject negative workflow versions in the widget schema 2026-11-11 20:43:51 +03:00
guerler 0c930565a2 Serve pages and workflows as widgets 2026-11-11 20:43:51 +03:00
guerler c29a600b3e List the widgets and their parameters in the API 2026-11-11 20:43:51 +03:00
felipsoliveira cbad53ce09 Fix ETag revalidation for tool icons
The If-None-Match check stripped the quotes from the client value but
compared it against the quoted ETag, so it never matched and icons were
always re-sent. Compare the opaque tags instead (accepting W/ and *),
let If-None-Match take precedence over If-Modified-Since, send the
cache headers on 304 responses too, and drop 'immutable' since the icon
URL isn't versioned.
2026-11-07 13:57:52 -03:00
mvdbeek eb5fc39452 Merge branch 'release_26.1' into release_26.2 2026-11-06 06:12:44 +01:00
Dannon Baker 75c01f39a6 Bound and sanitize lift-status response headers
Drop the aggregate lift headers from the unprivileged tools index
endpoint entirely -- an aggregate across all of a user's tools is
unbounded, has no per-tool attribution, and the same information is
already in the response body per tool. The single-tool endpoints keep
their headers (raw_tool_source has no other channel, the body is the
tool source itself) but dedupe and cap them at 20 entries and a hard
1KB byte bound with a '+N more' suffix, and the Warning header no
longer duplicates the whole list -- it just carries the count and
points at the X-Galaxy-* header. Error paths embed stored dict keys,
so control characters and non-ASCII are replaced and the ends are
stripped before emission; that closes a header-injection hole, keeps
h11 from rejecting a value that starts or ends with a space, and makes
len() the encoded byte length. The helpers live in api/common.py since
both dynamic_tools and the legacy tools controller use them. The
integration tests also cover raw_tool_source, the invalid path on show,
and a stored key with a trailing space.
2026-11-05 11:39:58 -05:00
mvdbeek 7caed04481 Check CBV streaming semantics across supported FastAPI versions 2026-11-05 11:14:23 +01:00
mvdbeek 65684fc0a9 Avoid redundant router nesting for FastAPI class based views 2026-11-05 10:58:41 +01:00
Dannon Baker c30ac3924a Test MCP auth with a Bearer token and the new missing-key hint
MCP should accept an OIDC access token in the Authorization header, the same way the REST API does. The precedence should be the x-api-key header, then the Bearer token, then the api_key argument, so both kinds of operator config still beat a key the model passes. Like REST, a Galaxy API key sent as a Bearer token isn't accepted. There's also a guard test that a bad x-api-key header isn't rescued by a good argument, and the missing-key error should now point at the header and warn that the argument exposes the key to the model provider.

(cherry picked from commit 52bd149bf4)
2026-10-27 14:18:28 -04:00
Dannon Baker 005dd86ecf Expect the x-api-key header to win over the api_key argument
The header comes from the operator's client config and the argument comes from the model, so if both are set the header should decide who the call runs as. Otherwise a key that gets into the model's context, say from a dataset or a page it read, could run tools as someone else. These tests fail until the precedence is flipped.
2026-10-22 15:19:33 -04:00
Dannon Baker 0e4af97cd0 Add tests for passing the MCP API key in an x-api-key header
The built-in MCP server only takes the API key as a required api_key tool argument, so the key has to go through the model. These tests cover sending it as an x-api-key header instead, the argument still working and winning over the header, an empty argument falling back to the header, and the error when there's no key at all. Most of them fail until the server reads the header.
2026-10-22 15:19:33 -04:00
mvdbeek d7bb522c0f Merge branch 'release_26.1' into dev
# Conflicts:
#	client/src/components/BaseComponents/GModal.vue
#	client/src/components/Common/GCard.vue
#	client/src/components/Tool/ToolSourceSchema.json
#	client/src/composables/filter/filter.worker.js
#	client/src/utils/logout.js
#	lib/galaxy/tool_util_models/__init__.py
#	lib/galaxy/tool_util_models/tool_source.py
#	lib/galaxy/tools/__init__.py
#	lib/galaxy/util/rst_to_html.py
#	lib/galaxy/webapps/galaxy/api/tools.py
2026-10-03 20:33:55 +02:00
mvdbeek fac7ddf1ce Merge branch 'release_26.0' into release_26.1
# Conflicts:
#	lib/galaxy/managers/pages.py
#	lib/galaxy/schema/schema.py
#	lib/galaxy_test/api/test_pages.py
2026-10-03 20:11:41 +02:00
mvdbeek c1df9a13aa Merge branch 'release_25.1' into release_26.0 2026-10-03 20:02:57 +02:00
mvdbeek ec4b78987d Keep numeric changeset hashes as strings when installing shed repositories
Form-encoded API payload values are JSON-decoded, so a changeset hash made
up only of digits (about 1 in 300 hashes) reached
InstallRepositoryManager.install() as an int. It then never equalled the
tool shed's installable revision, the already-installed check matched, and
the install returned early without reactivating deactivated repository
dependencies. This is the intermittent test_1040 circular dependency
failure in the Toolshed tests workflow.
2026-10-02 15:00:30 +02:00
mvdbeek bfe93c18f6 Gate email and display name changes on the account settings
PUT /api/users/{user_id} let a non-admin change their email and display
name while enable_account_interface is false, which the legacy
information/inputs endpoint refuses. Both fields now go through the same
gate, and every UserUpdatePayload field has to be listed as either gated
or exempt, so a new field cannot skip it unnoticed.

Under use_remote_user or disable_local_accounts the email is what the
proxy or identity provider resolves the account by, so
UserManager.update_email no longer lets a non-admin choose it. OIDC
profile sync writes the address the identity provider asserts and marks
the call with asserted_by_identity_provider to bypass the check.
2026-09-28 20:35:01 +02:00
mvdbeek 93c0eb9ae4 Merge release_26.1 into dev
Forward-port the JavaScript sandbox and upload path traversal fixes, preserving this branch's APIs and dependency layout.
2026-09-16 17:54:51 +02:00
mvdbeek 7a59727f38 Merge release_26.0 into release_26.1
Forward-port the JavaScript sandbox and upload path traversal fixes, preserving this release's APIs and dependency layout.
2026-09-16 17:26:58 +02:00
mvdbeek 8826d9f904 Merge release_25.1 into release_26.0
Forward-port the JavaScript sandbox and upload path traversal fixes, preserving this release's APIs and dependency layout.
2026-09-16 17:24:49 +02:00
mvdbeek ecb0b0148d Merge release_25.0 into release_25.1
Forward-port the JavaScript sandbox and upload path traversal fixes, preserving this release's APIs and dependency layout.
2026-09-16 16:36:07 +02:00
mvdbeek 69511ab2f4 Merge release_24.1 into release_24.2
Forward-port the JavaScript sandbox and upload path traversal fixes, preserving this release's APIs and dependency layout.
2026-09-16 16:32:02 +02:00
mvdbeek 26eb0c6470 Merge release_24.0 into release_24.1
Forward-port the JavaScript sandbox and upload path traversal fixes. Preserve the 24.1 expression context argument and dependency pins.
2026-09-16 16:26:09 +02:00
mvdbeek 7f2e730c6c Fix JavaScript sandbox escapes and upload path traversal in 24.0
Backport the QuickJS Python expression worker and upload staging path
validation together. Preserve this release's APIs and dependency layout.
JavaScript evaluations use fresh workers, allocator and stack limits,
bounded JSON messages, and a parent deadline. Optional isolation wrappers
remain supported; simple parameter references resolve in Python.

Validate composite and extra-file names at the staging sinks, checking
relative paths and realpath containment while preserving valid names.
Include regressions for sandbox escapes, resource limits, worker cleanup,
missing QuickJS, traversal attempts, and legitimate composite uploads.

Backport-of: 13052c94c68
Backport-of: 0509450ee1cbde0a3acaf07119d9e1202dfa0ddf
Base: e61a74b4fb (release_24.0)
2026-09-16 16:17:04 +02:00
mvdbeek a5f60f2001 Merge branch 'release_26.1' into dev 2026-07-14 19:13:50 +02:00
mvdbeek dd9bd5c80d Expose a recommend_biocontainer tool on the MCP server
MCP clients can already create user tools via create_user_tool, but with no container
verification -- its docstring even suggests bare images like python:3.12-slim, reproducing the
hallucinated/non-biocontainer problem the custom-tool agent now guards against. Add a
recommend_biocontainer MCP tool that wraps recommend_container + biocontainer_tag_built (pure
library functions, no app dependency) so a client can resolve and verify a real
quay.io/biocontainers image -- returning image/found/match_quality/source/notes/verified -- and
use it as the container for create_user_tool. The parse+shape logic is a module-level helper with
injectable collaborators so it is unit-testable offline; auth via the existing api-key path.
2026-07-07 16:39:18 +02:00
paperbenni bec3d3ad9c Drop support for Python 3.8
Drop Python 3.8 support in 5 Pulsar-compatible packages
(job_metrics, tool_util, tool_util_models, util, objectstore)
and run pyupgrade --py310-plus on their source code.

- Bump requires-python from >=3.8 to >=3.10 in all 5 packages
- Remove Python 3.8 and 3.9 classifiers
- Remove ruff per-file-ignores for UP rules on these paths
- Remove backports.zoneinfo conditional dependency
- Remove pydyf<0.11 pin from conditional-requirements.txt
- Update Makefile pyupgrade target (remove PY38_PYUPGRADE_PATHS)
- Update CI workflow to test with Python 3.10 instead of 3.8

Clean up unused deprecated typing imports after pyupgrade

Remove now-unused typing imports (Dict, List, Optional, Set, Tuple,
Type, Union) that became dead after pyupgrade --py310-plus converted
annotations to use built-in types and | syntax.

Also run ruff check --fix --select=UP007,UP045 across the entire
codebase to convert remaining Optional[X] -> X | None and
Union[X, Y] -> X | Y patterns.

Enable ruff UP007/UP045 for Python 3.10 union syntax

Remove UP007 (Union[X,Y] -> X | Y) and UP045 (Optional[X] -> X | None)
from the ruff ignore list and convert all type aliases across the
codebase. These rules were deferred while Python 3.9 was supported;
requires-python is now >=3.10.

A custom script was used because neither ruff --fix nor
pyupgrade --py310-plus converts Optional[X]/Union[X,Y] in type alias
positions (e.g. X = Union[A, B]) — they only handle annotation
positions (e.g. def f(x: Optional[int])). All 167 violations were
module-level type aliases. A few edge cases were fixed manually:
single-element Union[X,], typing.Union qualified refs, runtime
Optional[type] calls, and Annotated[Optional[...]] pydantic fields.

Fix UP007 autofix regression with string forward reference type aliases

Commit fa6bd955a0 enabled ruff UP007/UP045 and auto-fixed
module-level type aliases using Union with string forward
references, producing invalid 'str | str' expressions.

This was a known ruff bug (charliermarsh/ruff#826) that has since
been fixed in later ruff versions, but this codebase was
converted before the fix was in place.

Revert to Union syntax and restore TYPE_CHECKING imports that
ruff's TCH rule cleaned up as a side effect when it thought the
forward references were unused.
2026-06-25 15:12:05 +01:00
mvdbeek 34f2992262 Fix MCP get_dataset_details crash on display-apps serialization
MCP tools constructed a bare WorkRequestContext, which has no .request
attribute. HDASerializer.serialize_old_display_applications reads
trans.request.base to build absolute display-app URLs, so any tool
running detailed HDA serialization crashed with AttributeError when
enable_old_display_applications was enabled.

Switch to SessionRequestContext backed by minimal _StaticRequest /
_StaticResponse stubs derived from galaxy_infrastructure_url (the same
base URL already used for the MCP URL builder).
2026-05-04 22:32:34 +02:00
Nicola Soranzo 17003e8d00 Apply 2026 black style 2026-01-20 10:25:45 +00:00
Nicola Soranzo 53b7959663 Merge branch 'release_25.0' into dev 2025-09-30 18:10:20 +01:00
Nicola Soranzo aa7acb078d Fix test_multiple_decorators unit test for FastAPI 0.118.0
Fix the following error in test_galaxy_packages:

FAILED tests/webapps/api/test_cbv.py::test_multiple_decorators - AssertionError: fastapi_middleware_astack not found in request scope

xref. https://github.com/fastapi/fastapi/issues/14128
2025-09-30 13:23:51 +01:00
John Chilton 5eba4df33d Fix aliases in fetch_data. 2025-08-18 11:08:05 -04:00
Nicola Soranzo 4588a27c0f Code cleanups from pyupgrade
Found by running:

```
make pyupgrade
```
2024-03-10 03:32:47 +00:00
Nicola Soranzo e975ca3754 Update to black 2024 stable style 2024-01-30 18:09:51 +00:00
mvdbeek 04441e503c Fix encoded id unit test 2024-01-08 11:33:44 +01:00
mvdbeek a13932c71c Fix id field unit tests 2024-01-08 11:33:34 +01:00
mvdbeek ed1c30a8b9 Fix fetch_data schema unit tests 2024-01-08 11:33:29 +01:00
mvdbeek 1593570e33 Replace DecodedDatabaseIdField.encode with Security.security.encode_id 2024-01-08 11:33:25 +01:00
John Davis 7d6a0eed19 Fix import in unit test 2023-12-18 15:03:10 -05:00
John Davis c6dad0bce6 Fix linting, add attribution 2023-12-18 14:51:58 -05:00
John Davis a8a2903a31 Copy fastapi-utils.cbv.py + unit tests, change import 2023-12-18 14:16:48 -05:00
mvdbeek e502863657 Add missing optional description field, fixes ephemeris data library example 2023-12-01 11:00:52 +01:00
davelopez a7303e219e Fix API unit tests with ID encodings 2022-08-24 12:05:47 +02:00
davelopez 8355d5e12d Add more unit tests for ID fields 2022-08-24 12:00:26 +02:00
Marius van den BeekandNicola Soranzo 973d0779b6 Include timezone testing
Co-authored-by: Nicola Soranzo <nicola.soranzo@gmail.com>
2022-08-17 18:43:57 +02:00