podman events --filter secret=... fails with "SECRET is an invalid filter"
Issue Description
Secret is a first-class event type in Podman. When secrets are created or removed (podman secret create / podman secret rm), secret events are emitted and logged to the Podman event backend with e.Type = events.Secret.
However, attempting to filter the event stream by secret name or ID using podman events --filter secret=<name> returns an error: Error: SECRET is an invalid filter.
Upon checking the codebase:
events.Secret("secret") is explicitly defined inlibpod/events/config.go.- Secret operations record events in
libpod/events.go. --filter type=secretworks, but filtering by specific secret attributes via--filter secret=...fails becausegenerateEventFilterinlibpod/events/filters.golacks acase "SECRET":handler, and shell autocompletion incmd/podman/common/completion.golacks"secret="mapping.
Steps to reproduce the issue
- Create a dummy secret: $ podman secret create mysecret - <<< "supersecretdata"
- Try to stream events filtered by secret name: $ podman events --filter secret=mysecret
- Observe the command failure.
Describe the results you received
Error: SECRET is an invalid filter
Describe the results you expected
podman events --filter secret=mysecret should filter and display events matching mysecret by name or ID prefix without throwing an invalid filter error, consistent with --filter container=..., --filter image=..., --filter pod=..., --filter volume=..., and --filter network=....
podman info output
host:
arch: amd64
buildDaemon: true
cgroupControllers:
- cpu
- io
- memory
- pids
cgroupManager: systemd
cgroupVersion: v2
conmon:
package: conmon-2.1.10-1.fc40.x86_64
path: /usr/bin/conmon
version: 'conmon version 2.1.10, commit: '
cpus: 8
distribution:
distribution: ubuntu
version: "24.04"
ociRuntime:
name: crun
package: crun-1.14.4-1.fc40.x86_64
path: /usr/bin/crun
version: crun version 1.14.4
os: linux
store:
configFile: /home/user/.config/containers/storage.conf
containerStore:
number: 0
graphDriverName: overlay
graphOptions: {}
graphRoot: /home/user/.local/share/containers/storage
graphStatus:
Backing Filesystem: extfs
Native Overlay Diff: "true"
Supports d_type: "true"
Using metacopy: "false"
imageCopyTmpDir: /tmp
imageStore:
number: 0
runRoot: /run/user/1000/containers
volumeStore:
number: 0
version:
APIVersion: 5.0.0
Built: 0
BuiltTime: Thu Jan 1 00:00:00 1970
GitCommit: ""
GoVersion: go1.22.2
Os: linux
OsArch: linux/amd64
Version: 5.1.0-dev
Podman in a container
No
Privileged Or Rootless
Rootless
Upstream Latest Release
Yes
Additional environment details
Reproduced on Linux / WSL2 Ubuntu 24.04 environment running upstream development build of Podman.
Additional information
Code references:
libpod/events/config.go: DefinesSecret Type = "secret".libpod/events/filters.go:generateEventFilter()handlesCONTAINER,IMAGE,ARTIFACT,POD,VOLUME,NETWORK,TYPE,LABEL, but is missingcase "SECRET":.cmd/podman/common/completion.go:keyValueCompletionhandlescontainer=,image=,artifact=,network=,pod=,volume=, but is missingsecret=. Note thatgetSecrets()is already implemented atcompletion.go:290.