feat: enforce operation scope for tool invocations and improve credential attribution#272
Merged
Merged
Conversation
…ove SAM/domain parsing **Added:** - Enforced operation scope for single-IP tool calls by installing `ares_tools::scope` in orchestrator and worker entrypoints - Introduced `ares-tools::scope` module to restrict tool calls to authorized IPs, with environment-driven configuration and validation logic - Added `scope::validate_in_scope` check to tool dispatch to reject out-of-scope targets before execution - Implemented deduplication of adjacent labels in FQDNs during nmap parsing to clean up self-named workgroup hostnames - Added comprehensive tests for operation scope logic, FQDN deduplication, and secrets parsing behaviors **Changed:** - Updated nmap output parser to collapse duplicate first labels in FQDNs, preventing malformed hostnames from propagating - Improved secretsdump parser to recognize both impacket and nxc/netexec SAM section markers, ensuring correct attribution of local users - Refined logic for distinguishing between local SAM and domain accounts in secretsdump parser: - Default to local SAM for unmarked sections unless the user is a machine account or krbtgt - In local SAM sections, always strip computer name prefix from usernames, preventing accidental domain attribution - Provided additional tests for edge cases involving SAM, domain, and machine account handling **Removed:** - Eliminated silent inheritance of `target_domain` for unmarked custom user rows in secretsdump parser to prevent local users from being attributed to AD scope
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #272 +/- ##
==========================================
+ Coverage 75.99% 76.06% +0.06%
==========================================
Files 386 387 +1
Lines 84059 84347 +288
==========================================
+ Hits 63881 64157 +276
- Misses 20178 20190 +12
🚀 New features to boost your workflow:
|
**Added:** - Add `OperationScope::from_raw` for direct payload parsing without environment access - Add `install_from_env` to atomically read and install operation scope from environment, returning the installed scope for logging and testability - Add `validate_against` for pure validation against arbitrary scopes, decoupling from global state for testability - Expand tests to cover `from_raw`, `install_from_env`, and validation edge cases with more granular checks **Changed:** - Update orchestrator and worker startup to use the new scope install/parse helpers, improving clarity and testability - Refactor `validate_in_scope` to delegate to `validate_against` for better separation of concerns - Refactor existing scope parsing logic to use `from_raw` and streamline environment handling - Improve test coverage and structure for scope parsing and validation **Removed:** - Remove redundant call to `init_scope` in worker tool executor, now handled by `install_from_env`
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.
Key Changes:
ares_tools::scopemodule with comprehensive testsAdded:
ares_tools::scope) that restricts tool invocations to explicitly authorized IPs; includesOperationScopestruct, scope initialization, and validation logicChanged:
Removed: