[5.1] Catch block for generic TUF exceptions #43477
Merged
+30
−2
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.
Pull Request for Issue #43328
Summary of Changes
This PR adds a generic catch block that catches exceptions thrown in the TUF library. So far, we only caught attack-specific exceptions, internal errors, or errors related to metadata syntax error remained uncaught, making the site unusable.
Furthermore, it catches non-tuf exceptions from the HTTP library in our transport and converts them into TUF exceptions to also get them caught in the fetcher library.
Testing Instructions
We have to simulate an exception in the library in order to verify that the patch works. To do so, find the following code block in libraries/src/TUF/TufFetcher.php:
and replace it with
Actual result BEFORE applying this Pull Request
Unhandled exception.
Expected result AFTER applying this Pull Request
Proper system message shown, system remains usable.
Link to documentations
Please select:
Documentation link for docs.joomla.org:
[x ] No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
[x ] No documentation changes for manual.joomla.org needed