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)
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.
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>
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.
/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.
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
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.