Skip to content

Conversation

@mykeelium
Copy link
Contributor

@mykeelium mykeelium commented Jul 21, 2025

Description

This change adds locations where machines could be logged into the compstatus.csv.

Motivation and Context

Helps to add possible locations for logging computers that were connected to in collection. This should hopefully log the situation that is occurring in ticket BED-5935

How Has This Been Tested?

This has been tested by creating executables and ensure these new locations logged in a lab environment.

Screenshots (if appropriate):

Types of changes

  • Chore (a change that does not modify the application functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • Documentation updates are needed, and have been made accordingly.
  • I have added and/or updated tests to cover my changes.
  • All new and existing tests passed.
  • My changes include a database migration.

Summary by CodeRabbit

  • New Features
    • Added real-time status reporting for computer-related tasks, providing immediate feedback on successful operations during computer name resolution and processing.
    • Enhanced visibility into processing steps for Enterprise CA and various producer components with asynchronous success notifications.
  • Bug Fixes
    • Improved reliability of task status updates by ensuring status messages are sent consistently across different processing steps.

@mykeelium mykeelium self-assigned this Jul 21, 2025
@mykeelium mykeelium added bug Something isn't working question Further information is requested blocked by SHC PR A SharpHoundCommon PR must be merged in first before this PR labels Jul 21, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 21, 2025

Walkthrough

The changes introduce a new Channel<CSVComputerStatus> parameter to several producer and processing classes, updating their constructors and relevant method signatures. Status messages indicating successful computer SID resolutions are now asynchronously written to this channel in multiple locations, enabling more granular status reporting during directory and certificate authority processing.

Changes

File(s) Change Summary
src/Producers/BaseProducer.cs Added protected readonly CompStatusChannel field; updated constructor to accept and assign this channel.
src/Producers/ComputerFileProducer.cs, src/Producers/LdapProducer.cs, src/Producers/StealthProducer.cs Updated constructors to accept and pass Channel<CSVComputerStatus>; added status reporting after SID resolution in relevant methods (Produce, FindPathTargetSids).
src/Runtime/CollectionTask.cs Updated instantiations of producer classes to pass the new channel parameter.
src/Runtime/ObjectProcessors.cs Updated ProcessEnterpriseCA and its call site to accept and use the new channel for status reporting.

Sequence Diagram(s)

sequenceDiagram
    participant CollectionTask
    participant StealthProducer
    participant ComputerFileProducer
    participant LdapProducer
    participant CompStatusChannel

    CollectionTask->>StealthProducer: new StealthProducer(..., CompStatusChannel)
    CollectionTask->>ComputerFileProducer: new ComputerFileProducer(..., CompStatusChannel)
    CollectionTask->>LdapProducer: new LdapProducer(..., CompStatusChannel)

    StealthProducer->>CompStatusChannel: Write CSVComputerStatus on SID resolution
    ComputerFileProducer->>CompStatusChannel: Write CSVComputerStatus on SID resolution
Loading
sequenceDiagram
    participant ObjectProcessors
    participant CompStatusChannel

    ObjectProcessors->>ObjectProcessors: ProcessEnterpriseCA(..., CompStatusChannel)
    ObjectProcessors->>CompStatusChannel: Write CSVComputerStatus on CA SID resolution
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~40 minutes

Poem

A channel for status, a hop and a bound,
Now every computer’s success is easily found.
With SIDs resolved and messages sent,
The code grows more clear wherever it went.
🐇✨
Status updates now flow,
Like carrots in rows!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 001f11d and a6ba1a5.

📒 Files selected for processing (1)
  • src/Runtime/ObjectProcessors.cs (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/Runtime/ObjectProcessors.cs
✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@mykeelium mykeelium changed the title feat: Add CompStatus Writing Locations Add CompStatus Writing Locations Jul 21, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/Runtime/ObjectProcessors.cs (2)

705-711: Good implementation with minor consistency suggestion.

The status reporting logic is well-implemented with proper error handling and cancellation token usage.

Consider using the constant StatusSuccess (defined at line 26) instead of ComputerStatus.Success for consistency with other status reporting in the codebase.

-                Status = ComputerStatus.Success,
+                Status = StatusSuccess,

734-740: Consistent implementation with the same minor suggestion.

The status reporting logic is correctly implemented and mirrors the previous block appropriately.

Same suggestion as above: consider using the StatusSuccess constant for consistency.

-            Status = ComputerStatus.Success,
+            Status = StatusSuccess,
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cda9597 and 68cf919.

📒 Files selected for processing (6)
  • src/Producers/BaseProducer.cs (1 hunks)
  • src/Producers/ComputerFileProducer.cs (2 hunks)
  • src/Producers/LdapProducer.cs (1 hunks)
  • src/Producers/StealthProducer.cs (2 hunks)
  • src/Runtime/CollectionTask.cs (1 hunks)
  • src/Runtime/ObjectProcessors.cs (4 hunks)
🔇 Additional comments (8)
src/Producers/BaseProducer.cs (2)

27-27: LGTM: Well-structured addition of CompStatusChannel field.

The new protected readonly field follows the established pattern of other channel fields in the class.


29-34: LGTM: Constructor properly updated to handle new channel parameter.

The constructor signature and field assignment are correctly implemented, maintaining consistency with existing channel handling patterns.

src/Runtime/CollectionTask.cs (1)

57-61: LGTM: Consistent channel propagation to all producer types.

All producer constructors are correctly updated to receive the _compStatusChannel parameter, ensuring unified status reporting across Stealth, ComputerFile, and LDAP producers.

src/Producers/LdapProducer.cs (1)

15-18: LGTM: Constructor properly updated for base class compatibility.

The constructor correctly accepts and passes the compStatusChannel parameter to the base class, maintaining architectural consistency even though LdapProducer doesn't currently write status messages.

src/Producers/StealthProducer.cs (1)

28-31: LGTM: Constructor properly updated to accept compStatusChannel.

The constructor correctly accepts and passes the compStatusChannel parameter to the base class constructor.

src/Producers/ComputerFileProducer.cs (2)

20-23: LGTM: Constructor properly updated with compStatusChannel parameter.

The constructor correctly accepts and passes the compStatusChannel parameter to the base class constructor, maintaining consistency with other producer classes.


71-78: LGTM: Well-implemented status reporting on successful host resolution.

The status writing logic is correctly placed after successful host-to-SID resolution and properly uses the cancellation token. The task string accurately identifies the producer and method.

src/Runtime/ObjectProcessors.cs (1)

95-95: LGTM: Method signature update is consistent.

The method signature change properly adds the compStatusChannel parameter and the call site is updated accordingly. This follows the established pattern from other processing methods.

Also applies to: 661-662

@mykeelium mykeelium removed the blocked by SHC PR A SharpHoundCommon PR must be merged in first before this PR label Jul 21, 2025
@mykeelium mykeelium merged commit db3a7e2 into 2.X Jul 23, 2025
2 checks passed
@mykeelium mykeelium deleted the mcuomo/BED-5935 branch July 23, 2025 19:59
@github-actions github-actions bot locked and limited conversation to collaborators Jul 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Something isn't working question Further information is requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants