15 Commits
Author SHA1 Message Date
John ChiltonandClaude Opus 5.5 dacd26551d Test run-as with an unmatched Bearer token returns 403
Red before the user_can_do_run_as(None) fix (500), green after.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 09:59:36 -05:00
Dannon Baker 44c482438e Pin the credential order and the anonymous run-as case
These guard tests should keep passing through the refactor. A REST request with an API key and a bogus Bearer token still authenticates by the key. An anonymous request with a run-as header is still served anonymously instead of tripping the run-as check. Over MCP, a bad Bearer token isn't rescued by a good api_key argument.

(cherry picked from commit 2c2bed0c78)
2026-10-27 14:18:28 -04:00
Dannon Baker 317d67f348 Assert WSGI-served pages send X-Frame-Options exactly once
Pages that come through the legacy WSGI app currently get X-Frame-Options from both the WSGI transaction and the FastAPI middleware, so the existing published-page test only checked that SAMEORIGIN was somewhere in the value. Tighten it to an exact match and cover a couple more WSGI-served client routes, since requests joins repeated headers with a comma.
2026-10-14 11:32:15 -04:00
mvdbeekandClaude Opus 5.5 34c3ac2a0a Serve the client for /datasets/... client routes
The /datasets/{dataset_id}/{action}/{filename} route matches /datasets/list,
/datasets/{id} and /datasets/{id}/{tab}, and since the dataset controller has
none of those actions they resolved to DatasetInterface.default, which only
returned "This link may not be followed from within Galaxy.". Before the
catch-all, the explicit client routes skipped default methods; now unhandled
paths fall back to the client, so the stub is no longer needed.

Also check that the client paths test actually gets the client app rather
than any HTML response.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 17:56:44 +02:00
Dannon Baker d3ae493412 Add failing tests for client paths that match a route but have no handler
The catch-all only kicks in when the mapper matches nothing, but the
legacy /{action} and /{controller}/{action} routes match most client
paths. "/", "/histories" and "/admin/users" resolve to a controller with
no such action and 404 instead of serving the client.
2026-10-07 19:21:09 -04:00
Dannon Baker f8b7ae4438 Check X-Frame-Options on a non-embed published page
/published/page is no longer a registered client route, so it's served
by the catch-all now. The embed test already checks that the header is
skipped there; this adds the counterpart so we know a plain published
page still gets SAMEORIGIN.
2026-10-07 19:21:09 -04:00
mvdbeek f05457c153 Merge branch 'release_26.0' into release_26.1
# Conflicts:
#	lib/galaxy_test/api/test_framework.py
2026-10-02 09:26:07 +02:00
rmz-oz 3f8b371537 Return 400 for request bodies that webob cannot parse
A multipart request with an empty boundary made webob raise ValueError
while building the transaction, which ended up as a 500.

Fixes #22582
2026-10-01 07:47:30 +03:00
Dannon Baker b1fa123b74 Skip X-Frame-Options header for published embed views
The X-Frame-Options: SAMEORIGIN middleware was applied to all responses,
which blocked /published/page?embed=true and /published/workflow?embed=true
from loading in external iframes. Now both the FastAPI and WSGI middleware
skip the header when the request path starts with /published/ and the
embed=true query param is present.

Fixes #21074
2026-03-16 12:35:56 -04:00
John Chilton 018d066e36 Useful test decorators and runtime support for annotating how tests will be used. 2022-11-26 11:28:36 -05:00
Nicola Soranzo 0391cd4b62 Rename FooBarTestCase test classes as TestFooBar in API, framework, performance, Selenium and ToolShed tests
These are collected by pytest only because they are `unittest.TestCase` derived,
but normally pytest collects only test classes whose name starts with `Test`, see
https://docs.pytest.org/en/7.1.x/reference/reference.html#confval-python_classes

Also:
- Some type annotations
2022-10-15 17:54:31 +01:00
Dannon Baker 623a5e165a Apply black formatting.
Apply isort.
2022-02-03 07:42:20 -05:00
davelopez 6ceb9d79da Fix run_as to be passed in the headers
The legacy API framework allowed to pass the `run_as` user in the payload but, moving forward to the new framework, looks like the headers is a better place for it (see https://github.com/galaxyproject/galaxy/pull/11342/commits/91e7d5191d70f3b286fdf86b39af657bede35f09).

- Adapt existing framework tests to pass in the `run_as` user in the headers instead of the payload.
- Fix the legacy framework not retrieving the `run_as` from the headers when the payload was not in JSON (i.e. Form data)
- Add a bit more of documentation for the OpenAPI schema.
2021-09-21 10:46:48 +02:00
John Chilton cb9c9afe98 sync webframeworks on x-frame-options 2021-01-27 01:14:17 -05:00
John Chilton d04c020747 Migrate api tests into lib/galaxy_test for packaging. 2019-11-12 09:05:08 -05:00