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

Option to prevent user of inserting malicious text in the tag #1125

Open
fguillen opened this issue Apr 28, 2024 · 1 comment
Open

Option to prevent user of inserting malicious text in the tag #1125

fguillen opened this issue Apr 28, 2024 · 1 comment

Comments

@fguillen
Copy link

This is possible now :

user.update(tag_list: "one, two, <script>alert('hello')</script>")
user.tag_list
# => ["one", "two", "<script>alert('hello')</script>"]

Is there any option in the parser to clean the HTML code in the tags?

@MyklClason
Copy link

MyklClason commented Jul 9, 2024

Seems like a good idea to do by default, I'm hard pressed to think of any situation where it makes sense to store tags in the database with html tags.

If it's a concern, definitely use something to strip out the tags at the controller level or even the model level, but I think it makes sense for the gem to remove them by default and have a option to not do so.

Edit: https://github.com/mbleigh/acts-as-taggable-on?tab=readme-ov-file#tag-parsers supported in general via tag parsers.

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

No branches or pull requests

2 participants