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

Regex fix for mattr_accessor validation #20599

Merged
merged 1 commit into from
Oct 1, 2015

Conversation

aliaksandrb
Copy link
Contributor

Hi!

This patch changes ^ and $ operators in regex that validates arguments passed to mattr_reader/writer methods to \A and \z appropriately.

Using ^ and $ allows arguments such as valid\nwhatever_text that definitely not valid and even more they would be executed in context of class_eval after.

So it could lead to the syntax errors or potential code injections if the arguments was created somehow dynamically.

Does it make sense or I miss something?

Thanks and have a good day! ☀️

@repinel
Copy link
Member

repinel commented Jun 22, 2015

The broken tests were fixed in c76b112

@arthurnn
Copy link
Member

arthurnn commented Oct 1, 2015

I think this sounds reasonable. can you rebase against master, so we see a Green build, before I merge it?

thanks

Change ^ and $ operators to \A and \z to prevent
code injection after the line breaks
@aliaksandrb
Copy link
Contributor Author

@arthurnn have rebased against master and bumped a Travis tests.

Thanks for looking on it!

arthurnn pushed a commit that referenced this pull request Oct 1, 2015
@arthurnn arthurnn merged commit 62c82f7 into rails:master Oct 1, 2015
@arthurnn
Copy link
Member

arthurnn commented Oct 1, 2015

thanks

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.

None yet

3 participants