项目文件夹

文件
Copilot 50ce1a5e83 TLS certificate verification: opt-in security to preserve backward compatibility (#2843)
* Initial plan

* Fix insecure TLS configuration - make secure by default

- Changed util/tls/Config() to be secure by default (InsecureSkipVerify=false)
- Added MICRO_TLS_INSECURE=true environment variable for development/testing
- Updated documentation to emphasize security-first approach
- Added comprehensive tests for TLS configuration
- All existing broker tests pass

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Revert to backward-compatible TLS defaults to avoid breaking changes

- Reverted default to InsecureSkipVerify=true for backward compatibility
- Changed environment variable to MICRO_TLS_SECURE=true (opt-in security)
- Added deprecation warning that logs once per process
- Updated tests to reflect backward-compatible behavior
- Added comprehensive migration guide
- No breaking changes - production systems safe to upgrade
- Security improvement is opt-in via environment variable
- Planned breaking change for v6 with proper major version bump

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Add TLS security update documentation

Co-authored-by: asim <17530+asim@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: asim <17530+asim@users.noreply.github.com>
2026-02-03 15:53:03 +00:00

1.9 KiB

TLS Security Update - Important Information

What Changed

The TLS configuration in go-micro now includes a security deprecation warning.

Current Behavior (v5.x)

Default: TLS certificate verification is disabled for backward compatibility

  • This maintains existing behavior to avoid breaking production deployments
  • A deprecation warning is logged once per process startup

Why: Changing the default to secure would be a breaking change that could disrupt:

  • Production systems during routine upgrades
  • Distributed systems with mixed versions
  • Services using self-signed certificates

Option 1: Environment Variable

export MICRO_TLS_SECURE=true

Option 2: Use SecureConfig

import (
    "go-micro.dev/v5/broker"
    mls "go-micro.dev/v5/util/tls"
)

broker := broker.NewHttpBroker(
    broker.TLSConfig(mls.SecureConfig()),
)

Migration Timeline

  • v5.x (Current): Insecure by default, opt-in security via MICRO_TLS_SECURE=true
  • v6.x (Future): Secure by default (breaking change with major version bump)

Why This Approach?

This addresses the concerns raised about:

  1. Major version requirements: No breaking change in v5, deferred to v6
  2. Cross-host compatibility: All hosts use same default behavior
  3. Production safety: Existing deployments continue working during upgrades
  4. Migration path: Clear opt-in path with documentation

Documentation

See SECURITY_MIGRATION.md for detailed migration guide.

Security Recommendation

For production deployments:

  1. Test with MICRO_TLS_SECURE=true in staging
  2. Use proper CA-signed certificates
  3. Consider service mesh (Istio, Linkerd) for automatic mTLS
  4. Plan migration before v6 release

Questions?

Open an issue on GitHub or check the documentation at https://go-micro.dev/docs/