fix: change default secret type for delete command from personal to shared#149
fix: change default secret type for delete command from personal to shared#149devin-ai-integration[bot] wants to merge 2 commits intomainfrom
Conversation
…hared The delete command defaulted type to 'personal', causing 404 errors when deleting shared secrets (which is the most common type). The set command already defaults to 'shared' via util.SECRET_TYPE_SHARED. This aligns the delete command with the same default behavior. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Greptile SummaryChanges the default
Confidence Score: 4/5
Important Files Changed
Last reviewed commit: e110fde |
packages/cmd/secrets.go
Outdated
| util.AddOutputFlagsToCmd(secretsSetCmd, "The output to format the secrets in.") | ||
|
|
||
| secretsDeleteCmd.Flags().String("type", "personal", "the type of secret to delete: personal or shared (default: personal)") | ||
| secretsDeleteCmd.Flags().String("type", util.SECRET_TYPE_SHARED, "the type of secret to delete: personal or shared (default: shared)") |
There was a problem hiding this comment.
Redundant default hint in help text
Cobra automatically appends the default value to help output for string flags (e.g., (default "shared")). The manually written (default: shared) in the description is redundant and uses a slightly different format. The secretsSetCmd on line 836 does not include a manual default hint, so removing it here would improve consistency.
| secretsDeleteCmd.Flags().String("type", util.SECRET_TYPE_SHARED, "the type of secret to delete: personal or shared (default: shared)") | |
| secretsDeleteCmd.Flags().String("type", util.SECRET_TYPE_SHARED, "the type of secret to delete: personal or shared") |
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Summary
Changes the default value of the
--typeflag oninfisical secrets deletefrom"personal"to"shared"(viautil.SECRET_TYPE_SHARED).Bug: Running
infisical secrets delete SECRET_NAMEwithout an explicit--typeflag would sendtype: "personal"in the request body. The backend then filters for a personal secret owned by the current user — which doesn't match shared secrets (the most common type). This causes a 404 "Secret not found" even though the secret exists andinfisical secrets get SECRET_NAMEfinds it.Root cause: The
getsubcommand uses the LIST endpoint (withinclude_imports=true) and filters client-side, so it finds secrets regardless of type. Thedeletesubcommand hits the single-secret DELETE endpoint, where thetypefield directly controls the DB query filter. Defaulting to"personal"meant shared secrets could never be deleted without explicitly passing--type shared.Consistency: The
setsubcommand already defaults toutil.SECRET_TYPE_SHARED. This change alignsdeletewith that convention.Review & Testing Checklist for Human
infisical secrets delete Xto delete personal secrets without passing--type personalwill now delete the shared secret instead. Confirm this is the desired behavior.infisical secrets set FOO=bar, then delete it withinfisical secrets delete FOO(no--typeflag). Confirm it succeeds instead of returning 404.infisical secrets delete FOO --type personalstill correctly deletes personal secrets.Notes
(default: shared).Link to Devin session: https://app.devin.ai/sessions/3bd5289d5891499aaf5c27f2d74ede57