Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RT 61792 CVE-2011-2201 #1

Open
dnmfarrell opened this issue Jan 26, 2017 · 1 comment
Open

RT 61792 CVE-2011-2201 #1

dnmfarrell opened this issue Jan 26, 2017 · 1 comment
Labels

Comments

@dnmfarrell
Copy link
Owner

This bug appears to be active on the RT queue and at first glance, the patch seems to be unapplied to the code. This needs to be reviewd and applied if it's still required.

diff -up Data-FormValidator-4.66/lib/Data/FormValidator/Results.pm.orig 
Data-FormValidator-4.66/lib/Data/FormValidator/Results.pm
--- Data-FormValidator-4.66/lib/Data/FormValidator/Results.pm.orig      
2010-02-24 15:31:03.000000000 +0100
+++ Data-FormValidator-4.66/lib/Data/FormValidator/Results.pm   2011-08-
28 08:26:22.000000000 +0200
@@ -807,7 +807,7 @@ sub _create_sub_from_RE {
             # With methods, the value is the second argument
             my $val = $force_method_p ? $_[1] : $_[0];
             my ($match) = scalar ($val =~ $re);
-            if ($untaint_this && defined $match) {
+            if ($untaint_this && $match) {
                 # pass the value through a RE that matches anything to 
untaint it.
                 my ($untainted) = ($&  =~ m/(.*)/s);
                 return $untainted;
diff -up Data-FormValidator-4.66/t/untaint_match_check.t.orig Data-
FormValidator-4.66/t/untaint_match_check.t
--- Data-FormValidator-4.66/t/untaint_match_check.t.orig        2011-08-
28 08:26:54.000000000 +0200
+++ Data-FormValidator-4.66/t/untaint_match_check.t     2011-08-28 
08:26:30.000000000 +0200
@@ -0,0 +1,22 @@
+use strict;
+use warnings;
+
+use Test::More tests => 3;
+
+use Data::FormValidator;
+
+"unrelated match" =~ /match/;
+
+my $result = Data::FormValidator->check(
+    { a => 'invalid value' },    # input data
+    {                            # validation profile
+        untaint_all_constraints => 1,
+        optional                => ['a'],
+        constraints             => { a => qr/never matches/, },
+    },
+);
+
+ok( not $result->success )
+    or diag( 'Valid: ', $result->valid );
+ok( $result->has_invalid );
+is_deeply( scalar($result->invalid), { 'a' => [ qr/never matches/ ] } 
    );
dnmfarrell added a commit that referenced this issue Jan 26, 2017
@dnmfarrell dnmfarrell added the bug label Jan 26, 2017
@dnmfarrell
Copy link
Owner Author

I've applied the patch in a branch and the final test doesn't pass: DFV does not return an arrayref of constraints. I think the patch is probably valid, but reveals another bug within DFV.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant