Skip to content

request filter part two#166

Merged
tock-ibm merged 1 commit intohyperledger:mainfrom
DorKatzelnick:ReqFilterInt
Aug 13, 2025
Merged

request filter part two#166
tock-ibm merged 1 commit intohyperledger:mainfrom
DorKatzelnick:ReqFilterInt

Conversation

@DorKatzelnick
Copy link
Contributor

integrating request verifier in router

Comment on lines +350 to +353
// func (r *Router) updateVerifier(config *nodeconfig.RouterNodeConfig) error {
// return nil
// }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed the function since it is not used for now

NumOfgRPCStreamsPerConnection int
UseTLS bool
ClientAuthRequired bool
RequestMaxBytes uint64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a getter to implement the FilterConfig interface

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

close(start)
wg.Wait()
fmt.Println("max counter : ", maxVerifiers)
// require.True(t, maxVerifiers > 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test this, and print with t.Logf()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment on lines +334 to +340
type RouterFilterConfig struct {
RequestMaxBytes uint64
}

func (r RouterFilterConfig) GetMaxSizeBytes() (uint64, error) {
return r.RequestMaxBytes, nil
}

func createVerifier(config *nodeconfig.RouterNodeConfig) *requestfilter.RulesVerifier {
rv := requestfilter.NewRulesVerifier(nil)
rfc := RouterFilterConfig{RequestMaxBytes: config.RequestMaxBytes}
rv.AddRule(requestfilter.PayloadNotEmptyRule{})
rv.AddRule(requestfilter.NewMaxSizeFilter(rfc))
return rv
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just add a getter on the RouterNodeConfig

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

if err := s.verifier.Verify(msg); err != nil {
s.logger.Debugf("request is invalid: %s", err)
// send a response to the client
resp := protos.SubmitResponse{Error: fmt.Sprintf("request verifying error: %s", err), TraceId: msg.TraceId}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

request verification error

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Signed-off-by: Dor.Katzelnick <Dor.Katzelnick@ibm.com>
@tock-ibm tock-ibm merged commit 7f4f566 into hyperledger:main Aug 13, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants