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 default last scan date formatter #4975

Merged
merged 3 commits into from
Dec 15, 2022

Conversation

asteriscos
Copy link
Member

Description

Hi team,
this PR changes de default last scan date parser to be able to catch dates returned by Wazuh API when no vulnerabilities scan has been made. It prepares the parser to format any date string starting with 1970 (default last scan date in the API response).

Default last scan response example:

{
    "data": {
        "affected_items": [
            {
                "last_full_scan": "1970-01-01T00:00:00+00:00",
                "last_partial_scan": "1970-01-01T00:00:00+00:00"
            }
        ],
        "total_affected_items": 1,
        "total_failed_items": 0,
        "failed_items": []
    },
    "message": "Last vulnerability scans of the agent were returned",
    "error": 0
}

Issues Resolved

Closes #4959

Evidence

image

Test

  • Set up a new environment without any vulnerabilities scan
  • Go to Vulnerabilities / Inventory
  • See the default dates as -

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

@asteriscos asteriscos self-assigned this Dec 9, 2022
@asteriscos asteriscos requested a review from a team as a code owner December 9, 2022 12:39
@asteriscos asteriscos changed the title Change default last scan date formatter Fix default last scan date formatter Dec 9, 2022
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
✔️ test

Screenshot
image

@Desvelao Desvelao linked an issue Dec 12, 2022 that may be closed by this pull request
@github-actions
Copy link
Contributor

Code coverage (Jest) % values
Statements 8.69% ( 3210 / 36958 )
Branches 4.43% ( 1271 / 28682 )
Functions 7.59% ( 696 / 9166 )
Lines 8.75% ( 3097 / 35378 )

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.

LGTM

image

@Desvelao Desvelao merged commit ba0ce50 into 4.4-7.10 Dec 15, 2022
@Desvelao Desvelao deleted the fix/vulnerabilities-default-last-scan-date-4959 branch December 15, 2022 15:08
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.

Vulnerabilities default last scan date not displayed properly
4 participants