Commit 4abe5a0
authored
Update field_mask.const expression to avoid descriptor confusion (#450)
#429 added rules for field
masks. In the rule `field_mask.const`, we're comparing two
`google.protobuf.FieldMask` messages against each other with the CEL
expression `this != getField(rules, 'const')`. This comparison is
susceptible to type confusion in some Protobuf / CEL implementations.
For example, protovalidate-go references the descriptor from
`fieldmaskpb` when providing the value to CEL, but the user may provide
a different instance of the field mask descriptor when validating a
message. This results in a false negative when the two messages are
compared by cel-go (see its behavior
[here](https://github.com/google/cel-go/blob/v0.26.1/common/types/pb/equal.go#L30)).
To mitigate the problem, this PR changes the CEL expression to compare
field mask paths instead of field mask messages.1 parent 7dc668e commit 4abe5a0
2 files changed
Lines changed: 6 additions & 6 deletions
File tree
- proto/protovalidate/buf/validate
- tools/internal/gen/buf/validate
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4706 | 4706 | | |
4707 | 4707 | | |
4708 | 4708 | | |
4709 | | - | |
| 4709 | + | |
4710 | 4710 | | |
4711 | 4711 | | |
4712 | 4712 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments