Skip to content

A renamed list element's secret is overwritten when a new element reuses its old name #38241

Open

Description

@Khairajani

Problem

  • A list element with a secret, such as an MCP server's apiKey, stores its secret under an id built from the element's name.
  • When the element is renamed while its key is masked, the save keeps the existing secret: reference, which still points at the old name's id.
  • A new element added later under the old name writes its secret to that same id, so the renamed element now reads the new key.
  • Present since Mask secrets nested in collections, and validate outbound URLs, query source and attachment access #33477 on main and 2.1. Requires an external secrets manager.

Steps

  1. Create an MCP service with a server alpha and an API key.
  2. Rename alpha to beta without changing the key.
  3. Add a new server alpha with a different key.
  4. beta now reads the new alpha key.

Proposed fix

  • Decide whether a secret id may be overwritten from the references in the stored service and the incoming request, not from what the vault holds.
  • Write a new value to an id only when no other element of the saved or incoming config still references it; otherwise give the element a fresh id.
  • Cover rename back after a key change, swapping names then editing one key, and deleting a list element keyed by position.

Notes

Activity

  1. iamkiayun commented on Nov 23, 2026

    @iamkiayun
    Contributor

    Hi @Khairajani — I'd like to help take this on if you aren't already working on the redesigned fix locally.

    I read through the proposed approach here (deciding overwrite eligibility from the references in the stored service and incoming request rather than vault state, plus the edge cases from #38235). Let me know if it's open to pick up and I'll follow up with a PR and tests.

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

    Type

    No type

    Projects

    • Status
      No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions