Skip to content

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

Closed

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.

Activity

  1. added
    enhancement
    on Mar 4, 2026
  2. github-actions commented on Mar 4, 2026

    @github-actions

    WunderGraph commits fully to Open Source and we want to make sure that we can help you as fast as possible.
    The roadmap is driven by our customers and we have to prioritize issues that are important to them.
    You can influence the priority by becoming a customer. Please contact us here.

  3. vatsalpatel commented on Mar 4, 2026

    @vatsalpatel
    ContributorAuthor

    We're already a WunderGraph customer and have an active need for this feature. I have an implementation in mind and am happy to open a PR — could you assign this to me? Is there anything to align on before I proceed?

  4. added a commit that references this issue on Mar 9, 2026
    06a14c7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions