1 Reply Latest reply on May 29, 2013 2:38 AM by ryanuber

    validate_option_hash is filtering IPv4 addresses

    chirauki

      Hi all,

       

      I couldn't find anything related, so let me know if this is duplicated.

       

      Using boxgrinder:

       

      [root@localhost ~]# gem list | grep boxgrinder

      boxgrinder-build (0.10.4)

      boxgrinder-core (0.3.14)

       

      I'm trying to write a delivery plugin that involves sending the deliverables to another host. If I pass a hostname as destination it works, but if I supply an IPv4 address, I only get the first 2 bytes of it, ie. Passing "192.168.1.1" results in "192.168". Looking at the source for boxgrinder-build script I found that there is a function that validates the options (validate_options_hash, line 45):

       

      ...

            elsif v =~ /^([-+]?([0-9][0-9_]*)?\.[0-9.]*([eE][-+][0-9]+)?)$/

              v = v.to_f

            end

      ...

       

      I've tested this regexp and it matches an IPv4 address, so what I get is a cast to a float and this strips out the last two bytes of the IP. Am I missing something? Should I provide the IP address in some way different to plain text (ie. scaped or something)?

       

      Regards,

      Marc.