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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
b578b2ae
Commit
b578b2ae
authored
Oct 06, 2014
by
Simon Green
Committed by
David Lawrence
Oct 06, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 1054702: CSV export vulnerable to formulae injection
r=glob,a=glob
parent
a92eee1c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
Template.pm
Bugzilla/Template.pm
+3
-1
report-table.csv.tmpl
template/en/default/reports/report-table.csv.tmpl
+5
-3
No files found.
Bugzilla/Template.pm
View file @
b578b2ae
...
@@ -711,10 +711,12 @@ sub create {
...
@@ -711,10 +711,12 @@ sub create {
},
},
# In CSV, quotes are doubled, and any value containing a quote or a
# In CSV, quotes are doubled, and any value containing a quote or a
# comma is enclosed in quotes.
# comma is enclosed in quotes. If a field starts with an equals
# sign, it is proceed by a space.
csv
=>
sub
csv
=>
sub
{
{
my
(
$var
)
=
@_
;
my
(
$var
)
=
@_
;
$var
=
' '
.
$var
if
substr
(
$var
,
0
,
1
)
eq
'='
;
$var
=~
s/\"/\"\"/g
;
$var
=~
s/\"/\"\"/g
;
if
(
$var
!~
/^-?(\d+\.)?\d*$/
)
{
if
(
$var
!~
/^-?(\d+\.)?\d*$/
)
{
$var
=
"\"$var\""
;
$var
=
"\"$var\""
;
...
...
template/en/default/reports/report-table.csv.tmpl
View file @
b578b2ae
...
@@ -23,11 +23,13 @@
...
@@ -23,11 +23,13 @@
[% END %]
[% END %]
[% tbl_field_disp FILTER csv %]: [% tbl_disp FILTER csv %]
[% tbl_field_disp FILTER csv %]: [% tbl_disp FILTER csv %]
[% END %]
[% END %]
[% IF row_field %]
[% IF row_field && col_field %]
[% row_field_disp _ ' / ' _ col_field_disp FILTER csv %]
[% ELSIF row_field %]
[% row_field_disp FILTER csv %]
[% row_field_disp FILTER csv %]
[% ELSE %]
[% col_field_disp FILTER csv %]
[% END %]
[% END %]
[% " / " IF col_field AND row_field %]
[% col_field_disp FILTER csv %]
[% IF col_field -%]
[% IF col_field -%]
[% FOREACH col = col_names -%]
[% FOREACH col = col_names -%]
[% colsepchar %]
[% colsepchar %]
...
...
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