Skip to content

Pubsub Channel can adopt K8s Service or VirtualService owned by another resource/user #648

@grantr

Description

@grantr

From #618 (comment)

Expected Behavior

K8s Services and VirtualServices owned or created by other actors never conflict with Channel Services.

Actual Behavior

At least in the GCP Pubsub implementation, the Channel controller adopts a Service with the expected name even if that Service is not owned by the Channel (it logs a warning if this happens). The adopted Service is set as the address of the Channel.

The effect is that all messages sent to that Channel will be rejected or lost, and the actual owner of the Channel will start receiving invalid requests. Depending on relative throughput and upstream retry policies, this might cause a DoS of the Service endpoints.

The VirtualService has a similar but worse problem in that it's spec is updated to be what the Channel controller expects. So in addition to the above, the routing configuration of the owning endpoints will be altered.

Steps to Reproduce the Problem

I haven't tried this, but I imagine the repro is as simple as:

  1. Create a Knative Service named foo-channel.
  2. Create a Channel named foo in the same namespace as the Knative Service.
  3. Send a message to that Channel. The Knative Service will receive that message instead of the channel dispatcher.

Additional Info

Possible solutions include using generated names for Channel-owned objects (this may not be possible according to @Harwayne) or giving the Channel a terminal error state when encountering a resource that isn't owned by the Channel.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions