Repository navigation
Bug 2081819 - Remove the legacy REST server - #2842
Merged
Merged
Conversation
Every REST resource is now served by a native Mojo controller, so rest.cgi and the JSON-RPC based server behind it have nothing left to serve. - Delete rest.cgi, Bugzilla::WebService::Server::REST and Bugzilla::WebService::Server::JSONRPC, the routes sending /rest, /rest/* and /rest.cgi/* to them, the preload, and their FEATURE_FILES entries - Any other path under /rest or /rest.cgi now goes to a native route that returns the same rest_invalid_resource error (404, code 32614) rest.cgi returned - Remove the JSON-RPC errors only that server threw - t/app-cgi-request-limit.t: the oversized POST to /rest/version is answered by the new route, without the legacy x-bugzilla-login CORS header.
BMO.getBugsConfirmer, BMO.getBugsVerifier and Example.hello only served JSON-RPC which is gone. Removed them, the webservice and webservice_rest_resources hook subs that registered them.
Nothing fires the webservice, webservice_before_call, webservice_rest_request, webservice_rest_resources, and webservice_rest_response hooks any more: they were called by the legacy REST/JSON-RPC server. - Removed WS_DISPATCH, which ran the webservice hook, and Bugzilla::WebService::Server::handle_login, which ran webservice_before_call - Removed their documentation in Bugzilla::Hook and the Example extension's subs webservice_error_codes and webservice_status_code_map stay, as native API errors, webservice_bug_get, webservice_bug_render_comment and webservice_user_get still use them.
With the legacy server gone, the native API only used two helpers from these modules. - Move wants_object and datetime_format_inbound into Bugzilla::API::V1::Util, for Bugzilla::API::V1::Bug. - Delete Bugzilla::WebService, Bugzilla::WebService::Server, Bugzilla::WebService::Util (fix_credentials, taint_data) and the README, with t/webservice-fix-credentials.t and the webservice_fix_credentials hook. The native login keeps the header precedence, covered by qa/t/rest_native_login.t. - Remove the JSON-RPC usage and error modes (USAGE_MODE_JSON, ERROR_MODE_JSON_RPC) and REST_CONTENT_TYPE_WHITELIST, which nothing uses any more.
…gone - general.md: the API only returns JSON (JSONP was a legacy server feature), and the authentication section no longer refers to the legacy authentication path. - The get_bug rate limit no longer covers JSON-RPC.
…rrors Native /rest routes start in USAGE_MODE_REST and only switch to USAGE_MODE_MOJO_REST in their handler. A ThrowUserError or ThrowCodeError before that still went to the legacy REST error path, which needs the JSON-RPC server object that only rest.cgi created, so it ended in a 500 (Bugzilla::App::Plugin::Login switched modes by hand to avoid it). - Bugzilla::Error now switches such errors to USAGE_MODE_MOJO_REST, so the Mojo error plugin renders them as JSON like any native API error, and the legacy path and Bugzilla->_json_server are removed. - The Mojo error plugin runs the webservice_error_codes hook, which only that legacy path ran, so extensions can still give their errors a code. - New test in t/app-api-load.t.
Collaborator
|
A comment at Bugzilla/App/Plugin/Login.pm:67 still mentions rest.cgi. That file isn't in this PR, but was flagged by review. Possible fix: change that line to "(which is what produces account_disabled in the web UI)". |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the removal of the legacy REST stack.
No open issues 🎉
What changed in this PR
Removes the legacy REST server now that all REST resources use native Mojo controllers, continuing the API migration tracked by bug 2057358.
Changes:
- Deletes the legacy REST/JSON-RPC stack, extension dispatch code, and obsolete hooks.
- Adds native unknown-resource handling and routes early REST errors through JSON error rendering.
- Moves shared helpers into the native API utility module and updates tests and documentation.
| File | Description |
|---|---|
template/en/default/global/user-error.html.tmpl |
Removes obsolete JSON-RPC error messages. |
template/en/default/admin/params/admin.html.tmpl |
Removes JSON-RPC from rate-limit help text. |
t/webservice-fix-credentials.t |
Deletes tests for removed credential handling. |
t/app-login-disabled-account.t |
Updates comments about error handling. |
t/app-cgi-request-limit.t |
Updates fallback expectations and removes a legacy header assertion. |
t/app-api-load.t |
Tests unknown resources and early REST errors. |
rest.cgi |
Deletes the legacy REST entry point. |
qa/t/rest_native_login.t |
Updates the credential-precedence comment. |
extensions/Example/lib/WebService.pm |
Deletes the legacy example service. |
extensions/Example/Extension.pm |
Removes legacy service hooks. |
extensions/BMO/lib/WebService.pm |
Deletes the legacy BMO service. |
extensions/BMO/Extension.pm |
Removes legacy service registration. |
docs/en/md/api/core/v1/general.md |
Updates JSON format and authentication documentation. |
Bugzilla/WebService/Util.pm |
Deletes legacy credential and taint helpers. |
Bugzilla/WebService/Server/REST.pm |
Deletes the legacy REST server. |
Bugzilla/WebService/Server/JSONRPC.pm |
Deletes the JSON-RPC server and JSONP support. |
Bugzilla/WebService/Server.pm |
Deletes the legacy server base class. |
Bugzilla/WebService/README |
Deletes obsolete architecture documentation. |
Bugzilla/WebService/Constants.pm |
Removes legacy dispatch and protocol constants. |
Bugzilla/WebService.pm |
Deletes the legacy service base module. |
Bugzilla/Util.pm |
Removes JSON-RPC usage-mode detection. |
Bugzilla/Install/Requirements.pm |
Removes deleted servers from feature-file mappings. |
Bugzilla/Hook.pm |
Removes documentation for obsolete hooks. |
Bugzilla/Error.pm |
Sends early REST errors through Mojo handling. |
Bugzilla/Constants.pm |
Removes JSON-RPC usage and error modes. |
Bugzilla/CGI.pm |
Removes the built-in rest.cgi path-info exception. |
Bugzilla/App/Plugin/Login.pm |
Updates comments for native-only error handling. |
Bugzilla/App/Plugin/Error.pm |
Applies extension error-code mappings to native errors. |
Bugzilla/App/Controller/CGI.pm |
Removes REST routing and CGI-specific REST handling. |
Bugzilla/App/Controller/API.pm |
Adds native unknown-resource fallback routes. |
Bugzilla/App.pm |
Removes legacy server loading and preloading. |
Bugzilla/API/V1/Util.pm |
Adds shared date-conversion and field-selection helpers. |
Bugzilla/API/V1/BugUserLastVisit.pm |
Updates the parameter-precedence comment. |
Bugzilla/API/V1/Bug.pm |
Uses helpers moved into native API utilities. |
Bugzilla.pm |
Removes legacy server state and JSON-RPC mode handling. |
Review effort: Balanced
dklawren
approved these changes
Nov 24, 2026
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
Removes the legacy REST server (
rest.cgi,Bugzilla::WebService::Server::RESTand the JSON-RPC code under it) and theBugzilla::WebServicebase modules, now that every REST resource is served by a native Mojo controller.Part of 2057358: since 2094122 moved the last extension resources to native controllers, nothing is left on the legacy server.
Changes
/restor/rest.cgiwithout a native route returns the samerest_invalid_resourceerror as before (404, code 32614).Accept: application/javascriptwithcallback) is gone: it was only supported by the legacy server./restroute before its handler starts is now returned as a JSON API error instead of a 500.webservice,webservice_before_call,webservice_fix_credentials,webservice_rest_request,webservice_rest_resources,webservice_rest_response.webservice_error_codesnow applies to native API errors.wants_objectanddatetime_format_inboundmove toBugzilla::API::V1::Util;Bugzilla::WebService::ConstantsandBugzilla::WebService::Wantsstay.Not carried over
JSON::RPCandTest::Taintdependencies and thejsonrpc/restfeatures inMakefile.PL: templates still checkfeature_enabled('jsonrpc')for user autocompletion and comment tags, so they are left for a follow-up.Test plan
GET /rest/no_such_resourceandGET /rest.cgi/bug/1return a JSON 404 with code 32614GET /rest/bug/<id>still works, with and without an API keyReferences