Skip to content

Conversation

@monoidic
Copy link
Collaborator

@monoidic monoidic commented Jul 1, 2024

intelmq-manager allows the user to fill in a configuration value with a numeric string by enclosing it in quotes, such as "200", and it is submitted correctly. When editing the configuration of the same bot later, the values, including the numeric string, are filled in with the current configuration values. However, this filled in value will not contain the quotes and will subsequently be considered a number. This can cause type errors if a string is expected for this value.

This patch detects numeric strings and adds quotation marks for them ahead of time when editing the configuration in intelmq-manager, preventing "200" from being silently converted to 200 on subsequent edits.

@kamil-certat
Copy link
Contributor

This is actually quite tricky, because if the bot may expect a number to be a number in the configuration, right? If I understand correctly, the problem is that configuration:

my-bot:
   parameters:
      expected_string: "200"

will silently be converted by the manager to:

my-bot:
   parameters:
      expected_string: 200

However, isn't it so, that this change will introduce the opposite behaviour, and all data defined intentionally as numbers, will be then converted to strings?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants