Chris: There's two seperate issues. I'm willing to let you do whatever
you want for severity with the regex/non-strict on, but the case where
anything trying to find the version has to execute it as code is
extremely dangerous.
For starters, it means you can Denial of Service any system that uses
the interpreter to find the version.
while ( 1 ) { $_++ } our $VERSION = '0.01';
or
use Nuclear::Weapon; our $VERSION = fire('1.2.3');
This includes things like PAUSE.
Or slightly less bad, the version becomes unstable.
There are real world examples on #perl from the last month or so where a
module is reporting the wrong version because it loaded some other
module that had been updated, but it hadn't.
This, obviously produced a large dose of confusion.
Realising this, POE is switching from repository/regex to static on the
next release (I believe from Rocco) and SVK is moving from dynamic
$VERSION = $Other::Module::VERSION to static versions, because they've
had similar problems with modules reporting wrongly.
It's your software and your call, but for the case where the version
line loads in or runs arbitrary code, this is seriously nasty stuff, and
a ton of people that try it end up being bitten.
Adam K
Chris Dolan via RT wrote:
Show quoted text> <URL:
http://rt.cpan.org/Ticket/Display.html?id=20439 >
>
> On Jul 13, 2006, at 1:41 AM, Guest via RT wrote:
>
>> ...
>> So I propose two policies.
>>
>> Firstly, ProhibitTaintedVersion, which requires the $VERSION
>> declaration
>> line contains a single statement, and that this statement doesn't
>> have
>> an use calls, variables, or anything else that might be untaint-safe.
>>
>> This needs to be at the strongest possible setting, as it creates all
>> sorts of problems.
>>
>> And a second ProhibitDynamicVersion, which requires that versions are
>> simple $VERSION = '...' things, that will always be the same on every
>> installation, and in every repository, for every author.
>>
>> This is bad, but not so urgent... one or two notches back from the
>> maximum would be fine.
>>
>> Adam K
>
> Adam,
>
> Thanks. I've added variations of these to the TODO list as
> "VariablesAndExpressions::RequireConstantVersion" and
> "VariablesAndExpressions::ProhibitComplexVersion" (although one could
> argue that they belong in the P::C::P::Modules:: namespace). I agree
> with your distaste for dynamic $VERSION but I disagree with your
> recommendations for severity. Our plan is to reserve highest
> severity for non-controversial policies (i.e. ones that everyone
> agrees should be enforced). I think your proposed policies are not
> going to be appreciated by all, so I've recommended lower severities
> in the TODO list.
>
> Chris
>
> --
> Chris Dolan, Software Developer,
http://www.chrisdolan.net/
> Public key:
http://www.chrisdolan.net/public.key
> vCard:
http://www.chrisdolan.net/ChrisDolan.vcf
>
>
>