Fix shell driver DriverOpts cross-contamination in secret creation

When creating a secret with driver=shell via the API, the file driver's
default DriverOpts (including path) were applied because DriverOpts was
empty. The shell driver rejects path as an unknown option, making it
impossible to create shell-driver secrets via the REST API or
podman-remote.

Only apply default DriverOpts from config when the requested driver
matches the configured default driver.

Signed-off-by: Joe Doss <joe@solidadmin.com>
(cherry picked from commit 667f55c2ce)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Joe Doss 2026-03-30 00:51:38 -05:00 committed by Paul Holzinger
parent 7250b06e25
commit e9fe245626
No known key found for this signature in database
GPG key ID: EB145DD938A3CAF2

View file

@ -33,7 +33,7 @@ func (ic *ContainerEngine) SecretCreate(_ context.Context, name string, reader i
if options.Driver == "" {
options.Driver = cfg.Secrets.Driver
}
if len(options.DriverOpts) == 0 {
if len(options.DriverOpts) == 0 && options.Driver == cfg.Secrets.Driver {
options.DriverOpts = cfg.Secrets.Opts
}
if options.DriverOpts == nil {