Skip to content

fix(events): validate service names before subscribing to events - #14076

Merged
ndeloof merged 1 commit into
docker:mainfrom
glours:fix/events-validate-service-names
Aug 18, 2026
Merged

fix(events): validate service names before subscribing to events#14076
ndeloof merged 1 commit into
docker:mainfrom
glours:fix/events-validate-service-names

Conversation

@glours

@glours glours commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

What I did
docker compose events <name> was passing service arguments straight to the event filter without checking they exist in the project, so a typo would produce an event stream matching nothing and block forever with no output and no error.

Switch to projectOrName (which validates args via ToProject) before calling backend.Events, consistent with logs, kill, and restart.

Related issue
JIRA DDB-637

(not mandatory) A picture of a cute animal, if possible in relation to what you did
image

@glours
glours requested review from a team as code owners August 17, 2026 12:38
@glours
glours requested a review from ndeloof August 17, 2026 12:38
@glours glours self-assigned this Aug 17, 2026

@docker-agent docker-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assessment: 🟡 NEEDS ATTENTION

One medium-severity finding was identified in the new E2E test.

Dismissed finding (pre-existing, not introduced by this PR)

  • cmd/compose/events.go:60 — Validation bypass when --project-name is set without -f: both the old toProjectName and new projectOrName skip ToProject in this case, so this is pre-existing behaviour unchanged by the PR.

Comment thread pkg/e2e/events_test.go Outdated
@glours
glours force-pushed the fix/events-validate-service-names branch from 94b738d to e247390 Compare August 17, 2026 12:46
docker compose events <name> was passing service arguments straight to
the event filter without checking they exist in the project, so a typo
would produce an event stream matching nothing and block forever with
no output and no error.

Switch to projectOrName (which validates args via ToProject) before
calling backend.Events, consistent with logs, kill, and restart.

Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
@glours
glours force-pushed the fix/events-validate-service-names branch from e247390 to 0acaa66 Compare August 17, 2026 13:09
@maxproske

Copy link
Copy Markdown
Contributor

Verified it validates the service now :)

$ ./bin/build/docker-compose events typo
# no such service: typo

@ndeloof
ndeloof merged commit 81bb4af into docker:main Aug 18, 2026
87 of 88 checks passed
@ndeloof
ndeloof deleted the fix/events-validate-service-names branch August 18, 2026 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants