-
Notifications
You must be signed in to change notification settings - Fork 279
fix: filter out edges from graph search BED-6940 #2200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughReplaces the previous GraphNodes-only representation with a combined GraphRecords (nodes or edges) type, updates the SearchCurrentNodes component to accept GraphRecords and filter out edge-like entries when flattening nodes, and extends test fixtures to include an example edge record. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used🧠 Learnings (6)📓 Common learnings📚 Learning: 2025-09-08T19:01:53.112ZApplied to files:
📚 Learning: 2025-09-08T19:22:49.284ZApplied to files:
📚 Learning: 2025-08-27T15:10:29.731ZApplied to files:
📚 Learning: 2025-11-06T21:35:45.118ZApplied to files:
📚 Learning: 2025-07-17T16:26:22.455ZApplied to files:
🧬 Code graph analysis (1)packages/javascript/bh-shared-ui/src/components/SearchCurrentNodes/SearchCurrentNodes.tsx (2)
🔇 Additional comments (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
packages/javascript/bh-shared-ui/src/components/SearchCurrentNodes/SearchCurrentNodes.test.tsxpackages/javascript/bh-shared-ui/src/components/SearchCurrentNodes/SearchCurrentNodes.tsxpackages/javascript/bh-shared-ui/src/components/SearchCurrentNodes/types.ts
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-09-08T19:01:53.112Z
Learnt from: jvacca-specterops
Repo: SpecterOps/BloodHound PR: 1823
File: packages/javascript/bh-shared-ui/src/views/Explore/ExploreSearch/CypherSearch.tsx:108-148
Timestamp: 2025-09-08T19:01:53.112Z
Learning: In BloodHound's CypherSearch component (packages/javascript/bh-shared-ui/src/views/Explore/ExploreSearch/CypherSearch.tsx), the sharing state reset for sharedIds and isPublic after the two-step permissions update is handled elsewhere in the codebase, so additional state reset callbacks in the updateQueryPermissions function are not needed.
Applied to files:
packages/javascript/bh-shared-ui/src/components/SearchCurrentNodes/SearchCurrentNodes.tsxpackages/javascript/bh-shared-ui/src/components/SearchCurrentNodes/SearchCurrentNodes.test.tsx
📚 Learning: 2025-08-27T19:22:50.905Z
Learnt from: jvacca-specterops
Repo: SpecterOps/BloodHound PR: 1823
File: packages/javascript/bh-shared-ui/src/views/Explore/ExploreSearch/SavedQueries/CommonSearches.tsx:71-74
Timestamp: 2025-08-27T19:22:50.905Z
Learning: In BloodHound's CommonSearches component (packages/javascript/bh-shared-ui/src/views/Explore/ExploreSearch/SavedQueries/CommonSearches.tsx), the useEffect that resets filteredList to queryList when userQueries.data changes is intentional behavior - filters should be cleared when the underlying saved queries data updates.
Applied to files:
packages/javascript/bh-shared-ui/src/components/SearchCurrentNodes/SearchCurrentNodes.tsx
📚 Learning: 2025-09-08T19:22:49.284Z
Learnt from: jvacca-specterops
Repo: SpecterOps/BloodHound PR: 1823
File: packages/javascript/bh-shared-ui/src/views/Explore/ExploreSearch/SavedQueries/TagToZoneLabelDialog.tsx:34-35
Timestamp: 2025-09-08T19:22:49.284Z
Learning: In BloodHound's TagToZoneLabelDialog component (packages/javascript/bh-shared-ui/src/views/Explore/ExploreSearch/SavedQueries/TagToZoneLabelDialog.tsx), importing AssetGroupTag type from 'js-client-library' to type tag shapes is incorrect - this type should not be used for typing tags in this context.
Applied to files:
packages/javascript/bh-shared-ui/src/components/SearchCurrentNodes/SearchCurrentNodes.test.tsx
🧬 Code graph analysis (3)
packages/javascript/bh-shared-ui/src/components/SearchCurrentNodes/SearchCurrentNodes.tsx (1)
packages/javascript/bh-shared-ui/src/components/SearchCurrentNodes/types.ts (1)
FlatNode(17-17)
packages/javascript/bh-shared-ui/src/components/SearchCurrentNodes/types.ts (1)
packages/javascript/js-client-library/src/types.ts (4)
GraphEdge(396-405)GraphNodes(394-394)GraphNode(381-390)GraphEdges(407-407)
packages/javascript/bh-shared-ui/src/components/SearchCurrentNodes/SearchCurrentNodes.test.tsx (2)
packages/javascript/bh-shared-ui/src/components/SearchCurrentNodes/types.ts (2)
GraphNodes(46-46)GraphEdges(47-47)packages/javascript/js-client-library/src/types.ts (2)
GraphNodes(394-394)GraphEdges(407-407)
🪛 GitHub Actions: Build UI
packages/javascript/bh-shared-ui/src/components/SearchCurrentNodes/SearchCurrentNodes.tsx
[error] 45-45: ESLint: '_' is defined but never used. (no-unused-vars)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Build BloodHound Container Image / Build and Package Container
- GitHub Check: run-tests
- GitHub Check: run-analysis
🔇 Additional comments (3)
packages/javascript/bh-shared-ui/src/components/SearchCurrentNodes/types.ts (2)
30-44: GraphEdge type definition looks correct for UI graph representation.The structure with
id1,id2, and arrow configurations is appropriate for UI graph rendering. Note that this differs from the GraphEdge injs-client-library/src/types.tswhich usessource/targetfields, but both serve different purposes (UI rendering vs API/domain model).
46-47: Remove the unusedGraphEdgestype definition or clarify its purpose.The
GraphEdgestype exported fromSearchCurrentNodes/types.ts(line 47) is never imported or used anywhere in the codebase. Either remove it as dead code or add documentation if it's intended for future use. Note: TheGraphNodespattern (Record-based) is used locally and differs from js-client-library's array-based design, but sinceGraphEdgesisn't used, this is not a data flow issue.Likely an incorrect or invalid review comment.
packages/javascript/bh-shared-ui/src/components/SearchCurrentNodes/SearchCurrentNodes.tsx (1)
49-59: Mapping logic correctly transforms node data to FlatNode.The three-case transformation handles:
- Direct GraphNode objects with
objectId- Graph data with nested
dataandlabelstructures- Fallback for malformed entries
This approach properly accommodates the different node shapes that may appear in
currentNodes.
packages/javascript/bh-shared-ui/src/components/SearchCurrentNodes/SearchCurrentNodes.test.tsx
Outdated
Show resolved
Hide resolved
packages/javascript/bh-shared-ui/src/components/SearchCurrentNodes/SearchCurrentNodes.test.tsx
Show resolved
Hide resolved
packages/javascript/bh-shared-ui/src/components/SearchCurrentNodes/SearchCurrentNodes.tsx
Show resolved
Hide resolved
6de2843 to
5d201bd
Compare
10b075f to
a3b88db
Compare
a3b88db to
ef69254
Compare
TheNando
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Description
Adds a filter stage to the
SearchCurrentNodescomponent to filter out edges from the list of nodes.Motivation and Context
Resolves BED-6940
Why is this change required? What problem does it solve?
How Has This Been Tested?
Screenshots (optional):
Types of changes
Checklist:
Summary by CodeRabbit
New Features
Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.