Ostorlab / oxo

OXO is a security scanning orchestrator for the modern age.
https://oxo.ostorlab.co
Apache License 2.0
529 stars 52 forks source link

Fix emitting non-exact out selectors. #801

Closed 3asm closed 2 months ago

3asm commented 2 months ago

out-selectors enable a hierarchical logic to receive and emit messages. If an agent list listens to v3.report then he will receive all messages like v3.report, v3.report.vulnerability, v3.report.xxx.

If an agent states out-selector, he should in the same fashion be able to emit all sub-messages.

The current implementation was doing an exact match:

ostorlab.agent.agent.NonListedMessageSelectorError

Fix switch to startswith check:


        if (
            any(
                out_selector.startswith(selector) for out_selector in self.out_selectors
            )
            is True
        ):
```.

Unit test checks for both should and should not emit case.
codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 90.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 62.73%. Comparing base (f50390c) to head (61fa2e9). Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
tests/agent/agent_test.py 89.47% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #801 +/- ## ========================================== + Coverage 62.68% 62.73% +0.04% ========================================== Files 340 340 Lines 14210 14229 +19 ========================================== + Hits 8907 8926 +19 Misses 5303 5303 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.