Skip to content

Security Configuration

Spine uses secure transport and bounded runtime defaults. Call App.Validate in deployment checks; App.Run performs the same network-free preflight automatically.

Defaults

AreaDefaultExplicit development or compatibility option
Kafkaimplicit TLS 1.2+ for each enabled reader/writercustom TLS/Dialer/Transport, or local-only AllowInsecureTransport: true
RabbitMQamqps:// requiredAllowInsecureTransport: true with amqp://
RabbitMQ publishpersistent, mandatory routing, publisher confirms, bounded retrytune PublisherRetry
RabbitMQ handler failurereject without requeueFailurePolicy: boot.RabbitMqFailureRequeue
RabbitMQ prefetchone unacknowledged message per consumerpositive PrefetchCount
Consumer transport failurerebuild reader with exponential backoff and jitterconfigure ConsumerRetry
WebSocket originscheme and host must matchexact AllowedOrigins
WebSocket capacity1024 active and pending connectionspositive limit or UnlimitedWebSocketConnections
WebSocket authenticationimplementations of WebSocketHandshakeInterceptor run after slot reservation and before upgradeimplement handshake auth on every protected WS route; pending unauthenticated handshakes count against capacity
Global interceptorsHTTP and WebSocketInterceptorFor with a narrower scope
Credentialed CORSexplicit origins requirednone; wildcard credentials are invalid
Cookie serializationreject invalid fields before writing a responseEncodeCookieValue for arbitrary values

Validate before opening the network

go
opts := boot.Options{
    Address: ":8080",
    HTTP: &boot.HTTPOptions{
        WebSocket: boot.WebSocketOptions{
            AllowedOrigins:   []string{"https://app.example.com"},
            MaxConnections:   2_000,
            MaxMessageBytes:  1 << 20,
            TrustedProxyCIDRs: []string{"10.0.0.0/8"},
        },
    },
}

if err := app.Validate(opts); err != nil {
    var configErr *boot.ConfigError
    if errors.As(err, &configErr) {
        for _, issue := range configErr.Issues {
            log.Printf("%s [%s]: %s", issue.Path, issue.Code, issue.Hint)
        }
    }
    log.Fatal(err)
}

if err := app.Run(opts); err != nil {
    log.Fatal(err)
}

ConfigIssue.Code is the stable, machine-readable deployment signal. Do not parse Message, and do not include broker credentials in logs.

Operational requirements

  • Only enable insecure broker transport in an isolated local environment.
  • Provision a RabbitMQ dead-letter exchange before configuring it on a Spine consumer queue.
  • Make Kafka/RabbitMQ consumers idempotent. Reconnects and lost confirms can legitimately cause at-least-once redelivery or duplicates.
  • When enabling trusted proxy CIDRs, configure the proxy to remove or overwrite client-supplied forwarding headers.
  • Alert on WEBSOCKET_CAPACITY_EXCEEDED, consumer reconnect exhaustion, and RabbitMQ Type/RoutingKey mismatch logs.
  • Treat boot.ConfigError.Issues codes as stable machine-readable deployment diagnostics; do not parse the human message.

See the Current Release for the supported Spine version.