podman icon indicating copy to clipboard operation
podman copied to clipboard

podman events --filter secret=... fails with "SECRET is an invalid filter"

Open HindzStark opened this issue 3 months ago • 0 comments

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 in libpod/events/config.go.
  • Secret operations record events in libpod/events.go.
  • --filter type=secret works, but filtering by specific secret attributes via --filter secret=... fails because generateEventFilter in libpod/events/filters.go lacks a case "SECRET": handler, and shell autocompletion in cmd/podman/common/completion.go lacks "secret=" mapping.

Steps to reproduce the issue

  1. Create a dummy secret: $ podman secret create mysecret - <<< "supersecretdata"
  2. Try to stream events filtered by secret name: $ podman events --filter secret=mysecret
  3. 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: Defines Secret Type = "secret".
  • libpod/events/filters.go: generateEventFilter() handles CONTAINER, IMAGE, ARTIFACT, POD, VOLUME, NETWORK, TYPE, LABEL, but is missing case "SECRET":.
  • cmd/podman/common/completion.go: keyValueCompletion handles container=, image=, artifact=, network=, pod=, volume=, but is missing secret=. Note that getSecrets() is already implemented at completion.go:290.

HindzStark avatar Aug 11 '26 19:08 HindzStark