Files
galaxy/test/functional/tools/tool_provided_metadata_security.xml
mvdbeek 64360a6172 Harden tool-provided dynamic output collection
Galaxy parses tool-generated galaxy.json after a job exits, in the job handler rather than in the tool container. User-authored and interactive tools must therefore not be able to turn metadata filenames, extra-files paths, symlinks, or unnamed outputs into reads or links outside the job working directory.

Apply realpath-aware containment checks to declared metadata datasets, pattern-discovered files, extra-files directories, the metadata file itself, and the final object-store persistence boundary. Preserve valid nested paths, in-root symlinks, deferred collection elements, and the deliberately privileged external-link behavior used only by the built-in data-fetch path.

Represent unnamed-output and external-link permissions as explicit tool capabilities and serialize them for extended metadata collection. GalaxyUserTool definitions cannot enable ToolProvidedMetadata. Interactive tools and ordinary XML tools with profiles newer than 26.2 must opt in, while profiles through 26.2 and already-running jobs retain their historical behavior for upgrade compatibility.

Cover local, extended/sessionless, and Pulsar collection with regressions for traversal, absolute paths, escaping symlinks, extra files, UDT opt-in attempts, data-fetch spoofing, trusted collection links, deferred elements, profile behavior, and metadata-file confinement. The extended-metadata integration regression also verifies that a rejected external file never reaches history persistence.
2026-08-30 11:58:21 +02:00

22 lines
722 B
XML

<tool id="tool_provided_metadata_security" name="tool_provided_metadata_security" version="1.0.0" profile="26.1">
<command><![CDATA[
echo 'outside working directory sentinel' > ../outside_working_directory.txt &&
echo 'declared output' > '$sample' &&
cp '$provided_metadata' galaxy.json
]]></command>
<configfiles>
<configfile name="provided_metadata">{"sample": {
"datasets": [
{"filename": "../outside_working_directory.txt", "name": "outside working directory sentinel", "ext": "txt"}
]
}}
</configfile>
</configfiles>
<inputs />
<outputs>
<data name="sample">
<discover_datasets from_provided_metadata="true" visible="true" />
</data>
</outputs>
</tool>