Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens handling of the bug “URL” field (bug_file_loc) by preventing unsafe-scheme URLs from being rendered as clickable links and by adding server-side validation that rejects disallowed schemes on create/update (with a dedicated user/webservice error).
Changes:
- Add allowlist-based validation for
bug_file_loc(and a newbug_file_loc_invaliduser/webservice error) to reject unsafe URL schemes while allowing existing unsafe stored values to remain editable for other fields. - Update multiple templates (core + InlineHistory + BugModal) to render unsafe
bug_file_locvalues as plain text rather than clickable links. - Move
SAFE_URL_REGEXPintoBugzilla::Constantsand add webservice regression tests for unsafe URL schemes.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| template/en/default/global/user-error.html.tmpl | Adds a user-facing error message for invalid bug_file_loc URLs. |
| template/en/default/bug/edit.html.tmpl | Stops rendering unsafe bug_file_loc values as clickable links in the edit UI. |
| qa/t/webservice_bug_create.t | Adds webservice tests asserting unsafe URL schemes are rejected for url. |
| extensions/InlineHistory/template/en/default/hook/bug/comments-aftercomments.html.tmpl | Prevents unsafe bug_file_loc values from being linked in inline history output. |
| extensions/BugModal/web/bug_modal.js | Removes the client-side unsafe-URL click confirmation logic. |
| extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl | Renders unsafe bug_file_loc as non-clickable text in BugModal edit view. |
| extensions/BugModal/template/en/default/bug_modal/activity_stream.html.tmpl | Renders unsafe bug_file_loc as non-clickable text in BugModal activity stream. |
| Bugzilla/WebService/Constants.pm | Adds a webservice error code mapping for bug_file_loc_invalid. |
| Bugzilla/Template.pm | Removes the local SAFE_URL_REGEXP helper (now sourced from constants). |
| Bugzilla/Constants.pm | Exports SAFE_URL_REGEXP for shared use across templates and server validation. |
| Bugzilla/Bug.pm | Implements server-side validation for bug_file_loc using the shared safe-URL logic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.
r+ carried over from private pull request