(key string, v any)
| 233 | } |
| 234 | |
| 235 | func redactJSONValue(key string, v any) any { |
| 236 | lowerKey := strings.ToLower(key) |
| 237 | switch x := v.(type) { |
| 238 | case map[string]any: |
| 239 | out := make(map[string]any, len(x)) |
| 240 | for k, child := range x { |
| 241 | out[k] = redactJSONValue(k, child) |
| 242 | } |
| 243 | return out |
| 244 | case []any: |
| 245 | out := make([]any, len(x)) |
| 246 | for i, child := range x { |
| 247 | if lowerKey == "script_keys" { |
| 248 | out[i] = redactScriptKeyEntry(child) |
| 249 | continue |
| 250 | } |
| 251 | out[i] = redactJSONValue(lowerKey, child) |
| 252 | } |
| 253 | return out |
| 254 | case string: |
| 255 | switch { |
| 256 | case lowerKey == "script_keys": |
| 257 | return redactSecretString(x, "deployment") |
| 258 | case lowerKey == "relay_urls" || lowerKey == "upstream_proxy": |
| 259 | return redactEndpoint(x) |
| 260 | case isSensitiveConfigKey(lowerKey): |
| 261 | return redactSecretString(x, "secret") |
| 262 | default: |
| 263 | return x |
| 264 | } |
| 265 | default: |
| 266 | return v |
| 267 | } |
| 268 | } |
| 269 | |
| 270 | func redactScriptKeyEntry(v any) any { |
| 271 | switch x := v.(type) { |
no test coverage detected