RT 4.0.22
[freeside.git] / rt / t / security / CVE-2011-4460-rows-per-page.t
1 use strict;
2 use warnings;
3
4 use RT::Test tests => undef;
5
6 plan skip_all => 'valid SQL only on mysql'
7     unless RT->Config->Get('DatabaseType') eq 'mysql';
8
9 my ($base, $m) = RT::Test->started_ok;
10 ok $m->login, "logged in";
11
12 my $t = RT::Ticket->new( RT->SystemUser );
13 $t->Create(
14     Queue   => 1,
15     Subject => 'seed',
16 );
17 ok $t->id, 'created seed ticket';
18
19 my $root = RT::User->new( RT->SystemUser );
20 $root->Load('root');
21 my $password = $root->__Value('Password');
22 ok $password, 'pulled hashed password from db';
23
24 my $sql = q[1 union select 1+id as id, 1+id as EffectiveId, 1 as Queue, 'ticket' as Type, 0 as IssueStatement, 0 as Resolution, 12 as Owner, Password as Subject, 0 as InitialPriority, 0 as FinalPriority, 0 as Priority, 0 as TimeEstimated, 0 as TimeWorked, Name as Status, 0 as TimeLeft, null as Told, null as Starts, null as Started, null as Due, null as Resolved, 0 as LastUpdatedBy, null as LastUpdated, 6 as Creator, null as Created, 0 as Disabled from Users];
25 RT::Interface::Web::EscapeURI(\$sql);
26
27 $m->get_ok("$base/Search/Results.html?Format=id,Subject,Status;Query=id%3E0;OrderBy=|;Rows=$sql");
28 $m->content_lacks($password, "our password hash doesn't show up!");
29 $m->warning_like(qr/isn't numeric/);
30
31 undef $m;
32 done_testing;