From f0d649c8dc9f615ab24c4ef125744cfe6f3033d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Noack?= Date: Thu, 12 Sep 2024 07:22:12 -0700 Subject: [PATCH] Fleetspeak/Configs: Do not crash when reading unknown field names PiperOrigin-RevId: 673835911 --- .../src/client/config/filesystem_persistence_handler.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fleetspeak/src/client/config/filesystem_persistence_handler.go b/fleetspeak/src/client/config/filesystem_persistence_handler.go index 58cf6d91..2c1c9583 100644 --- a/fleetspeak/src/client/config/filesystem_persistence_handler.go +++ b/fleetspeak/src/client/config/filesystem_persistence_handler.go @@ -189,7 +189,11 @@ func (h *FilesystemPersistenceHandler) ReadServices() ([]*fspb.ClientServiceConf } s := &fspb.ClientServiceConfig{} - if err := prototext.Unmarshal(b, s); err != nil { + err = prototext.UnmarshalOptions{ + // Forward compatibility with future field names + DiscardUnknown: true, + }.Unmarshal(b, s) + if err != nil { log.Errorf("Unable to parse service file [%s], ignoring: %v", fp, err) continue }