Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Ivlev
bugzilla
Commits
63640672
Commit
63640672
authored
Oct 06, 2014
by
Frédéric Buclin
Committed by
David Lawrence
Oct 06, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 1074980: Forbid the { foo => $cgi->param() } syntax to prevent data override
r=dkl,a=sgreen
parent
7b8e0ab4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
1 deletion
+32
-1
002goodperl.t
t/002goodperl.t
+32
-1
No files found.
t/002goodperl.t
View file @
63640672
...
...
@@ -16,7 +16,7 @@ use lib 't';
use Support::Files;
use Test::More tests => (scalar(@Support::Files::testitems) *
3
);
use Test::More tests => (scalar(@Support::Files::testitems) *
4
);
my @testitems = @Support::Files::testitems; # get the files to test.
...
...
@@ -110,4 +110,35 @@ foreach my $file (@testitems) {
close(FILE);
}
# Forbird the { foo => $cgi->param() } syntax, for security reasons.
foreach my $file (@testitems) {
$file =~ s/\s.*$//; # nuke everything after the first space (#comment)
next unless $file; # skip null entries
if (!open(FILE, $file)) {
ok(0, "could not open $file --WARNING");
next;
}
my $lineno = 0;
my @unsafe_args;
while (my $file_line = <FILE>) {
$lineno++;
$file_line =~ s/^\s*(.+)\s*$/$1/; # Remove leading and trailing whitespaces.
if ($file_line =~ /^[^#]+=> \$cgi\->param/) {
push(@unsafe_args, "$file_line on line $lineno");
}
}
if (@unsafe_args) {
ok(0, "$file incorrectly passes a CGI argument to a hash --ERROR\n" .
join("\n", @unsafe_args));
}
else {
ok(1, "$file has no vulnerable hash syntax");
}
close(FILE);
}
exit 0;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment