-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix validation in chain write capability #15191
fix validation in chain write capability #15191
Conversation
I see you updated files related to
|
@@ -217,4 +220,44 @@ func TestWriteTarget(t *testing.T) { | |||
_, err2 := writeTarget.Execute(ctx, req) | |||
require.Error(t, err2) | |||
}) | |||
|
|||
tests := []struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add case-insensitive scenarios?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. case-insensitive scenario is now tested as part of TestWriteTarget/succeeds_with_valid_report
@@ -181,12 +182,18 @@ func evaluate(rawRequest capabilities.CapabilityRequest) (r Request, err error) | |||
return r, fmt.Errorf("WorkflowExecutionID in the report does not match WorkflowExecutionID in the request metadata. Report WorkflowExecutionID: %+v, request WorkflowExecutionID: %+v", reportMetadata.WorkflowExecutionID, rawRequest.Metadata.WorkflowExecutionID) | |||
} | |||
|
|||
if hex.EncodeToString(reportMetadata.WorkflowOwner[:]) != rawRequest.Metadata.WorkflowOwner { | |||
if !strings.EqualFold(hex.EncodeToString(reportMetadata.WorkflowOwner[:]), rawRequest.Metadata.WorkflowOwner) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add comments in both cases to explain what we're doing and why we need it?
For item 1: do a case sensitive verification of the owner address (so that a check-summed address matches its non-checksummed version).
For item 2: workflowNames are padded in the core node to 10bytes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep added!
…me-and-owner-validation-errors
* fix validation in chain write capability * add unit tests * address comments
fix for validation errors in chain write capability.
[10]byte
. Previous error was: