Repository navigation
Conversation
…jo API POST /rest/invalid_bug_helper/close/<id> is now served by the native controller Bugzilla::Extension::InvalidBugHelper::API::V1::InvalidBugHelper instead of the legacy REST server. Same path, parameters, checks and response, mark_as_spam must now be a boolean. The legacy WebService module and its webservice hook are removed, and the extension test now goes through the real route.
GET /rest/bitly/shorten and GET /rest/bitly/list are now served by the native controller
Bugzilla::Extension::Bitly::API::V1::Bitly instead of the legacy REST server.
Same paths, url parameter, checks and {url} response.
The legacy WebService module and its webservice hook are removed, and a test covers
both routes.
… API GET /rest/prod_comp_search/find/<search> and GET /rest/prod_comp_search/frequent are now served by the native controller Bugzilla::Extension::ProdCompSearch::API::V1::ProdCompSearch instead of the legacy REST server. Same paths, limit parameter, queries and responses. The legacy WebService module and its webservice hook are removed, and a test covers both routes.
GET /rest/editcomments/comment[/<id>], PUT /rest/editcomments/comment/<id> and PUT /rest/editcomments/revision are now served by the native controller Bugzilla::Extension::EditComments::API::V1::EditComments instead of the legacy REST server. Same paths, parameters, checks and responses and is_hidden must now be a boolean (true/false/1/0). The legacy WebService module and its webservice hook are removed, and a test covers the four routes.
…ojo API GET and POST /rest/component-watching, GET and DELETE /rest/component-watching/<id> are now served by the native controller Bugzilla::Extension::ComponentWatching::API::V1::ComponentWatching instead of the legacy REST server. Same paths, parameters, checks and responses, except that product_access_denied now names the product (it was passed as product instead of name, so the message showed ''). The Preferences page gets the same fix. The legacy WebService module and its webservice hook are removed, and a test covers the four routes. rest_legacy_credentials.t moves to GET /rest/bug_modal/initial_field_values, still on the legacy server.
GET /rest/mydashboard/run_bug_query, run_flag_query and run_last_changes, and PUT /rest/mydashboard/bug_interest_unmark (also still served without the prefix) are now served by the native controller Bugzilla::Extension::MyDashboard::API::V1::MyDashboard instead of the legacy REST server. Same paths, parameters, checks and responses. The two query methods still read from the shadow database. The legacy WebService module and its webservice hook are removed, and a test covers the five routes.
query_flags meant to accept only requestee and requester, but its check (ne || ne) was always true, so any other type was treated as requester and returned under that key. It now throws param_invalid, and Queries.pm imports Bugzilla::Error, which that error path never needed before.
GET /rest/phabbugz/check_bug/<bug_id>/<user_id>, GET /rest/phabbugz/check_enter_bug/<product>/<user_id>, GET /rest/phabbugz/bug_revisions/<bug_id> and GET /rest/phabbugz/user/<user_id> are now served by the existing native controller Bugzilla::Extension::PhabBugz::API::V1::PhabBugz instead of the legacy REST server. Same paths, checks and responses. The three read-only ones still use the shadow database. The legacy WebService module and its webservice hook are removed, and webservice.t now calls the routes.
GET /rest/review/suggestions (by bug ID, product, product/component or query params) and GET /rest/review/flag_activity (by flag ID, type name, requestee, setter, type ID or query params) are now served by the native controller Bugzilla::Extension::Review::API::V1::Review instead of the legacy REST server. Same paths, parameters, checks and responses, include_fields and exclude_fields included. The legacy WebService module and its webservice hook are removed, and a test covers both methods.
GET /rest/bug_modal/initial_field_values, product_info, edit/<id>, cc/<id>, comment_tags/<id> and new_product/<id>, and PUT /rest/bug_modal/update_comment_tags/<id> are now served by the native controller Bugzilla::Extension::BugModal::API::V1::BugModal instead of the legacy REST server. Same paths, parameters, checks and responses. A bug id sent as a hash is now refused, as on the core bug routes. The legacy WebService module and its webservice hook are removed, and a test covers the seven routes. rest_legacy_credentials.t is deleted: no resource is left on the legacy REST server.
On a GET, the legacy REST server kept the id from the path even when the query string had one, and only a PUT body or query string replaced it. The controller let a query-string id win on GET too, so GET /rest/bug_modal/edit/5?id=6 answered for bug 6. The path id wins again on GET, which also makes the hash id check unneeded, so it is removed.
…required The legacy route matched /prod_comp_search/find/ with an empty search and returned the param_required error. The *search placeholder needed at least one character, so it was a 404. The placeholder now defaults to ''.
The legacy route matched /review/flag_activity/requestee/ (and setter/, type_id/) with an empty value, which was then ignored. The *value placeholder made it a 404. The placeholder now defaults to ''.
dklawren
requested changes
Nov 19, 2026
…board run_last_changes
…allers and mandatory groups
There was a problem hiding this comment.
🟡 Changes recommended
Authorization checks against a lagging shadow database can continue granting access after permissions are revoked and expose revision and reviewer metadata.
5 open issues
Run bug-permission checks against the primary database · New Run product-entry authorization checks against the primary database · New Run bug-visibility checks against the primary database · New Preserve OPTIONS handlers for migrated API routes · New Reject non-boolean JSON references before writing · New
What changed in this PR
Migrates nine extensions’ remaining legacy REST resources to native Mojo controllers, completing the endpoint migration needed before the legacy REST server can be removed.
Changes:
- Replaces legacy WebService registrations with native routes and JSON responses.
- Tightens selected parameter validation and corrects ComponentWatching product errors.
- Adds or rewrites route-level tests and removes the legacy credential test.
| File | Description |
|---|---|
qa/t/rest_legacy_credentials.t |
Removes legacy password-authentication tests. |
extensions/Review/t/bmo/review-api.t |
Tests reviewer suggestions and flag-history routes. |
extensions/Review/lib/WebService.pm |
Removes the legacy Review service. |
extensions/Review/lib/API/V1/Review.pm |
Adds native suggestions and flag-history routes. |
extensions/Review/Extension.pm |
Removes legacy service registration. |
extensions/ProdCompSearch/t/bmo/prod-comp-search.t |
Tests search and frequent-component routes. |
extensions/ProdCompSearch/lib/API/V1/ProdCompSearch.pm |
Migrates product/component searches to Mojo. |
extensions/ProdCompSearch/Extension.pm |
Removes legacy service registration. |
extensions/PhabBugz/t/bmo/webservice.t |
Exercises migrated routes with simulated Phabricator responses. |
extensions/PhabBugz/lib/WebService.pm |
Removes the legacy PhabBugz service. |
extensions/PhabBugz/lib/API/V1/PhabBugz.pm |
Adds permission, revision, and account routes. |
extensions/PhabBugz/Extension.pm |
Removes legacy service registration. |
extensions/MyDashboard/t/bmo/mydashboard-api.t |
Tests dashboard queries, visibility, and interest removal. |
extensions/MyDashboard/lib/Queries.pm |
Rejects unsupported flag-query types. |
extensions/MyDashboard/lib/API/V1/MyDashboard.pm |
Migrates dashboard routes and preserves the unprefixed alias. |
extensions/MyDashboard/Extension.pm |
Removes legacy service registration. |
extensions/InvalidBugHelper/t/bmo/invalid-bug-helper.t |
Converts invalid-bug checks to route-level tests. |
extensions/InvalidBugHelper/lib/API/V1/InvalidBugHelper.pm |
Migrates bug closing and adds boolean coercion. |
extensions/InvalidBugHelper/Extension.pm |
Removes legacy service registration. |
extensions/EditComments/t/bmo/editcomments-api.t |
Tests comment editing, visibility, and revision routes. |
extensions/EditComments/lib/WebService.pm |
Removes the legacy comment-editing service. |
extensions/EditComments/lib/API/V1/EditComments.pm |
Adds native routes, path-ID precedence, and boolean coercion. |
extensions/EditComments/Extension.pm |
Removes legacy service registration. |
extensions/ComponentWatching/t/bmo/component-watching-api.t |
Tests watch creation, retrieval, ownership, and deletion. |
extensions/ComponentWatching/lib/WebService.pm |
Removes the legacy component-watching service. |
extensions/ComponentWatching/lib/API/V1/ComponentWatching.pm |
Adds native watch-management routes. |
extensions/ComponentWatching/Extension.pm |
Fixes product error arguments and removes registration. |
extensions/BugModal/t/bmo/bug-modal-api.t |
Tests bug-page routes and access checks. |
extensions/BugModal/lib/API/V1/BugModal.pm |
Migrates bug-page data and comment-tag routes. |
extensions/BugModal/Extension.pm |
Removes legacy service registration. |
extensions/Bitly/t/bmo/bitly.t |
Tests URL routes with a simulated Bitly service. |
extensions/Bitly/lib/API/V1/Bitly.pm |
Migrates URL-shortening routes to Mojo. |
extensions/Bitly/Extension.pm |
Removes legacy service registration. |
Review effort: Balanced
| my ($self) = @_; | ||
| Bugzilla->usage_mode(USAGE_MODE_MOJO_REST); | ||
| my $user = $self->_login || return; | ||
| Bugzilla->switch_to_shadow_db(); |
Collaborator
There was a problem hiding this comment.
Could probably just remove Bugzilla->switch_to_shadow_db() completely and accomplish the same thing.
| my ($self) = @_; | ||
| Bugzilla->usage_mode(USAGE_MODE_MOJO_REST); | ||
| my $user = $self->_login || return; | ||
| Bugzilla->switch_to_shadow_db(); |
| $self->_check_phabricator(); | ||
|
|
||
| my $user = $self->_login || return; | ||
| Bugzilla->switch_to_shadow_db(); |
Comment on lines
+23
to
+26
| $r->get('/component-watching')->to($to . 'list'); | ||
| $r->post('/component-watching')->to($to . 'add'); | ||
| $r->get('/component-watching/:id' => [id => qr/\d+/])->to($to . 'get'); | ||
| $r->delete('/component-watching/:id' => [id => qr/\d+/])->to($to . 'remove'); |
Collaborator
There was a problem hiding this comment.
Let's make sure we add OPTIONS for any migrated code that needs it.
Comment on lines
+104
to
+106
| if ($error = coerce_booleans($params, 'is_hidden')) { | ||
| return $self->user_error('invalid_params', {type_error => $error}); | ||
| } |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Moves the REST endpoints that extensions still registered through the
webservicehook from the legacy REST server to native Mojo controllers (extensions/<Name>/lib/API/V1/<Name>.pm), one commit per extension. Paths, parameters and responses stay the same, except for the changes listed below.Last step of 2057358 before the legacy REST server can be removed in 2081819: no resource is left on it after this PR.
Changes
lib/WebService.pmandwebservicehook: InvalidBugHelper, Bitly, ProdCompSearch, EditComments, ComponentWatching, MyDashboard, PhabBugz (added to its existing controller), Review, BugModal.mark_as_spam(InvalidBugHelper) andis_hidden(EditComments) must now be booleans (true/false/1/0).comment_idsent with aPUTno longer replaces the one in the path.run_flag_queryrefuses atypeother thanrequesteeorrequester, which it used to treat asrequester.qa/t/rest_legacy_credentials.tis removed, as no endpoint is left on the legacy server.t/bmotests in each extension call the routes.Test plan
enter_bug.cgiReferences