Skip to content

feat(ocm): serve CSP-scoped webapp launcher page - #5906

Merged
glpatcern merged 7 commits into
ocm-token-client-id-claimfrom
served-webapp-launcher
Nov 5, 2026
Merged

glpatcern merged 7 commits into
ocm-token-client-id-claimfrom
served-webapp-launcher

Conversation

@MahdiBaghbani

@MahdiBaghbani MahdiBaghbani commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

This PR is part of the cs3org/OCM-STA#20 and cs3org/OCM-STA#48

Summary

  • Add POST /sciencemesh/webapp-launch, a protected route that runs the same buildLaunch as /open-in-app and returns a page that posts access_token straight to the validated app URL. Nothing is stored and no unprotected route is added.
  • Scope the page's CSP to that one app: form-action is the exact app origin and the submit script runs on a fresh nonce, with no-store, no-referrer and nosniff. Internationalized hosts use their ASCII form, and a host CSP can't name is refused with 400 before any exchange. Error pages carry fixed text and form-action 'none'.
  • Read access_token from form-encoded POST bodies in the credential bearer strategy (RFC 6750 section 2.2), which closes the old TODO. expired_session_redirect_uri is forwarded only when it points at https://<provider_domain>.
flowchart TD
    SPA["SPA form POST /sciencemesh/webapp-launch"] --> A{"auth: access-token or access_token"}
    A -->|"missing or invalid"| U["401"]
    A -->|"ok"| B["buildLaunch: same offer and path checks as /open-in-app"]
    B -->|"fails"| ERR["error page: fixed text, form-action 'none'"]
    B -->|"ok"| H{"app host fits an exact CSP host source?"}
    H -->|"no, 400"| ERR
    H -->|"yes, ASCII form"| X["discovery and token exchange"]
    X -->|"fails"| ERR
    X -->|"ok"| R{"expired_session_redirect_uri on https://provider_domain?"}
    R -->|"no"| DROP["field dropped"]
    R -->|"yes"| KEEP["field forwarded"]
    DROP --> P["auto-submit page: form-action = app origin, nonce script"]
    KEEP --> P
    P --> APP["POST access_token to the app URL"]
Loading

The part you might ask about is why reva serves a page. If the SPA posted the token itself, its CSP would need every federated app origin in form-action; this page names only the app of this launch.

Config note: the web OIDC token authenticates through the bearer credential strategy, which is in reva's default credential_chain. bearer in token_strategy_chain (default ["header"]) is only needed for clients that send a Reva token. The reverse proxy must not add its own CSP on this path.

glpatcern
glpatcern previously approved these changes Oct 22, 2026
@glpatcern
glpatcern force-pushed the served-webapp-launcher branch from 1239088 to 74e6ba2 Compare November 5, 2026 08:08
@glpatcern
glpatcern self-requested a review November 5, 2026 09:43
@glpatcern
glpatcern merged commit d0d6b72 into master Nov 5, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature OCM Open Cloud Mesh

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants