Skip to content

Prevent Cuiman app requests from bypassing the authenticated API proxy - #261

Merged
forman merged 3 commits into
mainfrom
forman/258-cuiman_proxy_safeguards_and_diagnostics
Nov 19, 2026
Merged

forman merged 3 commits into
mainfrom
forman/258-cuiman_proxy_safeguards_and_diagnostics

Conversation

@forman

@forman forman commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Cuiman-launched apps could fail to connect when a processing service’s landing page returned HTTP 404, even when process discovery worked. Upstream redirects and changes submitted through the connection-error recovery dialog could also send browser requests outside Cuiman’s authenticated proxy, producing misleading CORS or authentication errors.

This PR improves connection recovery while keeping authentication managed by Python:

  • Tolerate a missing landing page: when GET / returns 404, Cuiman checks /processes using the authenticated client. A valid process list allows the app to continue with minimal service metadata. A Python warning and the service description identify the missing landing page without claiming service conformance.
  • Preserve discovery failures: errors from the /processes check are reported. Invalid process-list responses leave the original landing-page 404 intact.
  • Block upstream redirects: redirects with a Location header produce an actionable HTTP 502 response, with guidance about API URLs and reverse-proxy routing. Redirect targets and credentials are excluded from error messages.
  • Keep connection recovery inside the proxy: the bundled app rejects changes to its Cuiman proxy URL or browser authentication settings and explains how to restore the connection.

The landing-page fallback applies only to root GET requests through the app proxy. Explicit Python get_capabilities() calls retain their existing behavior. The app does not currently request /conformance, and no conformance declarations are synthesized.

Includes regression tests, updated documentation and changelog, and rebuilt frontend assets.

Checklist (strike out non-applicable):

  • Changes documented in CHANGES.md
  • Related issue exists and is referred to in the PR description and CHANGES.md
  • Added docstrings and API docs for any new/modified user-facing classes and functions
  • Changes/features documented in docs/*
  • Unit-tests adapted/added for changes/features
  • Test coverage remains or increases (target 100%)

@codecov

codecov Bot commented Nov 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@forman forman changed the title Prevent Cuiman app requests from bypassing the authenticated API proxy. Prevent Cuiman app requests from bypassing the authenticated API proxy Nov 12, 2026
@Hneuschmidt

Copy link
Copy Markdown

In our case confusing CORS errors appeared when the landing page (Path /) and conformance (Path /conformance) returned a 404 response.

@forman
forman marked this pull request as ready for review November 13, 2026 09:10
@forman
forman removed the request for review from clarasb November 13, 2026 09:10
@forman forman self-assigned this Nov 13, 2026
@forman
forman requested a review from Hneuschmidt November 13, 2026 09:50

@Hneuschmidt Hneuschmidt left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fine! I have tested the changes with the Calvalus OGC-API processes service which triggered investigation of this issue with the landing page disabled. The changes fix app startup and emit a warning as intended.

Before (v0.4.0)

cuiman_calvalus_before

After (b59de38)

cuiman_calvalus_after

With the warning:

[...]/eozilla/cuiman/src/cuiman/app/launch.py:232: UserWarning: The service landing page returned HTTP 404. OGC API - Processes requires a landing page, but process discovery works. Continuing without service metadata; service conformance is unknown.
  return await self._proxy_request(request, path)

@Hneuschmidt

Copy link
Copy Markdown

The warning message also shows in the UI:

cuiman_calvalus_message

@freds-dev freds-dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

@forman
forman merged commit b67ee17 into main Nov 19, 2026
1 check passed
@forman
forman deleted the forman/258-cuiman_proxy_safeguards_and_diagnostics branch November 19, 2026 13:38
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.

4 participants