#11402·windmill

feature: versioned external file-action bridge for Raw Apps

Author: hoangngocquyenCreated Sep 29, 2026Updated Sep 29, 2026

Feature Description

Please add a documented, versioned external file-action bridge for full-code Raw Apps.

A Raw App can receive a pre-authorized, opaque URL from its own backend, but browser navigation initiated inside the nested Raw App bundle can be blocked before the external service receives any request. A native platform bridge would allow a user click in the bundle to ask the trusted Raw App host to launch a narrowly authorized file action.

This should not be a generic arbitrary-URL popup API.

Motivation

Some Raw Apps need to present protected files from a separate service. That service already owns authorization, expiry, replay prevention, byte streaming, MIME, and Content-Disposition. The remaining browser problem is only the nested browsing-context boundary.

Today applications are tempted to use _blank, _top, window.open, or private postMessage details. None is a stable product contract, and an arbitrary external-navigation bridge would create a phishing/popup primitive.

Proposed Solution

Expose an opt-in Raw App runtime API, conceptually similar to:

typescript
type ExternalFileAction = {
  id: string
  href: string
  kind: 'open' | 'download'
  expiresAt?: string
}

window.ctx.externalActions.register(actions)
window.ctx.externalActions.launch(id)

Design requirements:

  1. Pre-registration: the app receives and registers an action before the user clicks. The click path does not resolve a URL or perform a network round trip.
  2. Trusted host: the parent validates the source bundle, protocol version, schema, local registry membership, expiry, and an operator-controlled destination policy.
  3. No arbitrary URLs: the policy should be controlled by an instance operator, with exact HTTPS origin and narrow path grammar. The Raw App author must not turn the host into a generic navigation/popup oracle.
  4. User activation: launch(id) is called directly from the click handler. The parent must synchronously check navigator.userActivation.isActive and immediately launch once, without await, fetch, dialog, or a retry loop. The server response remains authoritative for inline display vs attachment download.
  5. No proxying: Windmill does not fetch, stream, cache, scan, or authenticate to the external service. It performs only browser navigation. The external service remains the final authority for actor binding, TTL, one-use/replay protection, and file delivery.
  6. Opt-in / rollback: default behavior remains unchanged. Disabling the feature policy returns to current Raw App behavior without changing the external service.

Why a platform API is needed

Windmill already has internal parent/iframe messaging for Raw App execution and for some app navigation paths, but there is no documented Raw App API for a protected external-file action. Depending on internal message names would be unstable and would bypass a product-level trust policy.

Acceptance Criteria

  • Raw App bridge accepts messages only from its mounted bundle context and rejects malformed/unknown/expired/replayed action ids.
  • URL policy rejects non-HTTPS, untrusted origins, userinfo, traversal, and non-conforming paths.
  • One click produces at most one launch; no launch happens without transient user activation.
  • The bridge does not fetch the target URL or expose external-service credentials.
  • Browser E2E covers sandboxed and unsandboxed Raw Apps, in-workspace and public viewers, inline and attachment responses, and validation-failure cases.
  • Documentation states the security model, browser activation constraint, API versioning, operator configuration, and rollback behavior.

Alternatives Considered

  • Native anchors / _top / popup JavaScript: not a stable cross-context contract.
  • A private postMessage relay: couples application code to implementation details and lacks an allowlist/capability policy.
  • Base64/data URLs: inappropriate for protected streamed files and changes the file-security/data-flow model.
  • Making Windmill proxy file bytes: adds unnecessary storage/network/credential authority to the platform.

Would maintainers consider this a suitable scoped feature, and what operator-policy/configuration model would fit Windmill's security model?