Skip to content

Accept portal paths as resource URLs - #223

Open
raylim wants to merge 2 commits into
cBioPortal:mainfrom
raylim:feat/resource-relative-url
Open

raylim wants to merge 2 commits into
cBioPortal:mainfrom
raylim:feat/resource-relative-url

Conversation

@raylim

@raylim raylim commented Nov 5, 2026 •

Copy link
Copy Markdown

validateData.py accepts a resource URL in two forms:

  • An absolute http:// or https:// URL with a host (the scheme is case-insensitive).
  • A path on the portal, starting with a single /, which the portal serves relative to its own host, so study data doesn't need to name the host it is loaded into:
/wsi/patient/P-0000012?studyId=msk_impact&slideKey=0acdab3d2bb2

Everything else is rejected:

  • other schemes (javascript:, data:, ftp:, ...);
  • //host/... (a host without a scheme) and a path without the leading /;
  • a backslash or control character anywhere in the URL. Browsers read \ as / and drop control characters, so /\evil.com/x or \\evil.com would link to another host.

The Java importer doesn't check URL format, so it needs no change.

Docs: docs/File-Formats.md in cBioPortal/cbioportal (companion PR).

Tests: test_resource_url_may_be_a_path_on_the_portal, test_resource_url_rejects_what_browsers_would_send_elsewhere. test_scripts.sh (194 tests) passes.

🤖 Generated with Claude Code

raylim and others added 2 commits November 5, 2026 17:45
A resource URL may be a path starting with a single "/", which the portal
serves relative to its own host, so study data does not have to name the host
it will be served from. Absolute URLs still need a scheme and a host; "//host"
and paths without the leading "/" are rejected.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A resource URL is accepted only as an absolute http or https URL with a
host (scheme case-insensitive) or a path starting with a single "/".
Backslashes and control characters are rejected anywhere, since browsers
read "\" as "/" and drop control characters, which would turn "/\host" or
"\\host" into a link to another host. Other schemes (javascript:, data:,
ftp:, ...) are rejected.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant