Repository navigation
config: do not echo secret URLs in YAML parse errors - #5749
vignesh2027 wants to merge 1 commit into
Conversation
A secret URL that fails to parse in the YAML config used to produce an error quoting the whole value, including any token in the path. The JSON path already redacts it. Do the same for YAML, for SecretURL and for the non-templated case of SecretTemplateURL, and keep the original error when secrets are marshaled in clear. Signed-off-by: vigneshwar <applemacbook6sep2004@gmail.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Pull Request Checklist
Please check all the applicable boxes.
benchstatto compare benchmarksWhen a secret URL in the YAML config does not parse, the load error quotes the whole value, so a token in the path ends up in the error and in the logs. This affects fields such as
slack_api_url,slack_configs.api_url, the otherwebhook_urlfields andwebhook_configs.url.SecretURLalready redacts the value for JSON (#3884) but the YAML path went straight throughURL.UnmarshalYAML. This parses inSecretURL.UnmarshalYAMLand replaces errors that quote the input withinvalid URL (value redacted)orunsupported scheme for URL (value redacted).SecretTemplateURLgets the same treatment for non-templated values. When secrets are marshaled in clear the original error is kept, as the JSON path does.Example with a made-up token:
parse "http://hooks.example.com/%zz/SECRETTOKEN123": invalid URL escape "%zz"becomesinvalid URL (value redacted).Tests cover the global and per receiver fields through
Load, plusSecretURLandSecretTemplateURLdirectly.