Skip to content

Setup and enable_previews cannot see a rival trust policy another node writes during their final check #3961

Open

Description

@dawsontoth

harper deploy setup (GitHub Actions) and enable_previews both check for a rival trust policy before they write their own: an enabled policy that can match the same runs but gives them a different user or operations (policiesOverlap and sameAuthority in security/ciIdentity.ts). Setup lists the policies again just before it writes (bin/deploySetupGithubActions.ts), and enable rechecks inside its per-node lock (components/previewOperations.ts).

Neither check can see a rival that another node writes in the window between that recheck and the write, because trust policies are replicated system-table rows and no lock spans nodes. In that case setup or enable reports success, and the exchange then refuses every run the two policies share. It fails closed: no token is spent and no authority is granted. list_oidc_trust names the pair in invalid_reason, and dropping one policy lets the same runs exchange again.

This is the residual window security/DESIGN.md already records ("a writer on another node in that window is not excluded"), now with the exchange-time refusal from #3811 as the guarantee behind it. It needs no fix unless setup and enable should also warn after the write, for example by rereading the listing once replication settles and reporting a pair the exchange would refuse.

Found during cross-model review of #3811.

Review-Deferral: 737c2735e1ed9b58 severity=nit category=concurrency

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

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    P3

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions