-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[EDR Workflows] Initialize argument selector value #227463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
/ci |
|
/ci |
|
/ci |
|
Pinging @elastic/security-defend-workflows (Team:Defend Workflows) |
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
History
cc @tomsonpl |
|
Starting backport for target branches: 8.19, 9.1 https://github.com/elastic/kibana/actions/runs/16675548895 |
|
@ashokaditya I merged this PR before getting review from you because @paul-tavares wanted to have these changes for Hope this is fine 👍 Thanks! |
(cherry picked from commit 5d2008f)
(cherry picked from commit 5d2008f)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…230215) # Backport This will backport the following commits from `main` to `8.19`: - [[EDR Workflows] Initialize argument selector value (#227463)](#227463) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Tomasz Ciecierski","email":"tomasz.ciecierski@elastic.co"},"sourceCommit":{"committedDate":"2025-08-01T12:51:54Z","message":"[EDR Workflows] Initialize argument selector value (#227463)","sha":"5d2008fdfb2f0354d505f0af21c72f04115803aa","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Defend Workflows","backport:version","v9.2.0","v9.1.1","v8.19.1"],"title":"[EDR Workflows] Initialize argument selector value","number":227463,"url":"https://github.com/elastic/kibana/pull/227463","mergeCommit":{"message":"[EDR Workflows] Initialize argument selector value (#227463)","sha":"5d2008fdfb2f0354d505f0af21c72f04115803aa"}},"sourceBranch":"main","suggestedTargetBranches":["9.1","8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/227463","number":227463,"mergeCommit":{"message":"[EDR Workflows] Initialize argument selector value (#227463)","sha":"5d2008fdfb2f0354d505f0af21c72f04115803aa"}},{"branch":"9.1","label":"v9.1.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Tomasz Ciecierski <tomasz.ciecierski@elastic.co>
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
…230216) # Backport This will backport the following commits from `main` to `9.1`: - [[EDR Workflows] Initialize argument selector value (#227463)](#227463) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Tomasz Ciecierski","email":"tomasz.ciecierski@elastic.co"},"sourceCommit":{"committedDate":"2025-08-01T12:51:54Z","message":"[EDR Workflows] Initialize argument selector value (#227463)","sha":"5d2008fdfb2f0354d505f0af21c72f04115803aa","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Defend Workflows","backport:version","v9.2.0","v9.1.1","v8.19.1"],"title":"[EDR Workflows] Initialize argument selector value","number":227463,"url":"https://github.com/elastic/kibana/pull/227463","mergeCommit":{"message":"[EDR Workflows] Initialize argument selector value (#227463)","sha":"5d2008fdfb2f0354d505f0af21c72f04115803aa"}},"sourceBranch":"main","suggestedTargetBranches":["9.1","8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/227463","number":227463,"mergeCommit":{"message":"[EDR Workflows] Initialize argument selector value (#227463)","sha":"5d2008fdfb2f0354d505f0af21c72f04115803aa"}},{"branch":"9.1","label":"v9.1.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Tomasz Ciecierski <tomasz.ciecierski@elastic.co>
Description
Previously, #204965 introduced a
stringbased Selector Component, however the Response Console's framework wasn't adjusted to fully support it:Selector Components Not Restoring State from History:
When users selected a command from history (e.g., custom script execution), the selector UI (such as script dropdowns) could not restore its value from the previously entered command text. This left the UI out of sync with the command, confusing users and breaking workflows.
Broken Paste Functionality:
Pasting a full command (including arguments meant for selectors) into the console did not populate the selector UI components. As a result, users who pasted commands from documentation or shared snippets would see empty or incorrect selector states, making it difficult to execute or edit those commands.
These issues stemmed from the lack of a unified mechanism for synchronizing between the command text and selector state. Command-specific logic was difficult to maintain and extend.
How was it resolved?
** Added
argStateInfrastructure:**Commandinterface withargStateproperty to track selector component state** Smart Paste Processing:**
detectAndPreProcessPastedCommand()function that extracts values from pasted commands likerunscript --ScriptName="test.ps1"** History State Restoration:**
InputHistoryItemto includeargStatepropertyAdditional Architectural Improvements
Based on code review feedback, this PR also addresses architectural concerns with the
CustomScriptSelectorcomponent:🔧 Standard React Component:
Converted from function-returning-component pattern (
CustomScriptSelector('agentType')) to standard React component (<CustomScriptSelector />)🔧 Console Framework Encapsulation:
Removed direct
useConsoleStateDispatch()coupling and replaced with proper callback-based architecture (onChange,requestFocus)🔧 Command Metadata Integration:
Agent type now extracted from
command.commandDefinition.meta?.agentTypeinstead of function parameters, following console framework patterns🔧 Enhanced Interface:
Added
command: CommandandrequestFocus?: () => voidprops toCommandArgumentValueSelectorPropsfor better component integrationThese changes ensure the console remains a generic, maintainable framework while providing clean interfaces for selector components.
Result
Screen.Recording.2025-06-27.at.12.15.47.mov
Closes: #225269
Closes: #225407