Skip to content

Fixed issue with source ID and groups that could assign wrong severity#879

Merged
chrismaddalena merged 5 commits intomasterfrom
hotfix/fixed-bhe-findings
Apr 23, 2026
Merged

Fixed issue with source ID and groups that could assign wrong severity#879
chrismaddalena merged 5 commits intomasterfrom
hotfix/fixed-bhe-findings

Conversation

@chrismaddalena
Copy link
Copy Markdown
Collaborator

Adjustment to fix cases where a BHE finding could be grouped incorrectly.

Copilot AI review requested due to automatic review settings April 22, 2026 22:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (sourceid vs source_id) and used it in severity calculation + principal entries.
  • Updated enterprise finding grouping logic to dedupe principals by (source_id, target_id) instead of only target_id.
  • Extended BloodHound client tests to cover the source_id variant and distinct source/target pairing behavior; added Severity fixtures needed by get_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.

Comment thread ghostwriter/shepherd/external/bloodhound/client.py
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.19%. Comparing base (a328fd2) to head (79b8cbd).
⚠️ Report is 6 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@chrismaddalena chrismaddalena merged commit 58b4833 into master Apr 23, 2026
11 checks passed
@chrismaddalena chrismaddalena deleted the hotfix/fixed-bhe-findings branch April 23, 2026 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants