Open Bug 1057875 Opened 10 years ago Updated 9 years ago

reports.cgi can't handle whitespace in bug status

Categories

(Bugzilla :: Reporting/Charting, defect)

4.4.5
defect
Not set
normal

Tracking

()

People

(Reporter: mva, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Firefox/31.0 (Beta/Release)
Build ID: 20140804192227

Steps to reproduce:

If a bug status with whitespace (e.g. "Approval Needed") is used in a bugzilla installation, selecting the dataset in reports.cgi (Old Charts) will result in an "Invalid datasets Approval Needed. Only digits, letters and colons are allowed." error.

1) Create a bug status "Approval Needed"
2) execute collectstats.pl to update the datasets
3) Select Reports -> Old charts
4) Select "Approval Needed" from the Chart datasets
5) Click Continue


Actual results:

The error message "Invalid datasets Approval Needed. Only digits, letters and colons are allowed." occurs


Expected results:

A chart should be printed. As it seems, the regexp in reports.cgi, line 84ff

if (grep { $_ !~ /^[A-Za-z0-9:_-]+$/ } @datasets) {
        ThrowUserError('invalid_datasets', {'datasets' => \@datasets});
}

does not permit whitespace. This should be changed.
Confirmed. The security checks for old charts should be refactored a bit. The regexp you mention in your comment 0 also doesn't understand Unicode characters. It was written well before admins were allowed to customize the bug statuses and resolutions. One of the reasons nobody paid attention to this is because bug 232113 suggests to kill old charts entirely.
Status: UNCONFIRMED → NEW
Ever confirmed: true
After some investigation of bug 419014, which introduced the limitation, I assume that this won't cause a security risk, since bug 419014 tackled a different issue with guessing URLS and accessing chart information. Since those are (somewhat) fixed, allowing whitespace characters in the form

if (grep { $_ !~ /^[A-Za-z0-9:_-\s]+$/ } @datasets) {
        ThrowUserError('invalid_datasets', {'datasets' => \@datasets});
}

should not be a problem, not?
You need to log in before you can comment on or make changes to this bug.