Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport of csi: Fix parsing of '=' in secrets at command line and HTTP into release/1.2.x #15673

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/15670.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
csi: Fixed a bug where secrets that include '=' were incorrectly rejected
```
11 changes: 5 additions & 6 deletions command/agent/csi_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,11 @@ func (s *HTTPServer) csiSnapshotDelete(resp http.ResponseWriter, req *http.Reque
query := req.URL.Query()
snap.PluginID = query.Get("plugin_id")
snap.ID = query.Get("snapshot_id")

secrets := query["secret"]
for _, raw := range secrets {
secret := strings.Split(raw, "=")
if len(secret) == 2 {
snap.Secrets[secret[0]] = secret[1]
if key, value, found := strings.Cut(raw, "="); found {
snap.Secrets[key] = value
}
}

Expand Down Expand Up @@ -340,9 +340,8 @@ func (s *HTTPServer) csiSnapshotList(resp http.ResponseWriter, req *http.Request
secrets := strings.Split(querySecrets[0], ",")
args.Secrets = make(structs.CSISecrets)
for _, raw := range secrets {
secret := strings.Split(raw, "=")
if len(secret) == 2 {
args.Secrets[secret[0]] = secret[1]
if key, value, found := strings.Cut(raw, "="); found {
args.Secrets[key] = value
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions command/volume_snapshot_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,8 @@ func (c *VolumeSnapshotDeleteCommand) Run(args []string) int {

secrets := api.CSISecrets{}
for _, kv := range secretsArgs {
s := strings.Split(kv, "=")
if len(s) == 2 {
secrets[s[0]] = s[1]
if key, value, found := strings.Cut(kv, "="); found {
secrets[key] = value
}
}

Expand Down