Skip to content

Closing potential security issue: xcube server allows for host name forging#1210

Open
thomasstorm wants to merge 8 commits into
mainfrom
thomas-1203-host_security
Open

Closing potential security issue: xcube server allows for host name forging#1210
thomasstorm wants to merge 8 commits into
mainfrom
thomas-1203-host_security

Conversation

@thomasstorm
Copy link
Copy Markdown
Contributor

@thomasstorm thomasstorm commented Apr 24, 2026

This PR closes the security vulnerability documented in #1203, and in more detail in the mail "Potential Security Issue-Host Name Vulnerability in Xcube" to xcube-team@brockmann-consult.de on 2026-03-21.

To test, you can run a local server, and make a GET-request to http://localhost:8080/openapi.html, with the header field "Host" set to geodb.openeo.brockmann-consult.de (or any other host that serves an openapi.json). The server will redirect you to geodb.openeo.brockmann-consult.de/openapi.json, which poses a potential security threat.
The PR allows to add a whitelist for allowed hosts in the configuration:

allowed_hosts:
    - "localhost:8080"

Once set, GET requests to http://localhost:8080/openapi.html with 'Host' set to anything else than listed in the allowed_origin will result in an HTTP 400 error.

Checklist:

  • Add unit tests and/or doctests in docstrings
  • Add docstrings and API docs for any new/modified user-facing classes and functions - dna
  • New/modified features documented in docs/source/* - dna
  • Changes documented in CHANGES.md
  • GitHub CI passes
  • AppVeyor CI passes
  • Test coverage remains or increases (target 100%)

Fixes #1203.

@thomasstorm thomasstorm self-assigned this Apr 24, 2026
@konstntokas konstntokas self-requested a review April 24, 2026 13:48
@forman forman self-requested a review April 27, 2026 09:14
Copy link
Copy Markdown
Member

@forman forman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, but please consider my suggestions and notes.

Comment thread test/server/webservers/test_tornado.py
Comment thread test/server/test_server.py Outdated
Comment thread xcube/server/webservers/tornado.py Outdated
Comment thread CHANGES.md Outdated
Comment thread examples/serve/demo/config.yml Outdated
Comment thread xcube/server/webservers/tornado.py Outdated
Comment thread test/server/test_server.py Outdated
@forman
Copy link
Copy Markdown
Member

forman commented Apr 27, 2026

...and please use a clear, findable PR title.

You can include Fixes #1203 in the description to autoclose #1203 on merge.

@forman
Copy link
Copy Markdown
Member

forman commented Apr 27, 2026

...also note that the build is currently failing.

thomasstorm and others added 2 commits April 27, 2026 12:43
Co-authored-by: Norman Fomferra <norman.fomferra@brockmann-consult.de>
Co-authored-by: Norman Fomferra <norman.fomferra@brockmann-consult.de>
@thomasstorm thomasstorm changed the title fixed #1203 Closing potential security issue: xcube server allows for host name forging Apr 27, 2026
Copy link
Copy Markdown
Contributor

@konstntokas konstntokas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my one comments. Otherwise it looks good. :)

Comment thread xcube/server/config.py Outdated
@thomasstorm thomasstorm requested a review from forman April 27, 2026 15:08
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.53%. Comparing base (d94ebe7) to head (84fec58).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1210   +/-   ##
=======================================
  Coverage   89.53%   89.53%           
=======================================
  Files         280      280           
  Lines       21655    21662    +7     
=======================================
+ Hits        19389    19396    +7     
  Misses       2266     2266           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Potential Security Issue

3 participants