From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (smtp.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id 7FB4917DC3CC for ; Wed, 23 Dec 2015 11:42:55 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id 1D339B5D8B9 for ; Wed, 23 Dec 2015 12:15:16 +0900 (JST) Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id 5E2E318CC7AF for ; Wed, 23 Dec 2015 12:15:16 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 4E5E5120509; Wed, 23 Dec 2015 12:15:15 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o10.shared.sendgrid.net (o10.shared.sendgrid.net [173.193.132.135]) by neon.ruby-lang.org (Postfix) with ESMTPS id 0DFDF1204EE for ; Wed, 23 Dec 2015 12:15:10 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=X49it/2ptuPmelyo0Mtn6kebOK8=; b=T4DLNkT0rSG2YVNLIJ BS9NrjKnIisu9UDLHntHjFYuh0PZqT9lBcWSAsJBGfdDhfjrateDQbsnY00NaLzA AH3bUlY3M79cUXe0QYBNYNbmm4FEsA5QuY+Btv9c3fTBs0FwHoIJ0/Y6G2w1e9Io 75y3FIx1oh8Zp6eVgwuNdnqxI= Received: by filter0551p1mdw1.sendgrid.net with SMTP id filter0551p1mdw1.4466.567A11B91F 2015-12-23 03:15:05.529699948 +0000 UTC Received: from herokuapp.com (ec2-54-226-203-109.compute-1.amazonaws.com [54.226.203.109]) by ismtpd0006p1iad1.sendgrid.net (SG) with ESMTP id mxNSdg0FRrmQfUDzILdAOA for ; Wed, 23 Dec 2015 03:15:05.545 +0000 (UTC) Date: Wed, 23 Dec 2015 03:15:05 +0000 From: nobu@ruby-lang.org To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 47051 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 11864 X-Redmine-Issue-Author: breadtk X-Redmine-Sender: nobu X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS6VE32YBhbMQUZdm3v5STN/ii1PsMPVHKyaxG 3v0RqjFnJo49jEMwYEGM8qlM/j5dFvKYZ7HtUxivnWWgldJsmoOk42lummOTW7Y07TMglGnDFCCq3c oQhaxvO1x+iQrPOG/nceo96RqNzO+jPYHdZfKY5h0zBUnxh1qXvkVbWLEw== X-ML-Name: ruby-core X-Mail-Count: 72451 Subject: [ruby-core:72451] [Ruby trunk - Bug #11864] Resolv incorrectly accepts invalid hostnames and caches records between sessions X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #11864 has been updated by Nobuyoshi Nakada. Correction. The previous result was when VPN is connected, and the answer seemed a list of private addresses over VPN. After disconnecting the VPN, an empty list returned. I'm not sure if this is your case, however, check your network environment. ---------------------------------------- Bug #11864: Resolv incorrectly accepts invalid hostnames and caches records between sessions https://bugs.ruby-lang.org/issues/11864#change-55743 * Author: Osman Surkatty * Status: Third Party's Issue * Priority: Normal * Assignee: * ruby -v: ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14] * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- Hello, While working on a DNS related project I noticed that Resolv's `getaddresses()` and `getaddress()` functions will incorrectly accepts an empty `String` and additionally returns a cached record if a new IRB session is invoked. `Resolv` correctly rejects nil or empty arguments, but I believe the issue here is that the validation of `String` should require at a minimum a single valid String character. Here is an example of what I mean: ~~~ruby $ irb irb(main):001:0> RUBY_VERSION => "2.2.3" irb(main):002:0> require 'resolv' => true irb(main):003:0> Resolv.getaddresses("surkatty.org") => ["54.244.9.126"] irb(main):004:0> Resolv.getaddresses("example.com") => ["93.184.216.34"] irb(main):005:0> Resolv.getaddresses("NX") => [] irb(main):006:0> Resolv.getaddresses("") => ["54.244.9.126"] irb(main):007:0> Resolv.getaddresses() ArgumentError: wrong number of arguments (0 for 1) from /usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/resolv.rb:48:in `getaddresses' from (irb):7 from /usr/local/bin/irb:11:in `
' irb(main):008:0> ~~~ On line 006:0, I would have expected `Resolv.getaddresses("")` to return either: 1. Raise an `ArgumentError` or some other indicating an invalid `String` was passed 2. Return an empty `Array` I've also attached a screenshot from my commandline showing the output between IRB sessions as well. ---Files-------------------------------- dns.png (71.5 KB) -- https://bugs.ruby-lang.org/