Skip to content

Labels are not enforced on InstanceStart/InstanceStop operations #857

@mzyy94

Description

@mzyy94

Describe the bug
sablier.enable=true labels are checked during discovery (InstanceList, InstanceGroups), but the operational methods — InstanceStart, InstanceStop, and NotifyInstanceStopped — do not validate whether the target instance has the management label.

Was this the intended behavior when the label system was introduced in #134 ? It seems like the label was meant to define which instances Sablier manages, but the enforcement is only partial — discovery respects it, while operations do not.

This means:

  1. Any container can be started/stopped by name through the Sablier API, even if it was never intended to be managed by Sablier
  2. Session expiry stops unlabeled containersOnInstanceExpired calls InstanceStop without any label check, so a container started via Sablier API (even without the label) will be stopped when the session expires.
  3. NotifyInstanceStopped watches all containers — Docker/Podman listen to all die events, Kubernetes informers watch all deployments/statefulsets, regardless of labels.

Context

  • Sablier version: <= 1.11.2
  • Provider: all
  • Reverse proxy: N/A
  • Sablier running inside a container? No

Expected behavior

  • InstanceStart / InstanceStop should return an error when the target instance does not have the management label.
  • NotifyInstanceStopped should only report events for managed (labeled) instances.
  • Session expiry should gracefully handle the case where a container is not managed.

Additional context

  • I ran into a case with Caddy wildcard setup where an unlabeled container that was already running got stopped when a session expired. It wasn't meant to be managed by Sablier at all.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions