Skip to content

Commit

Permalink
Fix filtering of not applicable SCA checks using result filter (#…
Browse files Browse the repository at this point in the history
…5031)

* fix(sca): change the filter of not applicable SCA checks to use result and remove the `status` filter in the search bar

* fix(sca): sort the filters keys in the suggestions of the SCA checks search bar

* changelog: add the pull request entry

* fix(sca): remove hardcoded `Not applicable` string when the SCA check result was falsy. Now it uses the result value.

* fix: unify the SCA check result label name

* changelog: add pull request entry

* fix: update the API data (endpoints and security actions)

Co-authored-by: Ian Yenien Serrano <[email protected]>
Co-authored-by: Chantal Belén kelm <[email protected]>
  • Loading branch information
3 people authored Jan 6, 2023
1 parent 5585d8c commit dd81bc6
Show file tree
Hide file tree
Showing 7 changed files with 523 additions and 243 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ All notable changes to the Wazuh app project will be documented in this file.
- Updated the `winston` dependency to `3.5.1` [#4985](https:/wazuh/wazuh-kibana-app/pull/4985)
- Updated the `pdfmake` dependency to `0.2.6` [#4985](https:/wazuh/wazuh-kibana-app/pull/4985)
- The button to export the app logs is now disabled when there are no results, instead of showing an error toast [#4992](https:/wazuh/wazuh-kibana-app/pull/4992)
- Unify the SCA check result label name [#5031](https:/wazuh/wazuh-kibana-app/pull/5031)
- Updated `pdfmake, mocha and json5` dependencies [#5062](https:/wazuh/wazuh-kibana-app/pull/5062)


### Fixed

- Fixed nested fields filtering in dashboards tables and KPIs [#4425](https:/wazuh/wazuh-kibana-app/pull/4425)
Expand All @@ -58,6 +60,7 @@ All notable changes to the Wazuh app project will be documented in this file.
- Fixed agent deployment instructions for HP-UX and Solaris. [#4943](https:/wazuh/wazuh-kibana-app/pull/4943)
- Fixed a bug that caused the flyouts to close when clicking inside them [#4638](https:/wazuh/wazuh-kibana-app/pull/4638)
- Fixed the manager option in the agent deployment section [#4981](https:/wazuh/wazuh-kibana-app/pull/4981)
- Fixed Inventory checks table filters by stats [#4999](https:/wazuh/wazuh-kibana-app/pull/4999) [#5031](https:/wazuh/wazuh-kibana-app/pull/5031)
- Fixed commands in the deploy new agent section(most of the commands are missing '-1') [#4962](https:/wazuh/wazuh-kibana-app/pull/4962)
- Fixed agent installation command for macOS in the deploy new agent section. [#4968](https:/wazuh/wazuh-kibana-app/pull/4968)
- Deploy new agent section: Fixed the way macos versions and architectures were displayed, fixed the way agents were displayed, fixed the way ubuntu versions were displayed. [#4933](https:/wazuh/wazuh-kibana-app/pull/4933)
Expand Down
627 changes: 440 additions & 187 deletions common/api-info/endpoints.json

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions common/api-info/security-actions.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"GET /agents/{agent_id}/config/{component}/{configuration}",
"GET /agents/{agent_id}/group/is_sync",
"GET /agents/{agent_id}/key",
"GET /agents/{agent_id}/daemons/stats",
"GET /agents/{agent_id}/stats/{component}",
"GET /groups/{group_id}/agents",
"GET /agents/no_group",
Expand Down Expand Up @@ -280,10 +281,12 @@
"GET /cluster/local/info",
"GET /cluster/nodes",
"GET /cluster/healthcheck",
"GET /cluster/ruleset/synchronization",
"GET /cluster/local/config",
"GET /cluster/{node_id}/status",
"GET /cluster/{node_id}/info",
"GET /cluster/{node_id}/configuration",
"GET /cluster/{node_id}/daemons/stats",
"GET /cluster/{node_id}/stats",
"GET /cluster/{node_id}/stats/hourly",
"GET /cluster/{node_id}/stats/weekly",
Expand Down Expand Up @@ -505,6 +508,7 @@
"GET /manager/status",
"GET /manager/info",
"GET /manager/configuration",
"GET /manager/daemons/stats",
"GET /manager/stats",
"GET /manager/stats/hourly",
"GET /manager/stats/weekly",
Expand Down Expand Up @@ -1085,6 +1089,24 @@
"GET /tasks/status"
]
},
"vulnerability:run": {
"description": "Allow running a vulnerability detector scan",
"resources": [
"*:*"
],
"example": {
"actions": [
"vulnerability:run"
],
"resources": [
"*:*:*"
],
"effect": "allow"
},
"related_endpoints": [
"PUT /vulnerability"
]
},
"vulnerability:read": {
"description": "Allow reading agents' vulnerabilities information",
"resources": [
Expand Down
7 changes: 7 additions & 0 deletions common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1918,3 +1918,10 @@ export enum HTTP_STATUS_CODES {
INSUFFICIENT_STORAGE = 507,
NETWORK_AUTHENTICATION_REQUIRED = 511
}

// Module Security configuration assessment
export const MODULE_SCA_CHECK_RESULT_LABEL = {
passed: 'Passed',
failed: 'Failed',
'not applicable': 'Not applicable'
}
21 changes: 11 additions & 10 deletions public/components/agents/sca/inventory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
} from '../../../react-services/error-orchestrator/types';
import {
API_NAME_AGENT_STATUS,
MODULE_SCA_CHECK_RESULT_LABEL,
UI_LOGGER_LEVELS,
} from '../../../../common/constants';
import { getErrorOrchestrator } from '../../../react-services/common-services';
Expand Down Expand Up @@ -113,19 +114,19 @@ export class Inventory extends Component<InventoryProps, InventoryState> {
},
{
field: 'pass',
name: 'Pass',
name: MODULE_SCA_CHECK_RESULT_LABEL.passed,
width: '100px',
sortable: true,
},
{
field: 'fail',
name: 'Fail',
name: MODULE_SCA_CHECK_RESULT_LABEL.failed,
width: '100px',
sortable: true,
},
{
field: 'invalid',
name: 'Not applicable',
name: MODULE_SCA_CHECK_RESULT_LABEL['not applicable'],
width: '100px',
sortable: true,
},
Expand Down Expand Up @@ -458,17 +459,17 @@ export class Inventory extends Component<InventoryProps, InventoryState> {
size={{ width: '100%', height: '150px' }}
data={[
{
label: 'Pass',
label: MODULE_SCA_CHECK_RESULT_LABEL.passed,
value: policy.pass,
color: '#00a69b',
},
{
label: 'Fail',
label: MODULE_SCA_CHECK_RESULT_LABEL.failed,
value: policy.fail,
color: '#ff645c',
},
{
label: 'Not applicable',
label: MODULE_SCA_CHECK_RESULT_LABEL['not applicable'],
value: policy.invalid,
color: '#5c6773',
},
Expand Down Expand Up @@ -558,7 +559,7 @@ export class Inventory extends Component<InventoryProps, InventoryState> {
'result',
'passed',
)}
description='Pass'
description={MODULE_SCA_CHECK_RESULT_LABEL.passed}
titleColor='secondary'
titleSize='m'
textAlign='center'
Expand All @@ -571,7 +572,7 @@ export class Inventory extends Component<InventoryProps, InventoryState> {
'result',
'failed',
)}
description='Fail'
description={MODULE_SCA_CHECK_RESULT_LABEL.failed}
titleColor='danger'
titleSize='m'
textAlign='center'
Expand All @@ -581,10 +582,10 @@ export class Inventory extends Component<InventoryProps, InventoryState> {
<EuiStat
title={this.buttonStat(
this.state.lookingPolicy.invalid,
'status',
'result',
'not applicable',
)}
description='Not applicable'
description={MODULE_SCA_CHECK_RESULT_LABEL['not applicable']}
titleColor='subdued'
titleSize='m'
textAlign='center'
Expand Down
79 changes: 36 additions & 43 deletions public/components/agents/sca/inventory/checks-table.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { EuiButtonIcon, EuiDescriptionList, EuiHealth } from '@elastic/eui';
import React, { Component } from 'react';
import { MODULE_SCA_CHECK_RESULT_LABEL } from '../../../../../common/constants';
import { TableWzAPI } from '../../../common/tables';
import { IWzSuggestItem } from '../../../wz-search-bar';
import { ComplianceText, RuleText } from '../components';
Expand Down Expand Up @@ -49,74 +50,58 @@ export class InventoryPolicyChecksTable extends Component<Props, State> {
},
{
type: 'params',
label: 'file',
description: 'Filter by check file',
operators: ['=', '!='],
values: (value) =>
getFilterValues('file', value, this.props.agent.id, this.props.lookingPolicy.policy_id),
},
{
type: 'params',
label: 'title',
description: 'Filter by check title',
operators: ['=', '!='],
values: (value) =>
getFilterValues('title', value, this.props.agent.id, this.props.lookingPolicy.policy_id),
},
{
type: 'params',
label: 'result',
description: 'Filter by check result',
label: 'description',
description: 'Filter by check description',
operators: ['=', '!='],
values: (value) =>
getFilterValues('result', value, this.props.agent.id, this.props.lookingPolicy.policy_id),
getFilterValues(
'description',
value,
this.props.agent.id,
this.props.lookingPolicy.policy_id
),
},
{
type: 'params',
label: 'status',
description: 'Filter by check status',
label: 'file',
description: 'Filter by check file',
operators: ['=', '!='],
values: (value) =>
getFilterValues('status', value, this.props.agent.id, this.props.lookingPolicy.policy_id),
getFilterValues('file', value, this.props.agent.id, this.props.lookingPolicy.policy_id),
},
{
type: 'params',
label: 'rationale',
description: 'Filter by check rationale',
label: 'registry',
description: 'Filter by check registry',
operators: ['=', '!='],
values: (value) =>
getFilterValues(
'rationale',
'registry',
value,
this.props.agent.id,
this.props.lookingPolicy.policy_id
),
},
{
type: 'params',
label: 'registry',
description: 'Filter by check registry',
label: 'rationale',
description: 'Filter by check rationale',
operators: ['=', '!='],
values: (value) =>
getFilterValues(
'registry',
'rationale',
value,
this.props.agent.id,
this.props.lookingPolicy.policy_id
),
},
{
type: 'params',
label: 'description',
description: 'Filter by check description',
label: 'reason',
description: 'Filter by check reason',
operators: ['=', '!='],
values: (value) =>
getFilterValues(
'description',
value,
this.props.agent.id,
this.props.lookingPolicy.policy_id
),
getFilterValues('reason', value, this.props.agent.id, this.props.lookingPolicy.policy_id),
},
{
type: 'params',
Expand All @@ -133,11 +118,19 @@ export class InventoryPolicyChecksTable extends Component<Props, State> {
},
{
type: 'params',
label: 'reason',
description: 'Filter by check reason',
label: 'result',
description: 'Filter by check result',
operators: ['=', '!='],
values: (value) =>
getFilterValues('reason', value, this.props.agent.id, this.props.lookingPolicy.policy_id),
getFilterValues('result', value, this.props.agent.id, this.props.lookingPolicy.policy_id),
},
{
type: 'params',
label: 'title',
description: 'Filter by check title',
operators: ['=', '!='],
values: (value) =>
getFilterValues('title', value, this.props.agent.id, this.props.lookingPolicy.policy_id),
},
];
this.columnsChecks = [
Expand Down Expand Up @@ -280,8 +273,8 @@ export class InventoryPolicyChecksTable extends Component<Props, State> {
* @param result
* @returns
*/
addHealthResultRender(result) {
const color = (result) => {
addHealthResultRender(result: keyof typeof MODULE_SCA_CHECK_RESULT_LABEL) {
const color = (result: keyof typeof MODULE_SCA_CHECK_RESULT_LABEL) => {
if (result.toLowerCase() === 'passed') {
return 'success';
} else if (result.toLowerCase() === 'failed') {
Expand All @@ -292,8 +285,8 @@ export class InventoryPolicyChecksTable extends Component<Props, State> {
};

return (
<EuiHealth color={color(result)} style={{ textTransform: 'capitalize' }}>
{result || 'Not applicable'}
<EuiHealth color={color(result)}>
{MODULE_SCA_CHECK_RESULT_LABEL[result]}
</EuiHealth>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { getAngularModule } from '../../../../../kibana-services';
import { withReduxProvider, withUserAuthorizationPrompt } from "../../../hocs";
import { compose } from 'redux';
import SCAPoliciesTable from '../../../../agents/sca/inventory/agent-policies-table';
import { MODULE_SCA_CHECK_RESULT_LABEL } from '../../../../../../common/constants';

type Props = {
agent: { [key in string]: any };
Expand Down Expand Up @@ -144,17 +145,17 @@ export const ScaScan = compose(
},
{
field: 'pass',
name: 'Pass',
name: MODULE_SCA_CHECK_RESULT_LABEL.passed,
width: '10%',
},
{
field: 'fail',
name: 'Fail',
name: MODULE_SCA_CHECK_RESULT_LABEL.failed,
width: '10%',
},
{
field: 'invalid',
name: 'Not applicable',
name: MODULE_SCA_CHECK_RESULT_LABEL['not applicable'],
width: '10%',
},
{
Expand Down

0 comments on commit dd81bc6

Please sign in to comment.