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

Sanitize report's inputs and usernames #4330

Merged
merged 5 commits into from
Jul 15, 2022

Conversation

AlexRuiz7
Copy link
Member

Summary

Closes #4329

To test

  • Check the reports' folder for a user $WAZUH_APP_HOME/downloads/reports/<username> has been automatically renamed to $WAZUH_APP_HOME/downloads/reports/hash(<username>), and that their reports are still inside the new folder.
  • Check no report from other users can be obtained.
  • Check there are no collisions between files in read/write operations.
  • Check the report name is no longer sent from the frontend (check the request using the dev tools).
  • Check that usernames with UTF-8 characters gets encoded by the MD5 hash function.

@AlexRuiz7 AlexRuiz7 linked an issue Jul 14, 2022 that may be closed by this pull request
Copy link
Member

@Machi3mfl Machi3mfl left a comment

Choose a reason for hiding this comment

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

Testing ✅

  • Check the reports' folder for a user $WAZUH_APP_HOME/downloads/reports/ has been automatically renamed to $WAZUH_APP_HOME/downloads/reports/hash(), and that their reports are still inside the new folder.
Screen.Recording.2022-07-14.at.15.14.59.mov
  • Check no report from other users can be obtained.

Screen Shot 2022-07-14 at 15 12 42

  • Check there are no collisions between files in read/write operations.

Screen Shot 2022-07-14 at 14 53 59

Screen Shot 2022-07-14 at 14 53 46

  • Check the report name is no longer sent from the frontend (check the request using the dev tools).

  • Check that usernames with UTF-8 characters gets encoded by the MD5 hash function.

Screen Shot 2022-07-14 at 15 18 10

Copy link
Member

@yenienserrano yenienserrano left a comment

Choose a reason for hiding this comment

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

  • Check the reports' folder for a user $WAZUH_APP_HOME/downloads/reports/<username> has been automatically renamed to $WAZUH_APP_HOME/downloads/reports/hash(<username>), and that their reports are still inside the new folder.

image

  • Check no report from other users can be obtained.

image

  • Check there are no collisions between files in read/write operations.

image

  • Check the report name is no longer sent from the frontend (check the request using the dev tools).

  • Check that usernames with UTF-8 characters gets encoded by the MD5 hash function.

image

image

@github-actions
Copy link
Contributor

Jest Test Coverage % values
Statements 6.66% ( 2430 / 36462 )
Branches 2.67% ( 754 / 28251 )
Functions 4.46% ( 398 / 8917 )
Lines 6.74% ( 2351 / 34877 )

@AlexRuiz7 AlexRuiz7 merged commit 3c1e51c into 4.3-7.10 Jul 15, 2022
@AlexRuiz7 AlexRuiz7 deleted the feature/4329-reporting-inputs branch July 15, 2022 13:12
github-actions bot pushed a commit that referenced this pull request Jul 15, 2022
* Validate path parameters of the reports endpoint

* Remove leftover prop in the reporting-table component

* Fix typo in report name validtion

* Remove the return of reports path from the /reports endpoint

* Remove absolute file path on report not found

(cherry picked from commit 3c1e51c)
@github-actions
Copy link
Contributor

The backport to 4.3-1.2-wzd failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-4.3-1.2-wzd 4.3-1.2-wzd
# Navigate to the new working tree
cd .worktrees/backport-4.3-1.2-wzd
# Create a new branch
git switch --create backport-4330-to-4.3-1.2-wzd
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 3c1e51cbc8d4c269d08df90f855d1f07e4897fd6
# Push it to GitHub
git push --set-upstream origin backport-4330-to-4.3-1.2-wzd
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-4.3-1.2-wzd

Then, create a pull request where the base branch is 4.3-1.2-wzd and the compare/head branch is backport-4330-to-4.3-1.2-wzd.

AlexRuiz7 added a commit that referenced this pull request Jul 15, 2022
* Validate path parameters of the reports endpoint

* Remove leftover prop in the reporting-table component

* Fix typo in report name validtion

* Remove the return of reports path from the /reports endpoint

* Remove absolute file path on report not found

(cherry picked from commit 3c1e51c)
AlexRuiz7 added a commit that referenced this pull request Jul 15, 2022
Sanitize report's inputs and usernames (#4330)

* Validate path parameters of the reports endpoint

* Remove leftover prop in the reporting-table component

* Fix typo in report name validtion

* Remove the return of reports path from the /reports endpoint

* Remove absolute file path on report not found

(cherry picked from commit 3c1e51c)

Co-authored-by: Álex <alejandro.ruiz.becerra@wazuh.com>
AlexRuiz7 added a commit that referenced this pull request Jul 15, 2022
Sanitize report's inputs and usernames (#4330)

* Validate path parameters of the reports endpoint

* Remove leftover prop in the reporting-table component

* Fix typo in report name validtion

* Remove the return of reports path from the /reports endpoint

* Remove absolute file path on report not found

(cherry picked from commit 3c1e51c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sanitize report's inputs and usernames
3 participants