Skip to content

feat: patch specs and policies via config #396

Closed

Description

@uniqueg

Problem

Operators of FOCA apps can't adapt an app's API specification or access control policies through configuration without forking them in their config:

  • api.specs[].path already merges several spec files in order (later files win), so a small operator file could, e.g., require a token for operations that an app makes public (security: []). But config overlays replace lists, and api.specs and its path are lists: to add one file, an operator must copy the app's whole api.specs entry (all spec paths, controller and Connexion options). When an upgrade adds a spec file or changes an option, the stale copy silently drops it.
  • The same holds for security.access_control.policies: changing or adding one rule means copying the whole list.

Example (cloud-registry): an operator who wants all reads to require login, except GET /service-info, can't do that with an overlay that survives upgrades.

Expected

Generic, composable modding instead of one option per use case:

  1. Spec patches: a per-spec field (e.g., api.specs[].patches), a list of YAML/JSON files (paths relative to the config file declaring them, as for path) or inline objects, deep-merged into the spec last, after path and append and before add_operation_fields/add_security_fields, with the same merge rules as path (dicts merged, other values replaced). Apps leave it empty; operators set it.
  2. Keyed overlays: config overlays can address a spec entry without restating it, e.g., an optional unique name on api.specs[] entries, and overlay list entries with a matching name are merged into that entry instead of replacing the list (like Kubernetes strategic merge by key). Entries without name keep today's behaviour.
  3. Named policies: a way to add, change or remove single access control rules from an overlay (e.g., policies as a mapping from rule name to rule, or named list entries merged by name), keeping today's list form working.
  4. Safety: validation at startup (unknown spec names, patches that make the spec invalid, policies that don't validate fail with a clear error); an INFO log listing which patches and named policies were applied; a warning in the logs when a patch removes security from an operation.
  5. Docs: a section on modding specs and policies with a prominent warning banner (patches can weaken or remove authentication and access control; review them like code), and a recipe: "require login for all reads except /service-info" (spec patch, plus the policies that allow GET for any authenticated user).
  6. Tests for merge order, keyed overlays, named policies, validation errors and the recipe.

Target: FOCA 0.17.0. Follow-up in cloud-registry: default GET policies for any authenticated user and the recipe in its docs (separate issue).

Activity

  1. added
    priority: high
    status: triage
    type: feature
    workload: days
    on Oct 22, 2026
  2. uniqueg commented on Oct 22, 2026

    @uniqueg
    MemberAuthor

    Done in #409.

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: highstatus: triagetype: featureworkload: days

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions