Skip to content

Commit 626d845

Browse files
committed
fix(secrets): let server visibility outrank the carried rename
The carried value won over the server map, so a rename-back (or a rename onto an existing key) left an entry shadowing a key that still has a credential: a later confirmed convert-to-secret would apply server-side while the row stayed under Workspace variables and kept rendering unmasked until refresh. Server state now wins wherever it exists and the carried value only fills the gap where it doesn't, which is all it was ever for. A stale entry is inert under that ordering rather than needing to be cleared on every path that could invalidate it.
1 parent 2e771db commit 626d845

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

  • apps/sim/app/workspace/[workspaceId]/settings/components/secrets/components/secrets-manager

apps/sim/app/workspace/[workspaceId]/settings/components/secrets/components/secrets-manager/secrets-manager.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -904,11 +904,17 @@ export function SecretsManager() {
904904
return entries.map(([key, value]) => ({
905905
key,
906906
value,
907-
// A pending rename is checked FIRST: the new name has no server-side
908-
// visibility yet, so falling straight through to `visibilityMap` would
909-
// default it to `secret` — bouncing the row into Workspace secrets and
910-
// bullet-masking a value the member can plainly read, until save lands.
911-
visibility: renamedKeyVisibility[key] ?? visibilityMap[key] ?? ('secret' as EnvVisibility),
907+
// Server state wins wherever it exists; the carried rename only fills the
908+
// gap where it doesn't. That ordering is the whole contract: a renamed key
909+
// has no server visibility yet, so without the fallback it would default
910+
// to `secret` and bounce into Workspace secrets, bullet-masking a value
911+
// the member can plainly read. But letting the carried value WIN would
912+
// shadow the server after a rename-back or a rename onto an existing key,
913+
// so a later confirmed convert-to-secret would apply server-side and the
914+
// row would still render as non-secret. Under this ordering a stale entry
915+
// is inert, rather than needing to be cleared on every path that could
916+
// invalidate it.
917+
visibility: visibilityMap[key] ?? renamedKeyVisibility[key] ?? ('secret' as EnvVisibility),
912918
}))
913919
}, [
914920
searchTerm,

0 commit comments

Comments
 (0)