Skip to content
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

Wrong active-response endpoint parameter from dev tools #3466

Merged
merged 29 commits into from
Nov 5, 2021

Conversation

sortiz1191
Copy link
Contributor

@sortiz1191 sortiz1191 commented Jul 13, 2021

Hi team!
This PR solves an error when trying to send an array to an /active-response path.
Before the change, the request retrieved the next error with this example:

EXAMPLE:
PUT /active-response?agents_list=000 { "arguments": [ "-","1.1.1.1" ], "command":"firewall-drop.sh", "custom": true }
ERROR:
error: 2021/07/12 15:32:7: wazuh-api:makeRequest: {"title":"Bad Request","detail":"'-,1.1.1.1' is not of type 'array' - 'arguments'"}

Now, the same example should not show this error.

To test it:

  1. Go to Management/Groups
  • Given the browser is in wazuh app
  • When the user navigates to Tools/Api Console
  • Then the Api Console section will be shown

Precondition 1:
Command: PUT /active-response?agents_list=000 { "arguments": [ "-","1.1.1.1" ], "command":"firewall-drop.sh", "custom": true }

  1. Run this command
  • Given the browser is Api Console
  • When the user will run the command according to the Precondition 1
  • Then the return that will be shown after the command ran will be different to: error: 2021/07/12 15:32:7: wazuh-api:makeRequest: {"title":"Bad Request","detail":"'-,1.1.1.1' is not of type 'array' - 'arguments'"}

Closes: #3457

@sortiz1191 sortiz1191 requested a review from a team July 13, 2021 13:50
@sortiz1191 sortiz1191 self-assigned this Jul 13, 2021
public/react-services/wz-request.ts Outdated Show resolved Hide resolved
@Machi3mfl Machi3mfl self-assigned this Jul 19, 2021
gabiwassan and others added 22 commits July 19, 2021 17:41
* test(unit-test): Fixing and updating unit-tests.

* test(scheduler-job): Fixing suite scheduler-job tests.

* test(unit-test): Fixing updating unit-tests.

* test(check-result): Fixing uTest of check-result, added error case.

* test(unit-test): Skipped uTest with dependency of API.

* test(prettier): Applied prettier, redux-mock-store dependency

* test(jest): Jest config without dependencies.

* test(git-actions): Added workflow for uTest.

* test(check-result): Update workflow.

* test(git-actions): Updated workflow

* test(gitactions): Dependencies for unit test.

* test(gitactions): Added coverage-comment

* test(gitactions): Changed text to text-summary

* test(gitactions): Show summary

* test(gitactions): Show summary + added dependencies

* test(gitactions): Typo

* test(gitactions): Porcents

* test(gitactions): Typo

* test(gitactions): Testing node version with yarn

* test(gitactions): Update

* test(gitactions): Update

* test(gitactions): testing coverage summary

* test(gitactions): testing coverage summary

* test(gitactions): fix param github-token

* test(gitactions): update

* test(gitactions): testing report.json

* test(gitactions): final test.

* test(actions): testing kibana dependencies

* test(actions): testing kibana dependencies

* test(actions): testing kibana dependencies

* test(actions): testing kibana dependencies

* test(actions): testing

* test(actions): testing

* test(actions): test with old config jest.

* test(actions): set node version for jest

* test(actions): testing with bootstrap

* test(actions): rollback dependencies

* test(actions): rollback

* test(groups-main): fixing snapshot test

* test(groups-main): added coverage

* test(groups-main): fix path

* test(groups-main): fix path

* test(git-actions): fix script

* test(git-actions): fix checkout

* test(git-actions): fix checkout

* test(git-actions): fix checkout

* test(git-actions): fix checkout

* test(git-actions): fix checkout

* test(git-actions): fix checkout

* test(git-actions): fix checkout

* test(git-actions): fix checkout

* fix(syscollector): Refactor for agents-sections.

* fix(syscollector): Clean files.

* fix(syscollector): Clean files.

* fix(syscollector): test

* fix(syscollector): test

* fix(syscollector): test

* fix(syscollector): test

* fix(syscollector): test

* fix(syscollector): test

* fix(syscollector): test

* fix(syscollector): test

* fix(syscollector): test

* fix(syscollector): test

* fix(syscollector): test

* fix(syscollector): test

* fix(syscollector): test

* fix(syscollector): test

* fix(syscollector): test comment coverage

* fix(syscollector): test comment coverage

* fix(syscollector): test comment coverage

* fix(actions): test comment coverage

* Create Cypress Workflow for 4.3-7.10 (#3444)

* Fixed dispatch for updateCurrentAgentData (#3453)

* fix(syscollector): Fixed dispatch for updateCurrentAgentData

* fix(syscollector): Refactor for agents-sections.

* fix(actions): add const env

Co-authored-by: Matias Ezequiel Moreno <49887871+matiasmoreno876@users.noreply.github.com>
* Implemented new try-catch strategy

* Updated context

* Added test file and snapshot

* Updated CHANGELOG

* Requested changes

* Removed blank space in message

* Updated error title and message

Co-authored-by: Ibarra Maximiliano <maximiliano.ibarra@wazuh.com>
Co-authored-by: Gabriel Wassan <gabriel.wassan@wazuh.com>
* Techniques and mitre

* Resources

* Update changelog
* Added error handling implementation

* Changed wrong var err

* Draft statistics test and snapshot

* Updated CHANGELOG

* Updating title and message error

Co-authored-by: Ibarra Maximiliano <maximiliano.ibarra@wazuh.com>
Co-authored-by: Gabriel Wassan <gabriel.wassan@wazuh.com>
* Added new try-catch strategy in Management > Configuration

* Updated CHANGELOG

* Requested changes

* doc(changelog): update

Co-authored-by: Ibarra Maximiliano <maximiliano.ibarra@wazuh.com>
Co-authored-by: Gabriel Wassan <gabriel.wassan@wazuh.com>
* test(unittest): Updating test.

* test(unittest): Updating test.
* fix(syscollector): Added try catch strategy.

* Implement try catch strategy in Groups (#3415)

* Implement try catch groups

* Add test

* test(groups): Added simple snapshot test.

* Add changelog

* Change context

* Change title

Co-authored-by: gabiwassan <gabriel.wassan@wazuh.com>

* Create Cypress Workflow for 4.3-7.10 (#3444)

* Fixed dispatch for updateCurrentAgentData (#3453)

* fix(syscollector): Fixed dispatch for updateCurrentAgentData

* fix(syscollector): Refactor for agents-sections.

* doc(changelog): Updated

* Updating test. (#3470)

* test(unittest): Updating test.

* test(unittest): Updating test.

* test(agent-table): Added unit test & fix collectCoverage

Co-authored-by: Pablo Martínez <pablo.martinez@wazuh.com>
Co-authored-by: Matias Ezequiel Moreno <49887871+matiasmoreno876@users.noreply.github.com>
* Added try-catc new strategy

* Added test file and component snapshot

* Updated CHANGELOG

* Updating error title and message

* Refactor try catch in Management > Statistics (#3429)

* Added error handling implementation

* Changed wrong var err

* Draft statistics test and snapshot

* Updated CHANGELOG

* Updating title and message error

Co-authored-by: Ibarra Maximiliano <maximiliano.ibarra@wazuh.com>
Co-authored-by: Gabriel Wassan <gabriel.wassan@wazuh.com>

* Merged conflicts

* Updating test. (#3470)

* test(unittest): Updating test.

* test(unittest): Updating test.

* merged CHANGELOG

Co-authored-by: Ibarra Maximiliano <maximiliano.ibarra@wazuh.com>
Co-authored-by: Gabriel Wassan <gabriel.wassan@wazuh.com>
* Implemented error-handling

* Updated CHANGELOG

Co-authored-by: Ibarra Maximiliano <maximiliano.ibarra@wazuh.com>
Co-authored-by: Gabriel Wassan <gabriel.wassan@wazuh.com>
* Changed the hasChanges state to false after the file is saved succesfully
Copy link
Member

@Desvelao Desvelao left a comment

Choose a reason for hiding this comment

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

review:
Code Review ✅

@github-actions
Copy link
Contributor

Jest Test Coverage % values
Statements 3.12% ( 1109 / 35594 )
Branches 1.16% ( 324 / 27961 )
Functions 2.02% ( 174 / 8632 )
Lines 3.15% ( 1071 / 34012 )

@Desvelao
Copy link
Member

Changes

  • Added the change to changelog

@Machi3mfl Machi3mfl removed their assignment Aug 13, 2021
Copy link
Member

@mpRegalado mpRegalado left a comment

Choose a reason for hiding this comment

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

CR: LGTM ✔️
Testing: LGTM ✔️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Bug issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants