Closed Bug 402438 Opened 19 years ago Closed 19 years ago

Invalid deadlines can be set by unauthorized users

Categories

(Bugzilla :: Creating/Changing Bugs, defect)

3.1.2
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 3.2

People

(Reporter: LpSolit, Assigned: LpSolit)

References

Details

(Keywords: regression)

Attachments

(1 file)

Users not being in the TT group can pass deadline='' to process_bug.cgi. MySQL will convert it to 0000-00-00, which is not a valid date and makes Date::Format::time2str() to complain in BugMail.pm at line 182, also filling the web server error log with: Use of uninitialized value in localtime at /usr/lib/perl5/vendor_perl/5.8.8/Date/Format.pm line 123. When running PostgreSQL, the DB server doesn't accept '' at all and throws the following error: DBD::Pg::db do failed: ERREUR: Syntaxe en entrée invalide pour le type timestamp: « » [for Statement "UPDATE bugs SET deadline = ? WHERE bug_id = ?"] at Bugzilla/Object.pm line 263 Bugzilla::Object::update('Bugzilla::Bug=HASH(0x8d5417c)') called at Bugzilla/Bug.pm line 487 Bugzilla::Bug::update('Bugzilla::Bug=HASH(0x8d5417c)', '2007-11-04 16:14:34.629453+01') called at /var/www/html/bugzilla-pg/process_bug.cgi line 956 The reason I mark this bug as a blocker is that 1) it's a regression over 3.0.x and 2) it severely fills the web server log, which can be a perf issue as you can silently attack all bugs. I don't really know why Object->update() gets deadline = '' instead of deadline = undef. Max, any idea? It seems that _check_deadline() is correctly returning undef when you don't belong to the TT group, isn't it?
Flags: blocking3.1.3+
OK, I found what's wrong: $bug->deadline returns '' when the value in the DB is NULL. One easy way to check this is to run: perl -MBugzilla -MBugzilla::Bug -we 'my $bug = new Bugzilla::Bug(1); print defined $bug->deadline' The returned value is 1 (of course, bug 1 has no deadline set; I checked in the DB itself). And so $bug->set_deadline() sets the deadline field to '' instead of undef as _check_deadline() returns: my $current = ref $invocant ? $invocant->deadline : undef; return $current unless $tt_group && Bugzilla->user->in_group($tt_group); I suppose it's fine to have $bug->deadline return '' so that we get no concatenation error when using it, but we should fix _check_deadline() to return undef in that case.
Attached patch patch, v1 — — Splinter Review
Assignee: create-and-change → LpSolit
Status: NEW → ASSIGNED
Attachment #287314 - Flags: review?(mkanat)
Comment on attachment 287314 [details] [diff] [review] patch, v1 Looks good.
Attachment #287314 - Flags: review?(mkanat) → review+
Flags: approval+
Checking in Bugzilla/Bug.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Bug.pm,v <-- Bug.pm new revision: 1.214; previous revision: 1.213 done
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: