in reply to
Re^2: magic-diamond <> behavior -- WHAT?!
in thread magic-diamond <> behavior -- WHAT?!
Allowing arbitrary execution of shell commands is a cardinal sin in security. Not only that, the magic-diamond does it implicitly. This goes beyond the realm of making "easy things easy, and hard things possible". This is a security-hole, IMHO.
It's no more a security hole than "system" is. Or a kitchen knife a murder weapon. Magic open was there before the fast majority of the current Perl programmers even knew there was such a thing as Perl, and it has been documented that way.
For example, would you ever expect the following to execute shell commands? Currently, it can.
I certainly don't. I see this as a read-only operation that prints to STDOUT, and I'd like to be able to assume so.
# strip "#"-till-EOL
perl -pe 's/#.*$//' *
Too bad. It isn't going to change. But with the addition of a single keystroke, that filter won't execute arbitrary shell commands. And IMO, it's always a good idea to enable tainting if you're running in an environment you cannot trust (but then, if you cannot trust the environment, is such a broad shell expansion a good idea in the first place?)
Let's lessen that impact -- the security and robustness benefits will exceed the gains of the obscure magic. Just my opinion.
Noted. But in my opinion, fundamentally changing the behaviour of a feature that predates the existence of perl5 doesn't justify the gain - specially not if the gain can be gotten by running with tainting on. Which even predates 3-arg open.
Doesn't it seem ridiculous to have ARGV::readonly instead of the inverse-situation of having (the fictional) ARGV::magical?
Not to me.