Skip to content

feat(netexec): including signature manager and expectation signature (#200)#245

Merged
guzmud merged 10 commits into
mainfrom
feature/200-inject-expectations
Jul 8, 2026
Merged

feat(netexec): including signature manager and expectation signature (#200)#245
guzmud merged 10 commits into
mainfrom
feature/200-inject-expectations

Conversation

@mariot

@mariot mariot commented Jun 2, 2026

Copy link
Copy Markdown
Member

Proposed changes

  • Adds ExpectationSignature support to the Netexec injector.

  • Registers ExpectationSignature as a contract output across all Netexec contract types

  • Integrates SignatureManager (from pyoaev feat/us-int-1-signature-lifecycle) into OpenAEVNetExecInjector:

    • Instantiated once on __init__
    • _build_target_meta() maps assets/asset groups from inject data
    • Compiles pre/post-execution signatures per run
    • Sends payloads for both DETECTION and PREVENTION expectation types
  • Adds NETEXEC_SIGNATURE_TYPES frozenset in signature_helper.py

Testing Instructions

  1. Step-by-step how to test
  2. Environment or config notes

Related issues

Checklist

  • I consider the submitted work as finished
  • I tested the code for its functionality
  • I wrote test cases for the relevant uses case
  • I added/update the relevant documentation (either on github or on notion)
  • Where necessary I refactored code to improve the overall quality
  • For bug fix -> I implemented a test that covers the bug

Further comments

@mariot mariot requested review from Megafredo and guzmud June 2, 2026 07:28
@mariot mariot self-assigned this Jun 2, 2026
@mariot mariot added filigran team Item from the Filigran team. do not merge Do not merge until this label is removed. feature Type: new feature or capability (feat:). labels Jun 2, 2026
@mariot mariot changed the title [netexec] feat(injector): including signature manager and expectation signature (#200) feat(netexec): including signature manager and expectation signature (#200) Jun 2, 2026
Comment thread netexec/netexec/openaev_netexec.py
Comment thread netexec/netexec/openaev_netexec.py Outdated
Comment thread netexec/netexec/helpers/signature_helper.py
Comment thread netexec/netexec/openaev_netexec.py Outdated
Comment thread netexec/netexec/openaev_netexec.py Outdated
@SamuelHassine SamuelHassine removed the feature Type: new feature or capability (feat:). label Jun 7, 2026
@mariot mariot force-pushed the feature/200-inject-expectations branch 2 times, most recently from 05e00e7 to 9b624de Compare June 8, 2026 15:52
@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.36585% with 6 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
netexec/netexec/openaev_netexec.py 83.78% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #245      +/-   ##
==========================================
+ Coverage   67.52%   68.07%   +0.55%     
==========================================
  Files          68       75       +7     
  Lines        3138     3352     +214     
==========================================
+ Hits         2119     2282     +163     
- Misses       1019     1070      +51     
Files with missing lines Coverage Δ
netexec/netexec/contracts/contract_outputs.py 100.00% <100.00%> (+24.00%) ⬆️
netexec/netexec/contracts/output_registry.py 100.00% <100.00%> (+20.00%) ⬆️
netexec/netexec/helpers/signature_helper.py 100.00% <100.00%> (ø)
netexec/netexec/openaev_netexec.py 68.78% <83.78%> (ø)

... and 6 files with indirect coverage changes

📢 Thoughts on this report? Let us know!

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@guzmud guzmud force-pushed the feature/200-inject-expectations branch from ac54aa9 to f3778a6 Compare June 25, 2026 07:23
Copilot AI review requested due to automatic review settings June 25, 2026 07:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds ExpectationSignature support to the NetExec injector by integrating the pyoaev SignatureManager into the execution lifecycle and declaring ExpectationSignature as an output element for all NetExec contracts, with accompanying tests/specs.

Changes:

  • Integrate SignatureManager into OpenAEVNetExecInjector to compile pre-/post-execution signatures and send them after execution.
  • Append an ExpectationSignature ContractOutputElement to every NetExec contract’s outputs.
  • Add signature-related tests (and Gherkin-style feature descriptions) plus new signature helper constants.

Reviewed changes

Copilot reviewed 9 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
netexec/netexec/openaev_netexec.py Integrates SignatureManager, compiles pre/post signatures, and sends signature payloads after execution.
netexec/netexec/contracts/contract_outputs.py Adds ExpectationSignature output element and appends it for all contract output sets.
netexec/netexec/contracts/output_registry.py Introduces EXPECTATION_SIGNATURE constant in the output registry.
netexec/netexec/helpers/signature_helper.py Adds NETEXEC_SIGNATURE_TYPES frozenset for NetExec-relevant signature types.
netexec/test/conftest.py Extends pyoaev module mocking to include signature-related modules for tests.
netexec/test/contracts/test_expectation_signature_output.py Tests that ExpectationSignature is always included in built contract outputs.
netexec/test/contracts/expectation_signature_output.feature Feature/spec describing expected ExpectationSignature presence across contracts.
netexec/test/signatures/test_netexec_signature_lifecycle.py Tests signature lifecycle integration points (compile pre/post, send payload).
netexec/test/signatures/netexec_signature_lifecycle.feature Feature/spec describing the desired signature lifecycle behavior.
netexec/test/signatures/init.py Package marker for signatures tests.
netexec/test/signatures/conftest.py Test package conftest placeholder (currently empty).

Comment thread netexec/netexec/openaev_netexec.py
Comment thread netexec/netexec/openaev_netexec.py
Comment thread netexec/netexec/openaev_netexec.py
Comment thread netexec/netexec/helpers/signature_helper.py
Comment thread netexec/netexec/contracts/contract_outputs.py
@guzmud guzmud force-pushed the feature/200-inject-expectations branch from fbef657 to 2fcdece Compare June 25, 2026 12:54
@guzmud

guzmud commented Jun 25, 2026

Copy link
Copy Markdown
Member

Logs while testing against a locally-running OAEV stack while launching a netexec-based atomic testing

{
  "timestamp": "2026-06-25T12:45:00.160174Z",
  "level": "INFO",
  "name": "NetExec",
  "message": "Data: {'expectations': [{'expectation_type': 'VULNERABILITY', 'expectation_name': 'Not vulnerable', 'expectation_description': '', 'expectation_score': 100, 'expectation_expectation_group': False}], 'port': '', 'target_selector': 'assets', 'target_property_selector': 'automatic', 'targets': ''}"
}

{
  "timestamp": "2026-06-25T12:45:01.436000Z",
  "level": "INFO",
  "name": "NetExec",
  "message": "Execution details updated: %s", "attributes": "start_time=datetime.datetime(2026, 6, 25, 12, 45, 0, 166288, tzinfo=datetime.timezone.utc) end_time=datetime.datetime(2026, 6, 25, 12, 45, 1, 435730, tzinfo=datetime.timezone.utc) execution_status='success' execution_action=<InjectExecutionActions.COMPLETE: 'complete'> execution_message='Current action: complete - Current status: success' execution_duration=1.269442"
}

{
  "timestamp": "2026-06-25T12:45:01.436693Z",
  "level": "INFO",
  "name": "NetExec",
  "message": "Uploading signatures with payload: %s", "attributes": {"targets": [{"signature_target": {"agent": null, "asset": "28d38644-e5e1-4a67-bbe5-0c7fde87a5e4", "asset_group": null}, "signature_values": [{"expectation_type": "VULNERABILITY", "values": [{"signature_type": "start_time", "signature_value": "2026-06-25T12:45:00Z"}, {"signature_type": "end_time", "signature_value": "2026-06-25T12:45:01Z"}, {"signature_type": "source_ipv4", "signature_value": "127.0.1.1"}, {"signature_type": "target_hostname", "signature_value": "honey.scanme.sh"}]}]}]}
}

{
  "timestamp": "2026-06-25T12:45:01.437028Z",
  "level": "DEBUG",
  "name": "pyoaev.signatures.signature_manager",
  "message": "send_signatures inject_id=8efe1b9c-990b-4d95-9367-18d0d9df3b9a, execution_status=success, execution_action=InjectExecutionActions.COMPLETE"
}

mariot and others added 8 commits July 8, 2026 10:10
…il-fast

Declare SignatureManager once in __init__ instead of creating it on every
_send_signatures call. This avoids repeated instantiation and surfaces any
pyoaev signature engine issues at injector startup.
…ming

Move compile_pre_execution_signatures before the netexec tool run so that
start_time is captured before execution, and compile_post_execution_signatures
runs after, ensuring end_time reflects the actual tool duration.
… types

Expand NETEXEC_SIGNATURE_TYPES with protocols_tested and protocols_succeeded
as required by US-6 for the netexec injector execution metadata.
…a_signatures

Include protocols_tested (from the parsed contract protocol) and
protocols_succeeded (protocol list when returncode is 0) in the tool_output
extra_signatures dict, making them available to the signature pipeline.
Read expectation_types from the inject content expectations list instead of
using a hardcoded default. Falls back to ['DETECTION'] when no expectations
are defined in the input data.
And also withdrawing the unecessary target_meta from the payload
building
@guzmud guzmud force-pushed the feature/200-inject-expectations branch from fdc44b8 to ab987b7 Compare July 8, 2026 08:10
@guzmud guzmud merged commit dae89b3 into main Jul 8, 2026
29 checks passed
@guzmud guzmud deleted the feature/200-inject-expectations branch July 8, 2026 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not merge Do not merge until this label is removed. filigran team Item from the Filigran team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(netexec): create its own signatures for inject expectations

5 participants