Skip to content

fix(engine): describe the rules of plugins given as instances - #277

Merged
SizzleUnrlsd merged 2 commits into
mainfrom
fix/rules-of-given-plugins
Oct 23, 2026
Merged

SizzleUnrlsd merged 2 commits into
mainfrom
fix/rules-of-given-plugins

Conversation

@SizzleUnrlsd

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #274. With Plugin.rules, a plugin describes the rules it reports, and the SARIF report passes the descriptions to its consumers. A check, however, gathered them only from the plugins it loaded from plugin roots. A plugin given to analyze_project as an instance (plugins=[...]) still reported its findings, but its rules reached the report by id alone.

The descriptions now come from every plugin of the check, in this order: the engine's own rules, then the loaded plugins', then those of the plugins given as instances. When several declare the same id, the first declaration is kept.

Commit Change
fix(engine): describe the rules of plugins given as instances rule_descriptions takes the plugins of the check instead of the registry; the test of an instance's rule
test(rules): keep a loaded plugin's description of a rule an instance describes too the order of precedence

Tests

The new file tests/test_rule_descriptions_of_given_plugins.py holds 2 tests. Before the fix:

  • the first fails with KeyError: 'quiet-rule';
  • the second passes, and pins the existing order.

No existing test changes.

Compatibility

engine.rule_descriptions now takes plugins instead of a PluginRegistry. Nothing calls it outside engine.py, in this repository or in the Enterprise plugins. Plugin.rules is not released yet, so the changelog entry of #274 covers this.

Verification

Python 3.12, on main at 8e9e944:

  • ruff check . and mypy: clean on each commit;
  • unit suite: 2,575 passed on the first commit, 2,576 on the second;
  • regression: 19 of 19;
  • Enterprise plugins: 978 passed.

A check gathered the rule descriptions of the plugins it loaded from plugin
roots only. A plugin given to analyze_project as an instance reported its
findings, but its rules reached the report by id alone. The descriptions now
come from every plugin of the check, loaded ones first, then those given as
instances, the first declaration of an id kept.
… describes too

A plugin given as an instance that describes command-injection again does not
replace the description of the bundled plugin, loaded before it.
@SizzleUnrlsd SizzleUnrlsd added the bug Something isn't working label Oct 22, 2026
@SizzleUnrlsd SizzleUnrlsd self-assigned this Oct 22, 2026
@SizzleUnrlsd
SizzleUnrlsd merged commit abd028c into main Oct 23, 2026
10 checks passed
@SizzleUnrlsd
SizzleUnrlsd deleted the fix/rules-of-given-plugins branch October 23, 2026 00:21
@SizzleUnrlsd
SizzleUnrlsd restored the fix/rules-of-given-plugins branch October 23, 2026 00:22
@SizzleUnrlsd
SizzleUnrlsd deleted the fix/rules-of-given-plugins branch October 23, 2026 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant