http://www.perlmonks.org?node_id=980444


in reply to Re^6: Security issue and solution for terminal command accessed by public user
in thread Security issue and solution for terminal command accessed by public user

If the information is for the OP, offer it as a reply to the OP, not me!

And just how restricting the arguments to the program, to their exact range of legal values, limiting?

If you think throwing whatever garbage or carefully calculated input a (potentially malicious) user chooses to supply, at a shell and trusting to luck that there are no flaws in the quoting done by those modules, is an effective security mechanism, you are somewhat less than a dick. You are a fool!

I thought everyone knew that the *only* secure method of doing the is to only allow that which is safe.

Trying to "sanitise" user input has been the downfall of many a system. And with fools like you around, it will long continue that way.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

  • Comment on Re^7: Security issue and solution for terminal command accessed by public user

Replies are listed 'Best First'.
Re^8: Security issue and solution for terminal command accessed by public user
by Anonymous Monk on Jul 07, 2012 at 07:06 UTC

    If the information is for the OP, offer it as a reply to the OP, not me!

    Its both

    And just how restricting the arguments to the program, to their exact range of legal values, limiting?

    It would require the Op to enumerate every possible legal input , even all the units, of which he says there are 2526; quoting is much simpler

    If you think throwing whatever garbage or carefully calculated input a (potentially malicious) user chooses to supply, at a shell and trusting to luck that there are no flaws in the quoting done by those modules, is an effective security mechanism, you are somewhat less than a dick. You are a fool!

    Its much better to badmouth them without investigation of any kind

    I thought everyone knew that the *only* secure method of doing the is to only allow that which is safe.

    Yup, and quoting , or avoiding the shell accomplishes this exactly

    Trying to "sanitise" user input has been the downfall of many a system. And with fools like you around, it will long continue that way.

    What, you've never heard of the `rm -rfv /` units?

      Its both

      Then if you are offering it as advice to me, I reserve the right to reject it. And explain why. Which I did.

      even all the units, of which he says there are 2526;

      I made it 2571. It took me exactly 6 minutes to locate the source; download the file; unzip it; locate definitions.units; load it into my editor; and run 5 regex substitutions and half-a-dozen manual fixups to isolate that list. Which I then pasted into the data section of a script:

      #! perl -slw use strict; use Time::HiRes qw[ time ]; my $start = time; my %units = map{ chomp; $_ , 1 } <DATA>; print time-$start; __DATA__ ...

      And it took a whole 7 milliseconds to load the hash:

      C:\test>junk3 0.00783705711364746
      Its much better to badmouth them without investigation of any kind
      1. I didn't bad mouth; just said that they were unnecessary.
      2. I did investigated String::ShellQuote.

        Enough to discover that as only supports BourneShell quoting, it would be useless to me or anyone who needs to support some other shell. Which would then require yet another module and trusting yet another author.

        And for long enough to know that it would take me days to convince myself that the author knew what he was doing; and much longer to convince myself he'd covered everything.

      As for IPC::System::Simple. I've investigated that before. And whilst I have seen modules that purport to be 'better' substitutes for built-ins that were more bloated, and/or more pointless, but there aren't many.

      Now that is bad mouthing if you wish to see it that way.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      The start of some sanity?

        Then if you are offering it as advice to me, I reserve the right to reject it. And explain why. Which I did.

        masterfully blusterous