Skip to content

Commit

Permalink
Use \A \z for checking regex on legal
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed Jun 4, 2015
1 parent 7446d7c commit 976da32
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/bson/object_id.rb
Expand Up @@ -282,7 +282,7 @@ def from_time(time, options = {})
#
# @since 2.0.0
def legal?(string)
string.to_s =~ /^[0-9a-f]{24}$/i ? true : false
string.to_s =~ /\A[0-9a-f]{24}\z/i ? true : false
end

# Executes the provided block only if the size of the provided object is
Expand Down

6 comments on commit 976da32

@judofyr
Copy link

@judofyr judofyr commented on 976da32 Jun 4, 2015

Choose a reason for hiding this comment

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

Yay! Thanks for a quick patch.

@cheald
Copy link

@cheald cheald commented on 976da32 Jun 4, 2015

Choose a reason for hiding this comment

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

Is the 1.x series going to see a patch? Users who aren't using bson_ext (such as users on JRuby) are still vulnerable.

@estolfo
Copy link
Contributor

@estolfo estolfo commented on 976da32 Jun 4, 2015

Choose a reason for hiding this comment

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

Yes, it will be released this afternoon.

@estolfo
Copy link
Contributor

@estolfo estolfo commented on 976da32 Jun 4, 2015

Choose a reason for hiding this comment

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

It's in master already.

@cheald
Copy link

@cheald cheald commented on 976da32 Jun 4, 2015

Choose a reason for hiding this comment

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

Perfect, thanks. https://github.com/mongodb/mongo-ruby-driver/blob/1.x-stable/lib/bson/types/object_id.rb for anyone else who ends up here looking for it, like me. :)

@estolfo
Copy link
Contributor

@estolfo estolfo commented on 976da32 Jun 4, 2015

Choose a reason for hiding this comment

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

mongo 1.12.3 and bson 1.12.3 are released with this fix.

Please sign in to comment.