* fix: the public share configuration and fixed graceful shutdown
* fix: [OCISDEV-1433] remove GRPC_MAX_CONNECTION_AGE
The setting closed healthy grpc connections on a timer so that clients would redo
their DNS lookup. It never helped against the failure it was reached for - a
connection whose peer stopped answering - because the age limit is enforced by
the server, the grace period was left at infinity so a request already in flight
was never ended, and any value without a unit suffix silently disabled it again.
Detecting a peer that stops answering is now the job of the grpc clients, which
ping the peer while a request is in flight. The servers here got the matching
enforcement policy so they accept those pings; the client side arrives with the
next reva bump.
* fix: Added the new variable OCDAV_DISABLE_PROPFIND_PUBLIC_LINK_RESOLUTION that disable the resolution of public link shares when answering PROPFIND requests.
* chore: bump reva
* fix: The keepalive added to grpc clinet
* chore: bump reva
* build(deps): bump go 1.26.8, grpc-go dependency
---------
(cherry picked from commit e86eb4d210)
For the 9.0 branch, the reva dependency was pointed at reva's main-branch
merge of PR #748 (commit 373f9509a, pseudo-version
v2.0.0-20261005091647-373f9509a363) instead of the 8.2-targeted
e0beaa380005, since the 8.2 merge predates the VaultMode/UploadSessionFilter.Orphaned
APIs already present on the 9.0 reva lineage.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
# Conflicts:
# changelog/unreleased/security-bump-grpc.md
# go.mod
# go.sum
# vendor/google.golang.org/grpc/server.go
# vendor/google.golang.org/grpc/stream.go
# vendor/google.golang.org/grpc/version.go
# vendor/modules.txt
78 lines
2.6 KiB
Go
78 lines
2.6 KiB
Go
package grpc
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/owncloud/ocis/v2/ocis-pkg/shared"
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
"go-micro.dev/v4/client"
|
|
)
|
|
|
|
func TestWithDefaultCallOptionsAppliesGivenCallOptionsToDefaults(t *testing.T) {
|
|
var applied int
|
|
fake := client.CallOption(func(_ *client.CallOptions) {
|
|
applied++
|
|
})
|
|
|
|
opt := withDefaultCallOptions(fake, fake)
|
|
var opts client.Options
|
|
opt(&opts)
|
|
|
|
assert.Equal(t, 2, applied)
|
|
}
|
|
|
|
// TestNewClientKeepaliveDialOptions ensures that keepalive params configured via
|
|
// WithKeepaliveParams end up in the client's *default* CallOptions.Context, and only then. That
|
|
// context is where the go-micro grpc plugin looks up the dial options on every dial (see
|
|
// grpcClient.getGrpcDialOptions in github.com/go-micro/plugins/v4/client/grpc, which reads
|
|
// g.opts.CallOptions.Context and ignores per-call CallOptions). Without them a black-holed peer
|
|
// would hang the caller for as long as it allows instead of being detected by the keepalive ping.
|
|
//
|
|
// The dial options themselves cannot be asserted on: the plugin stores them under an unexported
|
|
// context key, so a non-nil context is as close as this package can get from the outside.
|
|
func TestNewClientKeepaliveDialOptions(t *testing.T) {
|
|
// the plugin needs a registry to construct a client, and an in-memory one keeps the test
|
|
// from reaching out to a nats-js-kv that isn't there
|
|
t.Setenv("MICRO_REGISTRY", "memory")
|
|
// an empty address is treated like an unset one by ocis-pkg/registry
|
|
t.Setenv("MICRO_REGISTRY_ADDRESS", "")
|
|
|
|
tests := map[string]struct {
|
|
opts []ClientOption
|
|
wantContextSet bool
|
|
}{
|
|
"keepalive configured": {
|
|
opts: []ClientOption{
|
|
WithKeepaliveParams(&shared.GRPCClientOptions{GRPCClientKeepaliveTime: 30 * time.Second}),
|
|
},
|
|
wantContextSet: true,
|
|
},
|
|
"no keepalive option leaves grpc's own dial defaults untouched": {
|
|
wantContextSet: false,
|
|
},
|
|
"keepalive option without a configured time leaves grpc's own dial defaults untouched": {
|
|
opts: []ClientOption{WithKeepaliveParams(&shared.GRPCClientOptions{})},
|
|
wantContextSet: false,
|
|
},
|
|
"keepalive option without any options leaves grpc's own dial defaults untouched": {
|
|
opts: []ClientOption{WithKeepaliveParams(nil)},
|
|
wantContextSet: false,
|
|
},
|
|
}
|
|
|
|
for name, tt := range tests {
|
|
t.Run(name, func(t *testing.T) {
|
|
c, err := NewClient(append(GetClientOptions(&shared.GRPCClientTLS{Mode: "off"}), tt.opts...)...)
|
|
require.NoError(t, err)
|
|
|
|
if tt.wantContextSet {
|
|
assert.NotNil(t, c.Options().CallOptions.Context)
|
|
return
|
|
}
|
|
assert.Nil(t, c.Options().CallOptions.Context)
|
|
})
|
|
}
|
|
}
|