Skip to content

Commit 13bdf13

Browse files
committed
Align Go toJSON sensitive state filtering
1 parent ea487ff commit 13bdf13

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

go/modcdp/types/toJSON.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
// - ./python/modcdp/types/toJSON.py
55
package types
66

7-
import "reflect"
7+
import (
8+
"reflect"
9+
"strings"
10+
)
811

912
type ModCDPJSONChild interface {
1013
ToJSON() map[string]any
@@ -77,6 +80,10 @@ func simpleState(input any) map[string]any {
7780
}
7881

7982
func addSimpleStateValue(state map[string]any, key string, value any) {
83+
normalizedKey := strings.ToLower(key)
84+
if key == "Config" || key == "config" || strings.Contains(normalizedKey, "token") || strings.Contains(normalizedKey, "secret") || strings.Contains(normalizedKey, "api_key") || strings.Contains(normalizedKey, "apikey") {
85+
return
86+
}
8087
switch typed := value.(type) {
8188
case string:
8289
state[key] = typed

0 commit comments

Comments
 (0)