newrelic / newrelic-ruby-agent

New Relic RPM Ruby Agent
https://docs.newrelic.com/docs/apm/agents/ruby-agent/getting-started/introduction-new-relic-ruby/
Apache License 2.0
1.2k stars 596 forks source link

Correctly handle `newrelic.yml` boolean parsing #2838

Open hannahramadan opened 1 week ago

hannahramadan commented 1 week ago

The agent's config file currently accepts strings where boolean values are expected. This can cause an issue where, for example, setting a boolean-expected config to 'false' (or any other string) evaluates to true.

The agent's config parsing logic needs to be updated to allow certain strings when a boolean is expected. Some logic currently exists in the agent for the configs agent_enabled and enabled that gets near the desired behavior, which we may be able to build off:

https://github.com/newrelic/newrelic-ruby-agent/blob/41430b2aac3cdb69c178cd742b4074618e00227c/lib/new_relic/agent/configuration/yaml_source.rb#L135-L148

Following the above logic, the boolean true may accept the strings 'true', 'yes', 'on' while the boolean false may accept 'false', 'no', 'off'. We should log an error and use the default config value when unexpected values are given.

workato-integration[bot] commented 1 week ago

https://new-relic.atlassian.net/browse/NR-309788