Closed Bug 2074854 Opened 5 hours ago Closed 3 minutes ago

i_am_webservice() does not recognize USAGE_MODE_MOJO_REST

Categories

(bugzilla.mozilla.org :: API, defect)

Production
defect

Tracking

()

RESOLVED FIXED

People

(Reporter: xavier.lhour, Unassigned)

Details

Attachments

(1 file)

Bugzilla::Util::i_am_webservice() returns true for USAGE_MODE_JSON and USAGE_MODE_REST, but not for USAGE_MODE_MOJO_REST. The native Mojolicious REST endpoints (Bugzilla/API/V1/*) are therefore treated as browser requests by all call sites.

Two consequences matter:

  1. Bugzilla/Template.pm:866: the error_message filter wraps to 72 columns "if we're not in the WebService", so any native REST error message over 72 characters comes back with embedded \n's in the JSON response

  2. extensions/RestrictComments/Extension.pm:58: object_end_of_set_all force-clears restrict_comments on every bug update made through a native REST endpoint unless the caller passes the field explicitly. This affects Bugzilla/API/V1/Github.pm:364 and extensions/PhabBugz/lib/API/V1/PhabBugz.pm:235

Other call sites (MFA and password-reset redirects in Bugzilla.pm and Bugzilla/Auth.pm, Quicksearch shortcuts) are also wrong for API requests. The Bugzilla::Auth::Login::* ones are unreachable, since native REST authenticates via Bugzilla/App/Plugin/Login.pm.

Authored by https://github.com/Xzzz
https://github.com/mozilla/bmo/commit/3ae92b83dc873157fb283cbcf280ee49fdc39617
[master] Bug 2074854 - Recognize USAGE_MODE_MOJO_REST as a webservice mode in i_am_webservice

Status: UNCONFIRMED → RESOLVED
Closed: 3 minutes ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: