feat: automatically update references when secrets are moved or updated#5344
feat: automatically update references when secrets are moved or updated#5344
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Greptile OverviewGreptile SummaryThis PR implements automatic secret reference updates when secrets are renamed or moved between folders/environments. The implementation handles both local references ( Key changes:
Issues found:
Confidence Score: 3/5
Important Files Changed
|
backend/src/services/secret-v2-bridge/secret-v2-bridge-service.ts
Outdated
Show resolved
Hide resolved
Additional Comments (1)
|
|
Github actions are down. Will re-run tests once it's back up https://www.githubstatus.com/ |
Context
When a secret is renamed or moved, all secrets that reference it are now automatically updated to maintain valid references. Renaming a secret key updates all secrets that reference it in the same folder from
${OLD_KEY}to${NEW_KEY}.Moving a secret to a different folder/environment converts local references (
${KEY}) to nested references (${env.path.KEY}) and vice versa. Works with approval workflows as well, references are updated when the rename/move request is merged. To properly support secret moves with approval workflows, I've added a new concept called "internal metadata" on the secret change requests, which keeps track of the source destination secret when a secret is moved. This is needed in order to know which secrets references to update once the request is approved.When a secret reference is updated, secret syncs are triggered in the respective environments of where the secrets were updated. When a secret that references an updated secret is updated, a new commit is created for each of the secrets that have changed.
Type
Checklist
type(scope): short description(scope is optional, e.g.,fix: prevent crash on syncorfix(api): handle null response).