Repository navigation
fix(plugins): a malformed blocklist refresh keeps the last good list - #1569
Merged
Merged
Conversation
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
The plugin blocklist is how the hosted registry withdraws a plugin: a listed plugin is turned off and can't be loaded or installed again.
registry::parse_blocklistread any JSON that wasn't an array, or an object with ablockedarray, as an empty list, and so did a list whose entries had noid. A refresh that received{},{"blocked": {}}or{"blocked": [{}]}cleared every withdrawal. For the hosted registry,store::save_blocklistalso wrote that body over the cachedblocklist.json, so a later start began with no withdrawals too.blockedis an array, any entry whoseidisn't a plugin id, and any entry whosesha256, when given, isn't a SHA-256 hash (either would match nothing). Nosha256, ornull, still withdraws every version. A refused entry is named by its position, and its reason is cut short, since it can quote what the network sent.save_blocklistparses before it writes or applies anything, so on an error the list in force and the cached file both stay as they were. That matches what already happens when the blocklist can't be fetched.[]or{"blocked": []}.plugin.registryandplugin.installFromRegistry(fetch_registry) and the Plugin Manager warn that the blocklist couldn't be read, with the reason, and that the last blocklist read, if any, stays in force. Before, the callers dropped the error. They warn the same way when the hosted registry's blocklist can't be downloaded. The hosted registry always publishes one. Another registry may have none (it blocks nothing), so its failed download stays quiet.idholding one would match nothing).plugin.registryandplugin.installFromRegistrysay which plugins a newly withdrawn list turned off, in one notice, as the Plugin Manager already did.load_installed's errors, which the app shows and the command line prints, rather than being ignored. Until the next fetch, no withdrawals apply from such a cache, where the good part of it used to. In Python,rustgis.load_plugins()returns this report.Session(plugins=True)still discards what it returns, as it does for every plugin load error.Testing
blocked_plugins_are_unloaded_and_refusednow also feeds the hosted registry'ssave_blocklist{},{"blocked": {}},{"blocked": null},1, an entry without anid,[1], a good entry followed by a bad one, asha256that isn't a hash, and anidthat isn't a plugin id (two forms). Each one is refused, and the withdrawn plugin stays blocked. Onmain,{}succeeds and clears the list.[]and{"blocked": []}still read as empty lists.cached_blocklist_survives_refused_refreshes: refused refreshes leave the cached hosted blocklist byte for byte, and a cache that can't be read is reported byload_installed.registries_and_blocklists_are_read_defensively: a list of exactly 100,000 entries reads whole, and one more is refused. A very long id, or a very long string where an entry should be, gives a short error.unreadable_plugin_blocklist_warns:plugin.registryagainst a local registry warns once when its blocklist is{"blocked": {}}, naming the blocklist and the reason, and says nothing when it is{"blocked": []}. The notice is a warning. It also checks that a blocklist that isn't text is refused with a warning, and that one withdrawing a loaded plugin names it in a notice and unloads it.cargo clippy -p rustgis-plugins -p rustgis-engine -p rustgis-ui-egui --all-targets -- -D warnings,cargo test -p rustgis-pluginscargo xtask ci, thewasm32-unknown-unknownbuild ofrustgis-web, and the pre-commit hooks, on 9bf272e.Related issue
None: found while reviewing the plugin registry code.
🤖 Generated with Claude Code
Summary by CodeRabbit