Skip to content

Bind Provider creation, update, and delete to exact resource identities #5931

Todo

Description

@stevenlee-oai

Codex report. A controller that owns Provider registration and retirement needs the Gateway to enforce the resource identities the controller authorized. The Gateway can resolve a different resource under the same name between the controller's read and its write. This follows up on inactive issue #2722 and adds the registration and retirement cases.

Reproduction

I used OpenShell Gateway 0.1.10-dev.100+g152c59d31, a disposable SQLite store, and synthetic credentials.

  1. Create a Provider in a Workspace and record its ID and resource version.
  2. As another authorized Workspace administrator, delete it and create a Provider under the same name. The two IDs differ and both initial versions are 1.
  3. Call UpdateProvider with the former Provider's ID, name, and version and a new synthetic credential. The Gateway returns the replacement's ID. An operator credential read confirms that the replacement received the update.
  4. Call DeleteProvider for the same name. The Gateway deletes the replacement. The delete request has no field for the original ID.

Requested behavior

  • On Provider creation, let the caller require the intended Workspace incarnation and profile revision. Refuse before storing material if either precondition fails.
  • On Provider update and delete, let the caller require the intended Provider ID. If a same-name replacement exists, refuse before changing its credential or deleting it. Preserve the existing resource version check for updates to the same Provider.
  • Expose a capability or RPC contract that lets clients require these guarantees before sending a write.

Provider request schema · Provider update implementation · Provider delete implementation

Activity

  1. added
    state:triage-needed
    on Nov 24, 2026
  2. yjjnls commented on Nov 24, 2026

    @yjjnls

    Reproduced on main 152c59d with a focused test: create → delete → recreate the same name → UpdateProvider carrying the original metadata.id and resource_version: 1 succeeds, writes the new credential to the replacement, and returns the replacement's ID.

    Cause: update_provider_record_validating resolves by name and never compares the request's provider.metadata.id (crates/openshell-server/src/grpc/provider.rs:483-491); candidate is the resolved record (provider.rs:532) and the CAS is version-only (provider.rs:616-625), so the version-1 replacement passes the stale write. DeleteProviderRequest has no identity field (proto/openshell.proto:2465-2472); delete resolves by name (provider.rs:705-711), and the guard at provider.rs:744-750 only covers a replacement created after resolution.

    Given the #5794/#5872 response that name reuse is a workspace coordination concern, the narrowest change that does not depend on that: reject a non-empty provider.metadata.id that differs from the resolved object before any credential staging, and add an optional expected ID to delete. Empty stays legacy behavior, so the CLI (id: "", resource_version: 0) is unaffected. For the create side, the profile catalog already computes a revision (crates/openshell-server/src/provider_profile_sources.rs:600-613) that could back a profile-revision precondition.

    Would that narrower form be acceptable upstream, or is name-only semantics intended and worth documenting as such?

  3. FrostGod commented on Nov 24, 2026

    @FrostGod
    Contributor

    thanks for opening this @yjjnls , I'll take a look at this

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

    state:triage-needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions