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

[BUG][Reports] Generate reports not manage the Wazuh API token expiration #3881

Merged

Conversation

Desvelao
Copy link
Member

@Desvelao Desvelao commented Mar 4, 2022

Description

This PRs fixes the management of token expiration when generating a PDF report.

Changes

  • Replaced the method to do the request from GenericRequest.request to WzRequest.genericReq that handles the refreshing of token
  • Adapted request payload and endpoint expected parameters for ApiID and the index pattern title
  • Removed not used params of some reports endpoints
  • Remove message of generating pdf report when the process fails

Tests

Pre requirement:

  • The Wazuh API token should be expired before generating a PDF report.

Note you could be interested in reducing the token expiration time. Do the next request to Wazuh API:

PUT /security/config
{
  "auth_token_exp_timeout": 30
}

Log out and log in again to get a new token with the updated token expiration time.

Generating the reports should work:

  • Modules: without filters and without pinned agent
  • Modules: with filters
  • Modules: with pinned agent
  • Modules: with filters and pinned agent
  • Agent inventory
  • Agent configuration: all components
  • Agent configuration: some components
  • Groups: all components
  • Groups: some components

Closes #3743

…f token when it expires

  - Replaced the method to do the request from `GenericRequest.request` to `WzRequest.genericReq` that handles the refreshing of token
  - Adapted request payload and endpoint expected parameters for ApiID and the index pattern title
  - Removed not used params of some reports endpoints
  - Remove message of generating pdf report when the process fails
@Desvelao Desvelao added the type/bug Bug issue label Mar 4, 2022
@Desvelao Desvelao self-assigned this Mar 4, 2022
@Desvelao Desvelao requested a review from a team March 4, 2022 10:36
@Desvelao Desvelao changed the title [BUG][Reports] Generate a reports not manage the API token expiration [BUG][Reports] Generate reports not manage the API token expiration Mar 4, 2022
@Desvelao Desvelao changed the title [BUG][Reports] Generate reports not manage the API token expiration [BUG][Reports] Generate reports not manage the Wazuh API token expiration Mar 4, 2022
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.

CR ✅
Test ✅

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.

Test: ✔️
CR: ✔️

@Desvelao Desvelao merged commit 1d03c23 into 4.3-7.10 Apr 6, 2022
@Desvelao Desvelao deleted the fix/3743-generate-report-not-manage-token-expiration branch April 6, 2022 09:46
@github-actions
Copy link
Contributor

github-actions bot commented Apr 6, 2022

Jest Test Coverage % values
Statements 4.04% ( 1476 / 36555 )
Branches 1.61% ( 459 / 28476 )
Functions 2.98% ( 266 / 8934 )
Lines 4.09% ( 1428 / 34947 )

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.

The application does not handle token expiration when a report request is been generated
3 participants