Skip to content

Conversation

JimSycurity
Copy link
Contributor

@JimSycurity JimSycurity commented Jul 31, 2025

Description

Add PropertyNames enum which is generated from cue as /packages/csharp/graphschema/PropertyNames.cs

Motivation and Context

per Rohan

How Has This Been Tested?

Ran dotnet tests, built SHC, used that to build SHFOSS, collected with SHFoss and ingested into BHE. All function properly.

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
    • Introduced a centralized collection of property name constants for improved consistency across the application.

@JimSycurity JimSycurity self-assigned this Jul 31, 2025
Copy link

coderabbitai bot commented Jul 31, 2025

Walkthrough

A new static class, PropertyNames, has been introduced in the SharpHoundCommon.Enums namespace. This class contains numerous public constant string fields, each representing a property name used throughout the application. The file is auto-generated and intended to centralize property key definitions, reducing the use of hardcoded strings.

Changes

Cohort / File(s) Change Summary
Property Name Constants
src/CommonLib/Enums/PropertyNames.cs
Added a static class PropertyNames with many public constant string fields for property names; file is auto-generated and should not be edited manually.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

In fields of code, where properties grow,
A rabbit hops where constants now flow.
No more strings adrift, all names in one place,
With PropertyNames class, we quicken our pace.
Auto-generated, tidy, and neat—
This carrot of order is quite the treat! 🥕

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch propertynames

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 generate unit tests to generate unit tests for 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.

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: 0

🧹 Nitpick comments (2)
src/CommonLib/Enums/PropertyNames.cs (2)

1-3: Emit the standard <auto-generated/> header and GeneratedCode attribute

Many analyzers (StyleCop / Roslyn) automatically skip files that contain the
// <auto-generated/> marker or are decorated with
[System.CodeDom.Compiler.GeneratedCode], preventing style / documentation
warnings on generated sources.
Adding them costs nothing and keeps future CI noise down.

-// Code generated by Cuelang code gen. DO NOT EDIT!
-// Cuelang source: github.com/specterops/bloodhound/-/tree/main/packages/cue/schemas/
+// <auto-generated/>
+// Code generated by Cuelang code gen. DO NOT EDIT!
+// Cuelang source: github.com/specterops/bloodhound/-/tree/main/packages/cue/schemas/
+
+using System.CodeDom.Compiler;
 ...
-namespace SharpHoundCommon.Enums {
-public static class PropertyNames {
+namespace SharpHoundCommon.Enums {
+[GeneratedCode("cuelang-codegen", "1.0.0")]
+public static class PropertyNames {

4-160: Const vs static readonly – consider binary-compat risk

All fields are declared const. Because const values are inlined at compile
time
, any external assembly that references, say,
PropertyNames.SubjectAltRequireUPN will embed the literal
"subjectaltrequireupn" in its own IL. If the cUE schema ever changes and this
constant string is updated, every downstream assembly must be re-compiled or it
will silently keep the outdated literal.

If the generated class is consumed solely inside the same solution this may be
a non-issue, but for a public package it is safer to use:

public static readonly string SubjectAltRequireUPN = "subjectaltrequireupn";

You still get inlining by the JIT but avoid cross-assembly versioning pitfalls.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 852fe9b and abf8431.

📒 Files selected for processing (1)
  • src/CommonLib/Enums/PropertyNames.cs (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: MikeX777
PR: SpecterOps/SharpHoundCommon#223
File: src/CommonLib/OutputTypes/Group.cs:8-8
Timestamp: 2025-07-10T20:04:21.305Z
Learning: In SharpHoundCommonLib, there are two distinct types of classes with different naming patterns:
1. OutputTypes classes (Group, User, Computer) that inherit from OutputBase use "HasSIDHistory" property naming
2. Property classes (GroupProperties, UserProperties, ComputerProperties) used in processors use "SidHistory" property naming
These should not be compared for naming consistency as they serve different purposes.
📚 Learning: in sharphoundcommonlib, there are two distinct types of classes with different naming patterns: 1. o...
Learnt from: MikeX777
PR: SpecterOps/SharpHoundCommon#223
File: src/CommonLib/OutputTypes/Group.cs:8-8
Timestamp: 2025-07-10T20:04:21.305Z
Learning: In SharpHoundCommonLib, there are two distinct types of classes with different naming patterns:
1. OutputTypes classes (Group, User, Computer) that inherit from OutputBase use "HasSIDHistory" property naming
2. Property classes (GroupProperties, UserProperties, ComputerProperties) used in processors use "SidHistory" property naming
These should not be compared for naming consistency as they serve different purposes.

Applied to files:

  • src/CommonLib/Enums/PropertyNames.cs
📚 Learning: the schemaidguid for the altsecurityidentities attribute in active directory is 00fbf30c-91fe-11d1-a...
Learnt from: JonasBK
PR: SpecterOps/SharpHoundCommon#221
File: src/CommonLib/Processors/ACEGuids.cs:17-18
Timestamp: 2025-07-08T11:07:35.680Z
Learning: The schemaIDGUID for the altSecurityIdentities attribute in Active Directory is 00fbf30c-91fe-11d1-aebc-0000f80367c1, as confirmed by Microsoft documentation.

Applied to files:

  • src/CommonLib/Enums/PropertyNames.cs
🧬 Code Graph Analysis (1)
src/CommonLib/Enums/PropertyNames.cs (3)
src/CommonLib/SecurityDescriptor.cs (1)
  • IsInherited (30-33)
src/CommonLib/DirectoryObjects/DirectoryObjectExtensions.cs (2)
  • IsDeleted (50-56)
  • HasLAPS (58-70)
src/CommonLib/Processors/DomainTrustProcessor.cs (1)
  • TrustType (115-130)
⏰ 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). (1)
  • GitHub Check: build
🔇 Additional comments (1)
src/CommonLib/Enums/PropertyNames.cs (1)

76-78: Confirm CUE Schema Spelling for SubjectAltRequireDomainDNS

We’ve verified that the code and tests consistently use the key "subjectaltrequiredomaindns" (missing the extra “d” after “require”):

  • src/CommonLib/Enums/PropertyNames.cs
  • src/CommonLib/Processors/LdapPropertyProcessor.cs
  • test/unit/LdapPropertyTests.cs (line 819)

Before renaming this to "subjectaltrequireddomaindns", please cross-check the CUE schema to ensure that clients expect the same spelling. If the schema defines the key with two “d”s, update the constant, the processor call, and the unit test to match. Otherwise, no change is needed here.

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.

1 participant