multi: use safe copy for macaroons
Fixes #4383 by adding a new SafeCopyMacaroon function that correctly clones all caveats and prevents modifications on the copy from affecting the original.
This commit is contained in:
7 files changed
+105
-7
No files matched your search
+4
-1
@@ -1195,7 +1195,10 @@ func (hn *HarnessNode) ConnectRPCWithMacaroon(mac *macaroon.Macaroon) (
|
||||
if mac == nil {
|
||||
return grpc.DialContext(ctx, hn.Cfg.RPCAddr(), opts...)
|
||||
}
|
||||
macCred := macaroons.NewMacaroonCredential(mac)
|
||||
macCred, err := macaroons.NewMacaroonCredential(mac)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error cloning mac: %v", err)
|
||||
}
|
||||
opts = append(opts, grpc.WithPerRPCCredentials(macCred))
|
||||
|
||||
return grpc.DialContext(ctx, hn.Cfg.RPCAddr(), opts...)
|
||||
|
||||
Reference in new issue
Block a user