Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validate format for SettingsChange#key #22624

Merged
merged 1 commit into from
Jul 28, 2023

Conversation

kbrock
Copy link
Member

@kbrock kbrock commented Jul 20, 2023

This is probably for developers only, but this puts validation on the value that goes into the key

@kbrock
Copy link
Member Author

kbrock commented Jul 21, 2023

update:

  • added \A, \z to ensure the regular expression matched the key completely

@@ -1,6 +1,7 @@
class SettingsChange < ApplicationRecord
serialize :value

validates :key, :format => %r{\A/[^/]+(/[^/]+)*\z}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - can you add some specs?

@Fryguy Fryguy self-assigned this Jul 26, 2023
@kbrock kbrock force-pushed the settings_change_key_format branch from 7156256 to af56a21 Compare July 26, 2023 22:52
@miq-bot
Copy link
Member

miq-bot commented Jul 26, 2023

Checked commit kbrock@af56a21 with ruby 2.6.10, rubocop 1.28.2, haml-lint 0.35.0, and yamllint
2 files checked, 0 offenses detected
Everything looks fine. 🍰

@kbrock
Copy link
Member Author

kbrock commented Jul 27, 2023

update:

  • added specs around the validation

@Fryguy Fryguy merged commit 325abb8 into ManageIQ:master Jul 28, 2023
9 checks passed
@kbrock kbrock deleted the settings_change_key_format branch April 18, 2024 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants