Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on MySQL madness and Rails (+possible exploit).
Turns out the matches are determined by the beginning character of the string column. For example, if the user's token is '5feZas0352f', the query
SELECT * FROM users WHERE reset_token = 5;
The behaviour is documented here:
http://dev.mysql.com/doc/refman/5.6/en/type-conversion.html
> For comparisons of a string column with a number ... there are many different strings that may convert to the value 1, such as '1', ' 1', or '1a'.
There are no comments on this comment yet.
Turns out the matches are determined by the beginning character of the string column. For example, if the user's token is '5feZas0352f', the query
will match that user. And if it doesn't start with a number, 0 will match it.The behaviour is documented here:
http://dev.mysql.com/doc/refman/5.6/en/type-conversion.html
> For comparisons of a string column with a number ... there are many different strings that may convert to the value 1, such as '1', ' 1', or '1a'.