mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 12:57:18 +00:00
Make TLS mandatory by default when unmarshalling remote wallet options (#8133)
Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> Co-authored-by: Nishant Das <nishdas93@gmail.com>
This commit is contained in:
parent
f75b8a3be1
commit
25b151ab78
@ -137,7 +137,9 @@ func UnmarshalOptionsFile(r io.ReadCloser) (*KeymanagerOpts, error) {
|
|||||||
log.Errorf("Could not close keymanager config file: %v", err)
|
log.Errorf("Could not close keymanager config file: %v", err)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
opts := &KeymanagerOpts{}
|
opts := &KeymanagerOpts{
|
||||||
|
RemoteCertificate: &CertificateConfig{RequireTls: true},
|
||||||
|
}
|
||||||
if err := json.Unmarshal(enc, opts); err != nil {
|
if err := json.Unmarshal(enc, opts); err != nil {
|
||||||
return nil, errors.Wrap(err, "could not JSON unmarshal")
|
return nil, errors.Wrap(err, "could not JSON unmarshal")
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package remote
|
package remote
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
@ -306,3 +308,23 @@ func TestRemoteKeymanager_FetchValidatingPublicKeys(t *testing.T) {
|
|||||||
}
|
}
|
||||||
assert.DeepEqual(t, pubKeys, rawKeys)
|
assert.DeepEqual(t, pubKeys, rawKeys)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestUnmarshalOptionsFile_DefaultRequireTls(t *testing.T) {
|
||||||
|
optsWithoutTls := struct {
|
||||||
|
RemoteCertificate struct {
|
||||||
|
ClientCertPath string
|
||||||
|
ClientKeyPath string
|
||||||
|
CACertPath string
|
||||||
|
}
|
||||||
|
}{}
|
||||||
|
var buffer bytes.Buffer
|
||||||
|
b, err := json.Marshal(optsWithoutTls)
|
||||||
|
require.NoError(t, err)
|
||||||
|
_, err = buffer.Write(b)
|
||||||
|
require.NoError(t, err)
|
||||||
|
r := ioutil.NopCloser(&buffer)
|
||||||
|
|
||||||
|
opts, err := UnmarshalOptionsFile(r)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Equal(t, true, opts.RemoteCertificate.RequireTls)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user