Skip to content

feat(plugins): resolve per-request pipelines #487

Closed

Description

@uniqueg

Problem

Clients must be able to choose the plugin pipeline per task from the
available plugins (maintainer requirement R7), and (Krini) to restrict
or order the backends their task may go to, without breaking GA4GH
compliance or letting clients reach plugins or backends the operator
did not allow.

Proposal

foca.plugins.selection, called by host.start(..., tags=...) before
any plugin runs:

  1. Reserved client tags: under plugins.tags.prefix (default
    gateway.), clients may set only gateway.pipeline and
    gateway.backends; any other gateway.* key → 400 (problem type
    .../reserved-tag, key in detail; Q21).
  2. gateway.pipeline: a preset name (^[a-z0-9][a-z0-9-]{0,63}$) or
    a JSON pipeline (≤ 8 KiB; schema of the admin pipeline minus
    timeout/on_failure); client_pipelines config: enabled (default
    true, Q6; tag with enabled: false → 400), allowed
    (presets, inline), max_steps, max_alternatives, roles,
    admin frame prepend/append (with if_missing_phase: route).
    Authorization: plugins must be in available, client_selectable,
    allowed for the principal's roles, and support the app's API; unknown,
    non-selectable and non-installed plugins give the same 400
    ("plugin not available: X"). Params validated against the plugin's
    Params (extra=forbid).
  3. gateway.backends (Krini report 1): JSON string
    {"type": "order"|"allow"|"forbid", "backends": [...]} (≤ 8 KiB,
    1..client_backends.max_items strings, default 32); config
    client_backends.enabled (default true; tag when disabled → 400).
    Parsed at start, applied after the route phase on its output.
    Items match Backend.id or the normalised URL; items that are not
    candidates (unknown, unverified, wrong type, removed by routing, own
    URL) are discarded silently and recorded; no option to disable the
    verified check.
    • order: listed candidates first, in client order, then the
      remaining ones in server order;
    • allow: server order, unlisted discarded untried;
    • forbid: server order, listed discarded untried.
      Nothing left → NoBackendAvailable (503).
  4. The resolved pipeline is available to provenance (P3).

Acceptance criteria

  • Property tests (Hypothesis if available, else table-driven) over
    random client pipelines: never a plugin outside the allowlist, limits
    enforced, uniform error messages.
  • Every branch of 1–3 tested, incl. disabled switches, invalid JSON,
    oversized tags, unknown types, empty results.
  • Docs: configuration of client_pipelines/client_backends; client
    guide (tags, examples, re-run rule: drop server-written gateway.*
    keys).
  • 100% coverage, mypy, ruff, mkdocs build --strict.

Surviving the Connexion 3 migration

Pure data in, data out: tags (a string map), Principal, config. No
request object involved; nothing to change in rc1.

Dependencies

Open questions

  • type: order: append unlisted candidates after the listed ones
    (chosen, matches "client order overrules server order" without
    narrowing) or discard them (then order = allow with client order)?

Added during pre-review: client pipelines replace plugins.pipeline (policies belong in prepend, documented with a warning); empty client pipelines stay allowed; tags that are not a mapping give 400 (reserved-tag); start() requires tags= for APIs other than TES; presets enforce plugin roles but not client_selectable; client_pipelines.allowed needs at least one value; the gateway.backends tag is capped at 8 KiB before parsing and needs at least one backend; client pipelines must be I-JSON (no NaN/Infinity, integers within ±(2^53−1)); preset step IDs must not clash with prepend/append.

Activity

  1. added this to the v0.18.0 milestone on Oct 24, 2026
  2. added
    priority: high
    status: blocked
    type: feature
    type: security
    workload: days
    on Oct 24, 2026
  3. added
    status: in progress
    and removed
    status: blocked
    on Oct 25, 2026
  4. removed
    status: in progress
    on Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: hightype: featuretype: securityworkload: days

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions