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

Fix a crash in the vulnerability details flyout #5200

Conversation

Desvelao
Copy link
Member

@Desvelao Desvelao commented Feb 7, 2023

Description

This pull request fixes a UI crash when opening the details of a vulnerability that has no the external_references field.

The changes ensure the field is defined and is an array.

If there is data related to external references, then a - will be displayed

Issues Resolved

#5199

Evidence

image

Test

UI

Test
See the References of a vulnerability that has one or more references, it should display the accordion with the references.
See the References of a vulnerability that has no references, it should display a -.
See the References of a vulnerability that the references are not defined, it should display a -.

crash-vulnerability-data-no-external-references.md

Imposter patch that adds some vulnerability data without the external_references field (called Custom and Custom2).
pr-5199-imposter.txt

Check List

  • All tests pass
    • yarn test:jest
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

…es` field could not be defined in the API response

Ensure the `external_references` field is defined with the expected data
structure as an array mapping each `affected_items` of the API response.
@Desvelao Desvelao requested a review from a team as a code owner February 7, 2023 16:04
@Desvelao Desvelao self-assigned this Feb 7, 2023
@Desvelao Desvelao linked an issue Feb 7, 2023 that may be closed by this pull request
@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2023

Code coverage (Jest) % values
Statements 8.77% ( 3239 / 36924 )
Branches 4.5% ( 1291 / 28671 )
Functions 7.63% ( 698 / 9148 )
Lines 8.83% ( 3124 / 35359 )

Copy link
Member

@Tostti Tostti left a comment

Choose a reason for hiding this comment

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

Test

Test
See the References of a vulnerability that has one or more references, it should display the accordion with the references. 🟢
See the References of a vulnerability that has no references, it should display a -. 🟢
See the References of a vulnerability that the references are not defined, it should display a -. 🟢

Evidence

  • See the References of a vulnerability that has one or more references, it should display the accordion with the references.
    imagen

  • See the References of a vulnerability that has no references, it should display a -.
    imagen

  • See the References of a vulnerability that the references are not defined, it should display a -.
    imagen

TEST:✔️
CR:✔️

LGTM

@yenienserrano
Copy link
Member

yenienserrano commented Feb 9, 2023

Wazuh dashboard

Legend:
⚫: none
🟢: pass
🟡: warning
🔴: fail
⚪: not applicable

UI

Test Chrome Firefox Safari
See the References of a vulnerability that has one or more references, it should display the accordion with the references. 🟢 🟢
See the References of a vulnerability that has no references, it should display a -. 🟢 🟢
See the References of a vulnerability that the references are not defined, it should display a -. 🟢 🟢

Details

🟢 See the References of a vulnerability that has one or more references, it should display the accordion with the references.

Chrome - 🟢

image

Firefox - 🟢

image

Safari - ⚫

🟢 See the References of a vulnerability that has no references, it should display a `-`.

Chrome - 🟢

image

Firefox - 🟢

image

Safari - ⚫

🟢 See the References of a vulnerability that the references are not defined, it should display a `-`.

Chrome - 🟢

image

Firefox - 🟢

image

Safari - ⚫

@Desvelao Desvelao merged commit 08fc532 into 4.4-2.4-wzd Feb 10, 2023
@Desvelao Desvelao deleted the fix/5199-crash-vulnerability-data-external-references-field branch February 10, 2023 11:25
@github-actions
Copy link
Contributor

The backport to 4.4-7.16 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.4-7.16 4.4-7.16
# Navigate to the new working tree
cd .worktrees/backport-4.4-7.16
# Create a new branch
git switch --create backport-5200-to-4.4-7.16
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 08fc532046f0148840d583383117a9d0dedf2bf6
# Push it to GitHub
git push --set-upstream origin backport-5200-to-4.4-7.16
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-4.4-7.16

Then, create a pull request where the base branch is 4.4-7.16 and the compare/head branch is backport-5200-to-4.4-7.16.

@github-actions
Copy link
Contributor

The backport to 4.4-7.10 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.4-7.10 4.4-7.10
# Navigate to the new working tree
cd .worktrees/backport-4.4-7.10
# Create a new branch
git switch --create backport-5200-to-4.4-7.10
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 08fc532046f0148840d583383117a9d0dedf2bf6
# Push it to GitHub
git push --set-upstream origin backport-5200-to-4.4-7.10
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-4.4-7.10

Then, create a pull request where the base branch is 4.4-7.10 and the compare/head branch is backport-5200-to-4.4-7.10.

Desvelao added a commit that referenced this pull request Feb 10, 2023
* fix(vulnerability): fix a crash caused because the `external_references` field could not be defined in the API response

Ensure the `external_references` field is defined with the expected data
structure as an array mapping each `affected_items` of the API response.

* changelog: add pull request entry

(cherry picked from commit 08fc532)
Desvelao added a commit that referenced this pull request Feb 10, 2023
* fix(vulnerability): fix a crash caused because the `external_references` field could not be defined in the API response

Ensure the `external_references` field is defined with the expected data
structure as an array mapping each `affected_items` of the API response.

* changelog: add pull request entry

(cherry picked from commit 08fc532)
Machi3mfl pushed a commit that referenced this pull request Feb 10, 2023
…5205)

Fix a crash in the vulnerability details flyout (#5200)

* fix(vulnerability): fix a crash caused because the `external_references` field could not be defined in the API response

Ensure the `external_references` field is defined with the expected data
structure as an array mapping each `affected_items` of the API response.

* changelog: add pull request entry

(cherry picked from commit 08fc532)
Machi3mfl pushed a commit that referenced this pull request Feb 10, 2023
…5204)

Fix a crash in the vulnerability details flyout (#5200)

* fix(vulnerability): fix a crash caused because the `external_references` field could not be defined in the API response

Ensure the `external_references` field is defined with the expected data
structure as an array mapping each `affected_items` of the API response.

* changelog: add pull request entry

(cherry picked from commit 08fc532)
AlexRuiz7 pushed a commit that referenced this pull request Mar 17, 2023
* fix(vulnerability): fix a crash caused because the `external_references` field could not be defined in the API response

Ensure the `external_references` field is defined with the expected data
structure as an array mapping each `affected_items` of the API response.

* changelog: add pull request entry
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.

Crash in vulnerabilities module due to references missing field
3 participants