Skip to content

fix(secrets): default secrets delete --type to shared to match secrets set - #375

Open
rmdly wants to merge 1 commit into
Infisical:mainfrom
rmdly:fix/secrets-delete-type-default
Open

fix(secrets): default secrets delete --type to shared to match secrets set#375
rmdly wants to merge 1 commit into
Infisical:mainfrom
rmdly:fix/secrets-delete-type-default

Conversation

@rmdly

@rmdly rmdly commented Aug 26, 2026

Copy link
Copy Markdown

Fixes Infisical/infisical#7805

secrets set creates a shared secret by default, but secrets delete looked for a personal one by default, so deleting a secret you had just created failed with a 404:

infisical secrets set TEST=x --env dev     # creates a shared secret
infisical secrets delete TEST --env dev    # 404 Secret not found
infisical secrets delete TEST --env dev --type shared   # works

The delete flag also hardcoded the string "personal" rather than using util.SECRET_TYPE_PERSONAL, and repeated the default in its usage text, which cobra already prints.

This aligns the two defaults on util.SECRET_TYPE_SHARED. Deleting a personal secret still works with an explicit --type personal.

Worth flagging: this is a behaviour change for anyone scripting secrets delete against personal secrets without passing --type. It seemed like the right call because secrets set already defaults to shared and the personal default on delete is not documented, but happy to switch to one of the other options in the issue if you would rather not change the default.

TestSecretsTypeFlagDefaults asserts both commands agree on the default so they cannot drift apart again.

One thing I noticed while adding it: nothing in CI runs ./packages/cmd, and the package will not build under go test because of four pre-existing non-constant format string vet errors in run.go, so the existing unit tests there are not running either. I have left that alone here, but I am happy to open a separate PR fixing those if it would be useful.

@infisical-cla-app

infisical-cla-app Bot commented Aug 26, 2026

Copy link
Copy Markdown

CLA satisfied. All contributors have signed the current CLA. The cla/signed check is passing.

@greptile-apps

greptile-apps Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Aligns secrets delete with secrets set by defaulting both commands to shared secrets.

  • Replaces the hardcoded personal deletion default with util.SECRET_TYPE_SHARED.
  • Removes redundant default wording from the Cobra flag description.
  • Adds a regression test ensuring the set and delete type defaults remain aligned.

Confidence Score: 5/5

The PR appears safe to merge, with the intentionally acknowledged default behavior change covered by a focused regression test.

The changed default flows directly into the existing delete request type, aligns with the set command, and preserves personal deletion through an explicit flag; no unacknowledged blocking or non-blocking defects remain.

Important Files Changed

Filename Overview
packages/cmd/secrets.go Changes the delete type default to the existing shared-secret constant; explicit personal deletion remains available.
packages/cmd/secrets_test.go Adds a focused test verifying that both secret mutation commands register the shared type default.

Reviews (1): Last reviewed commit: "fix(secrets): default secrets delete --t..." | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

infisical secrets delete fails with 404 "Secret not found" for shared secrets because --type defaults to personal

1 participant