Skip to content

feat(chaining): allow linking inputs to many primitive types (#6198) - #6901

Open
savacano28 wants to merge 21 commits into
mainfrom
issue/6536-3
Open

feat(chaining): allow linking inputs to many primitive types (#6198)#6901
savacano28 wants to merge 21 commits into
mainfrom
issue/6536-3

Conversation

@savacano28

@savacano28 savacano28 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Proposed changes

  • Allow link input to various primitives types
  • Update conditionservice.preparateStepExecutionInput in order to generate batch with all primitivies types linked.

Testing Instructions

Test 0:

  1. Create simualtion/scenario
  2. Add some actions with inputs
  3. Check that you can link these input to many primitives types (update, remove)
image

Test 1

  1. Create chaining simulation with nmap and echo payload: echo #{input}
  2. Link input (echo) to 1, 2, n primitves types
  3. Execute
image image

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

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

@github-actions

Copy link
Copy Markdown

/review docs

📖 Docs Reviewer triggered automatically.

23 files changed — 14 functional, 0 documentation.

⚠️ No documentation files modified. Agent will check if doc updates are needed.

@savacano28 savacano28 changed the title feat(chaining): save complex outputs (#6198) feat(chaining): allow linking inputs to many primitive types (#6198) Jul 23, 2026
@Filigran-Automation Filigran-Automation added the filigran team Item from the Filigran team. label Jul 23, 2026
@savacano28
savacano28 force-pushed the issue/6536-3 branch 5 times, most recently from 7d6982a to b660cc9 Compare July 27, 2026 10:42
@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 59.77860% with 109 lines in your changes missing coverage. Please review.
✅ Project coverage is 44.94%. Comparing base (3e717ad) to head (20305d7).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
.../io/openaev/service/chaining/ConditionService.java 81.81% 11 Missing and 11 partials ⚠️
...in/components/chaining/logic/logic-flow-helpers.ts 0.00% 19 Missing ⚠️
...aining/logic/drawer/ConfigureActionDetail.utils.ts 0.00% 16 Missing ⚠️
...a/io/openaev/api/chaining/InjectExecutionStep.java 31.57% 8 Missing and 5 partials ⚠️
...ents/chaining/logic/drawer/InjectDataFieldItem.tsx 0.00% 12 Missing ⚠️
...main/java/io/openaev/importer/V1_DataImporter.java 68.18% 2 Missing and 5 partials ⚠️
...openaev/service/chaining/WorkflowStateService.java 75.00% 2 Missing and 2 partials ⚠️
.../java/io/openaev/utils/ConditionKeyTypesUtils.java 60.00% 2 Missing and 2 partials ⚠️
.../logic/chaining_flow/ChainingFlowConfiguration.tsx 0.00% 4 Missing ⚠️
...ts/chaining/logic/drawer/ConfigureActionDetail.tsx 0.00% 4 Missing ⚠️
... and 3 more

❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.
❌ Your project check has failed because the head coverage (7.54%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6901      +/-   ##
============================================
- Coverage     44.96%   44.94%   -0.02%     
- Complexity     9327     9354      +27     
============================================
  Files          2681     2683       +2     
  Lines         80441    80600     +159     
  Branches      12066    12098      +32     
============================================
+ Hits          36168    36228      +60     
- Misses        41653    41737      +84     
- Partials       2620     2635      +15     
Flag Coverage Δ
backend 67.82% <75.23%> (+0.01%) ⬆️
e2e 16.97% <0.00%> (-0.93%) ⬇️
frontend 7.54% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@savacano28
savacano28 marked this pull request as ready for review July 27, 2026 12:26
Copilot AI review requested due to automatic review settings July 27, 2026 12:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 extends the chaining engine’s condition “key type” model from a single primitive type to a list of primitive types, enabling a single mapper/input link to reference multiple primitive outputs. It updates persistence (jsonb), API/DTOs, chaining execution logic (batch generation), and the frontend linking UI accordingly.

Changes:

  • Backend: replace condition_key_type with condition_key_types (jsonb), update chaining services to consume multiple key types, and add a Flyway migration + importer/exporter updates.
  • Frontend: update chaining flow/editor to display and edit multi-type links, and update generated API types + translations.
  • Tests: update existing chaining tests and add coverage for mapper conditions with multiple key types.

Reviewed changes

Copilot reviewed 43 out of 44 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
openaev-model/src/main/java/io/openaev/database/repository/ConditionRepository.java Updates repository query to support new key-types model (now matched in memory).
openaev-model/src/main/java/io/openaev/database/model/Condition.java Persists condition key types as jsonb list.
openaev-front/src/utils/lang/zh.json Adds “Edit links” translation.
openaev-front/src/utils/lang/ru.json Adds “Edit links” translation.
openaev-front/src/utils/lang/ko.json Adds “Edit links” translation.
openaev-front/src/utils/lang/ja.json Adds “Edit links” translation.
openaev-front/src/utils/lang/it.json Adds “Edit links” translation.
openaev-front/src/utils/lang/fr.json Adds “Edit links” translation and removes stale/extra keys.
openaev-front/src/utils/lang/es.json Adds “Edit links” translation.
openaev-front/src/utils/lang/en.json Adds “Edit links” translation.
openaev-front/src/utils/lang/de.json Adds “Edit links” translation.
openaev-front/src/utils/api-types.d.ts Updates Condition DTO typings from scalar to list condition_key_types.
openaev-front/src/admin/components/chaining/logic/logic-flow-helpers.ts Adds key-type resolver to support new/legacy API shapes in UI state.
openaev-front/src/admin/components/chaining/logic/events/event-types.ts Sends condition_key_types array to API.
openaev-front/src/admin/components/chaining/logic/drawer/InjectDataFieldItem.tsx UI: multi-select primitive link types + apply action.
openaev-front/src/admin/components/chaining/logic/drawer/ConfigureActionDetail.utils.ts Updates auto-linking and introduces field-link normalization helper.
openaev-front/src/admin/components/chaining/logic/drawer/ConfigureActionDetail.tsx Applies normalization + auto-linking based on argument default types.
openaev-front/src/admin/components/chaining/logic/chaining_flow/LogicFlow.tsx Emits mapper conditions with condition_key_types.
openaev-front/src/admin/components/chaining/logic/chaining_flow/ChainingFlowConfiguration.tsx Converts UI links to API mapper conditions with condition_key_types.
openaev-api/src/test/resources/importer-v1/import-scenario-with-workflow.json Updates importer fixture to new condition_key_types format.
openaev-api/src/test/java/io/openaev/utils/fixtures/ConditionFixture.java Updates fixture to use keyTypes list.
openaev-api/src/test/java/io/openaev/service/chaining/WorkflowStateServiceTest.java Updates mocks/asserts for new repository method + keyTypes list.
openaev-api/src/test/java/io/openaev/service/chaining/StepServiceTest.java Updates tests to use keyTypes list.
openaev-api/src/test/java/io/openaev/service/chaining/StepServiceIntegrationTest.java Updates integration inputs to use keyTypes list.
openaev-api/src/test/java/io/openaev/service/chaining/SaveCorrelatedObjectDecompositionTest.java Updates verification for new repository method signature.
openaev-api/src/test/java/io/openaev/service/chaining/ConditionServiceTest.java Adds coverage for multi-key-type mapper batch generation and updates existing tests.
openaev-api/src/test/java/io/openaev/service/attackpath/AttackPathKillChainResolverTest.java Updates test construction to use keyTypes list.
openaev-api/src/test/java/io/openaev/database/model/ConditionRepositoryTest.java Updates repository test to aggregate keyTypes list.
openaev-api/src/test/java/io/openaev/api/chaining/InjectExecutionStepTest.java Updates expectations for step-input JSON to use keyTypes array.
openaev-api/src/test/java/io/openaev/api/chaining/ConditionApiTest.java Updates condition tree test data to use keyTypes list.
openaev-api/src/main/java/io/openaev/utils/ConditionKeyTypesUtils.java Adds utility to normalize key-types lists with condition/mapping rules.
openaev-api/src/main/java/io/openaev/service/chaining/WorkflowStateService.java Switches to in-memory key-type matching for filter roots; adapts leaf key checks.
openaev-api/src/main/java/io/openaev/service/chaining/StepService.java Copies conditions using keyTypes list.
openaev-api/src/main/java/io/openaev/service/chaining/ConditionService.java Core logic changes: validation, key-type resolution, multi-key-type mapper batching.
openaev-api/src/main/java/io/openaev/service/attackpath/AttackPathKillChainResolver.java Emits consumed finding keys for all key types on a condition leaf.
openaev-api/src/main/java/io/openaev/migration/V6_20260727140000000__Add_condition_key_types_jsonb.java Adds condition_key_types jsonb column + backfill/normalize + index, drops legacy column.
openaev-api/src/main/java/io/openaev/importer/V1_DataImporter.java Imports both legacy and new key-type shapes and normalizes them.
openaev-api/src/main/java/io/openaev/export/Mixins.java Exports condition_key_types instead of legacy scalar key type.
openaev-api/src/main/java/io/openaev/api/chaining/StepMapper.java Maps step mapper conditions to DTO using conditionKeyTypes.
openaev-api/src/main/java/io/openaev/api/chaining/InjectExecutionStep.java Uses keyTypes array in step input JSON and supports multi-key-type mapping.
openaev-api/src/main/java/io/openaev/api/chaining/dto/MapperConditionOutput.java DTO: condition_key_types list.
openaev-api/src/main/java/io/openaev/api/chaining/dto/ConditionOutput.java DTO: condition_key_types list.
openaev-api/src/main/java/io/openaev/api/chaining/dto/ConditionCreateInput.java DTO: accepts condition_key_types list.
openaev-api/src/main/java/io/openaev/api/chaining/ConditionMapper.java Maps create input to entity using normalized key-types list.

@camrrx camrrx left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Code : ✅
Test :

  1. Add multiple type ✅
  2. delete type : ok except the last one => should remove the cross or unlink the type
Image
  1. Launch the simulation with multiple type ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

filigran team Item from the Filigran team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(chaining): allow linking inputs to many primitive types feat(chaining): update the chaining engine to use the primitive and complex type

4 participants