Skip to content

gRPC connection pool accepts TLS mode "insecure" without OC_INSECURE #1072

Backlog

Description

@asaah262

Describe the bug

The gRPC connection pool accepts the TLS mode insecure without any further condition. pool.StringToTLSMode("insecure") returns TLSInsecure, and NewConn then uses TLS with InsecureSkipVerify: true, so the server certificate is never verified:

  • func StringToTLSMode(m string) (TLSMode, error) {
    switch m {
    case "off", "":
    return TLSOff, nil
    case "insecure":
    return TLSInsecure, nil
    case "on":
    return TLSOn, nil
    default:
    return TLSOff, fmt.Errorf("unknown TLS mode: '%s'. Valid values are 'on', 'off' and 'insecure'", m)
    }
    }
  • case TLSInsecure:
    tlsConfig := tls.Config{
    InsecureSkipVerify: true, //nolint:gosec
    }
    cred = credentials.NewTLS(&tlsConfig)

In OpenCloud, the mode comes from OC_GRPC_CLIENT_TLS_MODE. opencloud-eu/opencloud#4117 makes the go-micro gRPC clients refuse insecure unless OC_INSECURE is true, and the description of OC_GRPC_CLIENT_TLS_MODE now says so. The connections created through this pool read the same setting, but don't have that check.

Steps to reproduce

  1. Run OpenCloud with OC_GRPC_TLS_ENABLED=true (auto-generated certificate) and OC_GRPC_CLIENT_TLS_MODE=insecure, without OC_INSECURE.
  2. Start a service that only uses the connection pool and no go-micro client, e.g. clientlog or collaboration, as a separate process.

Expected behavior

The service refuses to start, like the services with a go-micro client: insecure is only accepted when OC_INSECURE is true.

Actual behavior

The service starts and connects to the other services without verifying their certificates.

Impact

  • Only installations that set OC_GRPC_CLIENT_TLS_MODE=insecure explicitly are affected. The default off is not.
  • In a single-process opencloud server, the services with a go-micro client already fail to start with fix(grpc)!: require OC_INSECURE=true for the insecure client TLS mode opencloud#4117, so the server doesn't come up. The gap matters when services run as separate processes or containers.
  • The setting then behaves differently from what its description says, without an error or a log message.

Possible fix

Apply the same condition in the pool, e.g. in StringToTLSMode or in NewConn, and bump reva in opencloud. The services in opencloud that call pool.StringToTLSMode would then fail with a clear error, as the go-micro clients do.

Setup

Code on main (ebae57c). Not reproduced on a running instance; the behaviour follows from the code above.

Activity

  1. added theissue type on Nov 24, 2026
  2. moved this from Backlog to Prio <= 3 in OpenCloud Team Boardon Nov 24, 2026
  3. asaah262 commented on Nov 25, 2026

    @asaah262
    Author

    The mode also reaches reva through the storage-users config (permissionssvc_tls_mode) and through grpc_client_options in the reva configs, so a fix needs to cover those as well. An alternative to guarding each client: check OC_GRPC_CLIENT_TLS_MODE once at startup, for all services.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions