Skip to content

Fix Insecure Mass Assignment tag_groups #33209

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

opsysdebug
Copy link

@tag_group = TagGroup.new(tag_groups_params)

Operations that allow for mass assignment (setting multiple attributes of an object using a hash), such as ActiveRecord::Base.new, should take care not to allow arbitrary parameters to be set by the user. Otherwise, unintended attributes may be set, such as an is_admin field for a User object.

Fix the issue need to remove the use of permit! on line 112 and ensure that only explicitly permitted parameters are allowed for mass assignment. This can be achieved by directly merging the permitted attributes of the tag_group parameter into the params object. The permit call on line 115 already specifies the allowed attributes, so we can safely rely on it. The updated tag_groups_params method will no longer use permit! and will explicitly handle the tag_group parameter in a secure manner.

Rails guides: Strong Parameters

Copy link

This pull request has been automatically marked as stale because it has been open for 60 days with no activity. To keep it open, remove the stale tag, push code, or add a comment. Otherwise, it will be closed in 14 days.

@github-actions github-actions bot added the Stale label Aug 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

1 participant