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

Avoid force check updates when user logins #6375

Merged

Conversation

lucianogorza
Copy link
Contributor

@lucianogorza lucianogorza commented Jan 25, 2024

Description

This PR prevents checking for updates with the force_query parameter set to true upon user login. Consequently, the Wazuh API will now return available updates without querying the CTI Service.

Issues Resolved

#6308

Evidence

query_api: Determines whether the Check Updates plugin retrieves data from the Wazuh API or from a saved object.
force_query: When query_api is set to true, it determines whether the Wazuh API internally obtains the data or fetches it from the CTI Service.

After user logins

image

Server APIs page

image

Check updates button

image

Update Check updates button tooltip

image

Test

  1. Open brower inspectos to see network requests.
  2. Logins and check the request: /api/wazuh-check-updates/updates?query_api=true&force_query=false
  3. Navigate to Indexer/dashboard management -> Server APIs and check de request: /api/wazuh-check-updates/updates?query_api=false&force_query=false
  4. Click Check updates button and check the request: /api/wazuh-check-updates/updates?query_api=true&force_query=true
  5. Check the title of the Check updates button tooltip.

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

@lucianogorza lucianogorza linked an issue Jan 25, 2024 that may be closed by this pull request
@lucianogorza lucianogorza marked this pull request as ready for review January 25, 2024 12:53
@lucianogorza lucianogorza requested a review from a team as a code owner January 25, 2024 12:53
Copy link
Contributor

Wazuh Core plugin code coverage (Jest) test % values
Statements 20.85% ( 186 / 892 )
Branches 17.91% ( 79 / 441 )
Functions 13.79% ( 36 / 261 )
Lines 21.05% ( 183 / 869 )

Copy link
Contributor

Wazuh Check Updates plugin code coverage (Jest) test % values
Statements 76.78% ( 172 / 224 )
Branches 58.65% ( 61 / 104 )
Functions 61.7% ( 29 / 47 )
Lines 76.78% ( 172 / 224 )

Copy link
Contributor

Main plugin code coverage (Jest) test % values
Statements 12.22% ( 4207 / 34427 )
Branches 8.28% ( 1918 / 23141 )
Functions 11.72% ( 959 / 8177 )
Lines 12.39% ( 4092 / 33020 )

@chantal-kelm chantal-kelm self-requested a review January 25, 2024 17:57
Copy link
Member

@chantal-kelm chantal-kelm left a comment

Choose a reason for hiding this comment

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

After user logins

image (6)

Server APIs page

image (8)

Check updates button

image (9)

Update Check updates button tooltip

image (10)

@lucianogorza lucianogorza self-assigned this Jan 25, 2024
@Tostti
Copy link
Member

Tostti commented Jan 30, 2024

Test

After log in

image

Server APIs

image

Check updates button

image

Check updates button tooltip

image

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 ✅
CR ✅

LGTM

@Tostti Tostti merged commit a791fed into 4.8.0 Jan 30, 2024
4 checks passed
@Tostti Tostti deleted the enhancement/6308-avoid-force-check-updates-when-user-logins branch January 30, 2024 14:56
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.

The check update button does not show the date of the last scan
3 participants