protobuf: allow relaxed opaque message with no properties#17122
protobuf: allow relaxed opaque message with no properties#17122htuch merged 3 commits intoenvoyproxy:mainfrom
Conversation
Signed-off-by: Shikugawa <rei@tetrate.io>
| TEST_F(ProtobufUtilityTest, RedactEmptyTypeUrlTypedStruct) { | ||
| udpa::type::v1::TypedStruct actual; | ||
| MessageUtil::redact(actual); | ||
| udpa::type::v1::TypedStruct expected = actual; |
There was a problem hiding this comment.
Here and the test below: expected gets a copy of actual after it's been (potentially) modified by the call to MessageUtil::redact. The equality comparison on the next line will always return true in this case. You probably want to reverse the order of lines 1006 and 1007? I think the return value of MessageUtil::redact should be verified too.
There was a problem hiding this comment.
ah sorry. I overlooked.
|
Did you consider having Envoy just reject these invalid configs? CC @phlax who I know was looking at this recently (maybe same conversation?) |
|
passing - name: envoy.filters.http.router
typed_config: {}should work as i understand - so if its not working somewhere - like other than bootstrap - then probs a good idea to fix in lots of config around the repo that previously had this, it has been replaced with just: - name: envoy.filters.http.routeror similar i think for other fields - which i understood to work the same |
i think if we do that we need to deprecate as a ~large chunk of the demo/example/docs configs have had this for quite some time so its likely to have been used in production configs etc |
|
related pr is here #17065 |
+1. But I think that we can reject empty value on next major API version during bootstrap. |
So, there are two things:
|
| } | ||
| if (!reflection->HasField(*message, type_url_field_descriptor) || | ||
| !reflection->HasField(*message, value_field_descriptor)) { | ||
| return false; |
There was a problem hiding this comment.
added value exists but type_url not exists on typed_struct
|
@htuch friendly ping |
…#17122) I faced a crash while opening config_dump. [2021-06-24 14:48:48.771][934895][critical][assert] [source/common/protobuf/utility.cc:778] assert failure: type_url_field_descriptor != nullptr && value_field_descriptor != nullptr && reflection->HasField(*message, type_url_field_descriptor). It is because we passed opaque message without any properties as follows. - name: envoy.filters.http.router typed_config: {} We can avoid this crash with providing as follows - name: envoy.filters.http.router typed_config: "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router But, initial way should be accepted even if config_dump because Envoy accepts it while bootstrap. This PR fixes to accept relaxed opaque type and avoid crash with it. Additional Description: Risk Level: Low Testing: Unit Signed-off-by: Shikugawa <rei@tetrate.io>
Signed-off-by: Shikugawa rei@tetrate.io
Commit Message: I faced a crash while opening config_dump.
It is because we passed opaque message without any properties as follows.
We can avoid this crash with providing as follows
But, initial way should be accepted even if config_dump because Envoy accepts it while bootstrap.
This PR fixes to accept relaxed opaque type and avoid crash with it.
Additional Description:
Risk Level: Low
Testing: Unit
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Deprecated:]
[Optional API Considerations:]