Skip to content

wrangler: fix: support the deletion of secrets with complex names - #10668

Merged
petebacondarwin merged 1 commit into
cloudflare:mainfrom
danielrs:drivas/wrangler-secret-names-url-encoded
Sep 25, 2025
Merged

petebacondarwin merged 1 commit into
cloudflare:mainfrom
danielrs:drivas/wrangler-secret-names-url-encoded

Conversation

@danielrs

@danielrs danielrs commented Sep 16, 2025 •

Copy link
Copy Markdown
Contributor

URL encode the secret names before being sent to the API, should allow users to delete secrets with complex names. Change is still compatible with older Wrangler versions thanks to the optional query param flag url_encoded.

Tracking internally: https://jira.cfdata.org/browse/WC-3991

Describe your change...

URL encode all secret names in the DELETE .../secrets/:secret call, should allow the deletion of secrets with complex names.



Docs have new query param url_encoded:
https://developers.cloudflare.com/api/resources/workers/subresources/scripts/subresources/secrets/methods/delete/
image

@danielrs
danielrs requested a review from a team as a code owner September 16, 2025 05:46
@changeset-bot

changeset-bot Bot commented Sep 16, 2025 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 22f2347

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
wrangler Patch
@cloudflare/vite-plugin Patch
@cloudflare/vitest-pool-workers Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Sep 16, 2025 •

Copy link
Copy Markdown
create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@10668

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@10668

miniflare

npm i https://pkg.pr.new/miniflare@10668

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@10668

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@10668

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@10668

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@10668

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@10668

wrangler

npm i https://pkg.pr.new/wrangler@10668

commit: ca2e23d

@danielrs
danielrs force-pushed the drivas/wrangler-secret-names-url-encoded branch from e59d663 to 243f9ab Compare September 16, 2025 06:33
@for-the-kidz

Copy link
Copy Markdown
Contributor

should we do this for the other 3 secret endpoints as well?

@danielrs

danielrs commented Sep 16, 2025 •

Copy link
Copy Markdown
Contributor Author
  • Merge only after testing against API.

@danielrs

Copy link
Copy Markdown
Contributor Author

should we do this for the other 3 secret endpoints as well?

Wrangler does not do GET .../secrets/<secret>. We also don't support secret manipulation on Workers for Platforms scripts from Wrangler.

@danielrs
danielrs force-pushed the drivas/wrangler-secret-names-url-encoded branch from 243f9ab to 29b912e Compare September 17, 2025 20:33

@dario-piotrowicz dario-piotrowicz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 🙂 (with a couple of small suggestions)

Comment thread packages/wrangler/src/__tests__/secret.test.ts Outdated
Comment thread .changeset/warm-clowns-visit.md Outdated
Comment thread .changeset/warm-clowns-visit.md Outdated
@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Sep 19, 2025
@danielrs
danielrs force-pushed the drivas/wrangler-secret-names-url-encoded branch from 1ddccc9 to ca2e23d Compare September 19, 2025 20:43
URL encode the secret names before being sent to the API, should allow
users to delete secrets with complex names. Change is still compatible
with older Wrangler versions thanks to the optional query param flag
`url_encoded`.
@petebacondarwin
petebacondarwin force-pushed the drivas/wrangler-secret-names-url-encoded branch from ca2e23d to 22f2347 Compare September 25, 2025 13:56
@petebacondarwin

Copy link
Copy Markdown
Contributor

Interestingly the wrangler versions secret delete command already works with these complex keys...

@petebacondarwin

Copy link
Copy Markdown
Contributor

Since this is a patch (bug-fix) then it should indeed be backported to V3.

@petebacondarwin

Copy link
Copy Markdown
Contributor

The reason why the CI job to autocreate that backport failed is because this PR is from a fork.

@petebacondarwin
petebacondarwin merged commit a57149f into cloudflare:main Sep 25, 2025
37 of 41 checks passed
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Sep 25, 2025
@danielrs
danielrs deleted the drivas/wrangler-secret-names-url-encoded branch September 25, 2025 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants