Skip to content

v1.7.6

Choose a tag to compare

@nxpharryt nxpharryt released this 13 Mar 21:34
· 122 commits to master since this release

Comprehensive Audit Rounds 9-10: 27 fixes across 11 files

Race Conditions Fixed

  • client/client.go: Protect _sd in connectSd/updateHealth/deregisterInstance with connMu
  • client/client.go: Protect _sqs and _circuitBreakers writes in Dial() with proper locks
  • notifierserver: Move notifierServer assignment after full initialization (premature publication fix)
  • adapters/resolver: Atomicize check-and-create in NewManualResolver to fix TOCTOU race
  • adapters/resolver: Register with gRPC before inserting into internal maps (clean failure on panic)

Security Fixes

  • service/service.go: IP validation uses net.ParseIP instead of digit-only check
  • service/service.go: JSON escaping in getHostDiscoveryMessage (defense-in-depth)
  • service/service.go: URL-encode instanceId in REST DELETE path (path traversal prevention)
  • notifiergateway: Unescape URLs BEFORE SSRF domain validation (validated URL must match fetched URL)
  • grpc_recovery: Return generic error message instead of leaking panic value to gRPC clients
  • webserver: Log X-Ray init error instead of silently ignoring

Resource Leak & Logic Fixes

  • client/notifierclient.go: Cancel+clear _subscribeCancel in Dial() and Unsubscribe() early return
  • client/notifierclient.go: Include action in dedup key (prevents suppressing OFFLINE events)
  • client/notifierclient.go: Nil check on ClientConnection() before creating gRPC service client
  • service/service.go: Health warm-up time.Sleep replaced with interruptible timer+select
  • notifiergateway: time.After in select replaced with time.NewTimer+Stop
  • adapters/queue: Nil check on SendMessage/SendMessageFIFO result before accessing MessageId
  • notifierserver/impl: SetDataToSendByTopicArn returns false when all sends fail (was always true)
  • notifiergateway: HTTP 404 changed to 400 for input validation errors (10 sites)

Shutdown Completeness

  • service/service.go: Serve() quit handler now performs full cleanup matching GracefulStop() — publishToSNS(offline), unsubscribeSNS, deregisterInstance, disconnect AWS clients
  • service/service.go: Serve() waits on quitDone channel for quit handler to complete before AfterServerShutdown

Health Server Improvement

  • Event-driven Watch with statusNotify channel and NotifyStatusChange() method
  • Heartbeat interval reduced from 30s to 5s; only sends on status change or heartbeat tick
  • RegisterHandler triggers NotifyStatusChange() for immediate watcher update

Dependency

  • aldelo/common updated from v1.7.5 to v1.7.6

Verification

  • go build ./... — clean
  • go vet ./... — clean
  • 125 unit tests pass with -race flag
  • Two full re-review iterations confirmed zero remaining actionable issues