Skip to content

Commit cf8f160

Browse files
authored
[ProtoApiScrubber] Add support for nested field paths in the field checker (#41931)
Signed-off-by: Sumit Kumar <[email protected]>
1 parent 8a16971 commit cf8f160

File tree

3 files changed

+314
-18
lines changed

3 files changed

+314
-18
lines changed

source/extensions/filters/http/proto_api_scrubber/scrubbing_util_lib/field_checker.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,17 @@
44
#include "source/common/protobuf/protobuf.h"
55
#include "source/extensions/filters/http/proto_api_scrubber/filter_config.h"
66

7+
#include "absl/strings/str_join.h"
78
#include "proto_processing_lib/proto_scrubber/field_checker_interface.h"
89

910
namespace Envoy {
1011
namespace Extensions {
1112
namespace HttpFilters {
1213
namespace ProtoApiScrubber {
1314

14-
FieldCheckResults FieldChecker::CheckField(const std::vector<std::string>&,
15+
FieldCheckResults FieldChecker::CheckField(const std::vector<std::string>& path,
1516
const Protobuf::Field* field) const {
16-
// Currently, this method only checks the top level request/response fields and hence, the field
17-
// name itself represents the field_mask.
18-
const std::string field_mask = field->name();
17+
const std::string field_mask = absl::StrJoin(path, ".");
1918

2019
MatchTreeHttpMatchingDataSharedPtr match_tree;
2120

source/extensions/filters/http/proto_api_scrubber/scrubbing_util_lib/field_checker.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class FieldChecker : public FieldCheckerInterface, public Logger::Loggable<Logge
5252
* Currently, this method only checks the top level request/response fields. The logic for nested
5353
* fields will be added in the future.
5454
*/
55-
FieldCheckResults CheckField(const std::vector<std::string>&,
55+
FieldCheckResults CheckField(const std::vector<std::string>& path,
5656
const Protobuf::Field* field) const override;
5757

5858
/**

0 commit comments

Comments
 (0)