Repository navigation
Commit dfa2b83
fix(httpapi): percent-decode the secret name on DELETE /secrets/{name} (#1775)
## Problem
Secret names aren't restricted. The reference parser accepts anything
but `}` after the type, so `${keyring:openai:prod}` is a valid reference
and `POST /api/v1/secrets` stores it as-is. The Web UI deletes with
`/api/v1/secrets/${encodeURIComponent(name)}`, which sends
`openai%3Aprod`. chi routes on `RawPath`, so `chi.URLParam(r, "name")`
returns the encoded value and `handleDeleteSecret` asks the keyring to
delete `openai%3Aprod`, an entry that doesn't exist. The real secret
stays in the keyring.
## Fix
Decode `{name}` with the existing `decodePathParam`, matching the other
path-param handlers.
## Test
`TestDeleteSecret_DecodesNameParam` registers a recording keyring
provider and sends `DELETE /api/v1/secrets/openai%3Aprod`. On main the
provider receives `openai%3Aprod`; with this change it receives
`openai:prod`. `go test -count=1 ./internal/httpapi/` passes.
Made with [Cursor](https://cursor.com)
---------
Co-authored-by: Algis Dumbris <a.dumbris@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>1 parent 5a8d9d9 commit dfa2b83
2 files changed
Lines changed: 88 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5063 | 5063 | | |
5064 | 5064 | | |
5065 | 5065 | | |
| 5066 | + | |
| 5067 | + | |
| 5068 | + | |
| 5069 | + | |
5066 | 5070 | | |
| 5071 | + | |
| 5072 | + | |
| 5073 | + | |
5067 | 5074 | | |
5068 | 5075 | | |
5069 | 5076 | | |
| |||
0 commit comments