Fixed issue with source ID and groups that could assign wrong severity#879
Merged
chrismaddalena merged 5 commits intomasterfrom Apr 23, 2026
Merged
Fixed issue with source ID and groups that could assign wrong severity#879chrismaddalena merged 5 commits intomasterfrom
chrismaddalena merged 5 commits intomasterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes BloodHound Enterprise findings grouping so relationship findings are keyed consistently across sourceid/source_id variants and distinct source→target pairs are not merged, preventing incorrect severity rollups.
Changes:
- Added a
_get_source_id()helper to normalize BloodHound field-name variants (sourceidvssource_id) and used it in severity calculation + principal entries. - Updated enterprise finding grouping logic to dedupe principals by
(source_id, target_id)instead of onlytarget_id. - Extended BloodHound client tests to cover the
source_idvariant and distinct source/target pairing behavior; added Severity fixtures needed byget_enterprise_findings().
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| ghostwriter/shepherd/external/bloodhound/client.py | Normalizes source ID extraction and fixes grouping/deduping logic to avoid collapsing distinct relationship findings. |
| ghostwriter/shepherd/tests/test_bloodhound_client.py | Adds regression tests for source_id handling and ensures distinct principals are retained; seeds Severity rows required for output enrichment. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #879 +/- ##
==========================================
+ Coverage 92.82% 93.19% +0.36%
==========================================
Files 393 393
Lines 24908 24937 +29
==========================================
+ Hits 23122 23239 +117
+ Misses 1786 1698 -88 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Adjustment to fix cases where a BHE finding could be grouped incorrectly.