Skip to content

feat(router): add TLS support for NATS event source (skip verify, custom CA, mTLS) #2582

@vatsalpatel

Description

@vatsalpatel

Component(s)

router

Is your feature request related to a problem? Please describe.

The NATS event source (events.providers.nats) has no TLS support. The NatsEventSource config struct only has id, url, and authentication fields — there is no tls block. This means all NATS connections are plaintext, making it impossible to use NATS in environments that require encrypted transport (e.g., compliance requirements, production infrastructure with TLS-only brokers).

Describe the solution you'd like

Add a tls block to the NATS event source config supporting all standard TLS modes:

Mode Config
No TLS omit tls block
TLS + skip verify (self-signed/dev) insecure_skip_verify: true
TLS + custom CA (1-way TLS) ca_file: /path/to/ca.crt
mTLS (mutual TLS) ca_file + cert_file + key_file

Example config:

events:
  providers:
    nats:
      - id: my-nats
        url: nats://localhost:4222
        tls:
          ca_file: /path/to/ca.crt
          cert_file: /path/to/client.crt
          key_file: /path/to/client.key

Implementation requires:

  1. New NatsTLSConfiguration struct in config.go
  2. TLS *NatsTLSConfiguration field on NatsEventSource
  3. TLS option building in buildNatsOptions using nats.Secure(tlsCfg)
  4. Update config.schema.json and testdata/config_full.json golden fixture

Describe alternatives you've considered

Adding the NATS server's CA to the host OS system cert pool. This is operationally impractical in containerized/ephemeral environments.

Additional context

The Kafka event source already has a (minimal) tls.enabled flag. This proposal brings NATS to full parity and beyond, covering all 4 standard TLS modes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions