mirror of
https://source.quilibrium.com/quilibrium/ceremonyclient.git
synced 2024-12-25 16:15:17 +00:00
push out signature validation to the edge, punish only
This commit is contained in:
parent
1e60549f89
commit
c84599e7e0
@ -266,7 +266,7 @@ func NewPubSub(ctx context.Context, h host.Host, rt PubSubRouter, opts ...Option
|
|||||||
peerOutboundQueueSize: 32,
|
peerOutboundQueueSize: 32,
|
||||||
signID: h.ID(),
|
signID: h.ID(),
|
||||||
signKey: nil,
|
signKey: nil,
|
||||||
signPolicy: StrictSign,
|
signPolicy: LaxSign,
|
||||||
incoming: make(chan *RPC, 32),
|
incoming: make(chan *RPC, 32),
|
||||||
newPeers: make(chan struct{}, 1),
|
newPeers: make(chan struct{}, 1),
|
||||||
newPeersPend: make(map[peer.ID]struct{}),
|
newPeersPend: make(map[peer.ID]struct{}),
|
||||||
|
@ -27,10 +27,8 @@ const (
|
|||||||
// StrictNoSign does not produce signatures and drops and penalises incoming messages that carry one
|
// StrictNoSign does not produce signatures and drops and penalises incoming messages that carry one
|
||||||
StrictNoSign = msgVerification
|
StrictNoSign = msgVerification
|
||||||
// LaxSign produces signatures and validates incoming signatures iff one is present
|
// LaxSign produces signatures and validates incoming signatures iff one is present
|
||||||
// Deprecated: it is recommend to either strictly enable, or strictly disable, signatures.
|
|
||||||
LaxSign = msgSigning
|
LaxSign = msgSigning
|
||||||
// LaxNoSign does not produce signatures and validates incoming signatures iff one is present
|
// LaxNoSign does not produce signatures and validates incoming signatures iff one is present
|
||||||
// Deprecated: it is recommend to either strictly enable, or strictly disable, signatures.
|
|
||||||
LaxNoSign = 0
|
LaxNoSign = 0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -297,7 +297,7 @@ func (v *validation) validateWorker() {
|
|||||||
func (v *validation) validate(vals []*validatorImpl, src peer.ID, msg *Message, synchronous bool) error {
|
func (v *validation) validate(vals []*validatorImpl, src peer.ID, msg *Message, synchronous bool) error {
|
||||||
// If signature verification is enabled, but signing is disabled,
|
// If signature verification is enabled, but signing is disabled,
|
||||||
// the Signature is required to be nil upon receiving the message in PubSub.pushMsg.
|
// the Signature is required to be nil upon receiving the message in PubSub.pushMsg.
|
||||||
if msg.Signature != nil {
|
if msg.Signature != nil && v.p.signPolicy&msgVerification != 0 {
|
||||||
if !v.validateSignature(msg) {
|
if !v.validateSignature(msg) {
|
||||||
log.Debugf("message signature validation failed; dropping message from %s", src)
|
log.Debugf("message signature validation failed; dropping message from %s", src)
|
||||||
v.tracer.RejectMessage(msg, RejectInvalidSignature)
|
v.tracer.RejectMessage(msg, RejectInvalidSignature)
|
||||||
|
Loading…
Reference in New Issue
Block a user