Skip to content

Commit

Permalink
Merge branch 'bugfix/4950-server-address-paste-ip' of https://github.…
Browse files Browse the repository at this point in the history
…com/wazuh/wazuh-kibana-app into bugfix/4950-server-address-paste-ip
  • Loading branch information
Machi3mfl committed Dec 16, 2022
2 parents 2ab7abd + 086e10d commit ac0ed63
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 24 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ All notable changes to the Wazuh app project will be documented in this file.
- Added powerPC architecture in redhat7, in the section 'Deploy new agent'. [4833](https://github.com/wazuh/wazuh-kibana-app/pull/4833)
- Added a centralized service to handle the requests [#4831](https://github.com/wazuh/wazuh-kibana-app/pull/4831)
- Added data-test-subj create policy [#4873](https://github.com/wazuh/wazuh-kibana-app/pull/4873)
- Added file saving conditions in File Editor [#4970](https://github.com/wazuh/wazuh-kibana-app/pull/4970)

### Changed

Expand All @@ -41,10 +42,11 @@ All notable changes to the Wazuh app project will be documented in this file.
- Fixed a bug where the Wazuh logo was used instead of the custom one [#4539](https://github.com/wazuh/wazuh-kibana-app/pull/4539)
- Fixed rendering problems of the `Agent Overview` section in low resolutions [#4516](https://github.com/wazuh/wazuh-kibana-app/pull/4516)
- Fixed issue when logging out from Wazuh when SAML is enabled [#4595](https://github.com/wazuh/wazuh-kibana-app/issues/4595)
- Fixed server errors with code 500 when the Wazuh API is not reachable / up. [#4710](https://github.com/wazuh/wazuh-kibana-app/pull/4710) [#4728](https://github.com/wazuh/wazuh-kibana-app/pull/4728)
- Fixed server errors with code 500 when the Wazuh API is not reachable / up. [#4710](https://github.com/wazuh/wazuh-kibana-app/pull/4710) [#4728](https://github.com/wazuh/wazuh-kibana-app/pull/4728) [#4998](https://github.com/wazuh/wazuh-kibana-app/pull/4998)
- Fixed pagination to SCA table [#4653](https://github.com/wazuh/wazuh-kibana-app/issues/4653)
- Fixed WAZUH_PROTOCOL param suggestion [#4849](https://github.com/wazuh/wazuh-kibana-app/pull/4849)
- Raspbian OS, Ubuntu, Amazon Linux and Amazon Linux 2 commands in the wizard deploy agent now change when a different architecture is selected [#4876](https://github.com/wazuh/wazuh-kibana-app/pull/4876) [#4880](https://github.com/wazuh/wazuh-kibana-app/pull/4880)
- Fixed vulnerabilities default last scan date formatter [#4975](https://github.com/wazuh/wazuh-kibana-app/pull/4975)

## Wazuh v4.3.10 - Kibana 7.10.2, 7.16.x, 7.17.x - Revision 4311

Expand Down
11 changes: 3 additions & 8 deletions public/components/agents/vuls/inventory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
VisualizationBasicWidget,
} from '../../common/charts/visualizations/basic';
import { WzStat } from '../../wz-stat';
import { formatUIDate } from '../../../react-services/time-service';
import { beautifyDate } from './inventory/lib';

interface Aggregation {
title: number;
Expand Down Expand Up @@ -104,11 +104,6 @@ export class Inventory extends Component {
this.colorsVisualizationVulnerabilitiesSummaryData = euiPaletteColorBlind();
}

// when vulnerability module is not configured
// its meant to render nothing when such date is received
beautifyDate(date?: string) {
return date && !['1970-01-01T00:00:00Z', '-'].includes(date) ? formatUIDate(date) : '-';
}

async componentDidMount() {
this._isMount = true;
Expand Down Expand Up @@ -234,8 +229,8 @@ export class Inventory extends Component {
if (isLoading) {
return this.loadingInventory();
}
const last_full_scan = this.beautifyDate(vulnerabilityLastScan.last_full_scan);
const last_partial_scan = this.beautifyDate(vulnerabilityLastScan.last_partial_scan);
const last_full_scan = beautifyDate(vulnerabilityLastScan.last_full_scan);
const last_partial_scan = beautifyDate(vulnerabilityLastScan.last_partial_scan);

const table = this.renderTable();
return (
Expand Down
17 changes: 6 additions & 11 deletions public/components/agents/vuls/inventory/detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { AppNavigate } from '../../../../react-services/app-navigate';
import { TruncateHorizontalComponents } from '../../../common/util';
import { getDataPlugin, getUiSettings } from '../../../../kibana-services';
import { FilterManager } from '../../../../../../../src/plugins/data/public/';
import { formatUIDate } from '../../../../react-services/time-service';
import { beautifyDate } from './lib/';
export class Details extends Component {
props!: {
currentItem: {
Expand Down Expand Up @@ -132,28 +132,28 @@ export class Details extends Component {
name: 'Last full scan',
icon: 'clock',
link: false,
transformValue: this.beautifyDate
transformValue: beautifyDate
},
{
field: 'last_partial_scan',
name: 'Last partial scan',
icon: 'clock',
link: false,
transformValue: this.beautifyDate
transformValue: beautifyDate
},
{
field: 'published',
name: 'Published',
icon: 'clock',
link: false,
transformValue: this.beautifyDate
transformValue: beautifyDate
},
{
field: 'updated',
name: 'Updated',
icon: 'clock',
link: false,
transformValue: this.beautifyDate
transformValue: beautifyDate
},
{
field: 'external_references',
Expand All @@ -165,12 +165,7 @@ export class Details extends Component {
];
}

// This method was created because Wazuh API returns 1970-01-01T00:00:00Z dates or undefined ones
// when vulnerability module is not configured
// its meant to render nothing when such date is received
beautifyDate(date?: string) {
return date && !['1970-01-01T00:00:00Z', '-'].includes(date) ? formatUIDate(date) : '-';
}


viewInEvents = (ev) => {
const { cve } = this.props.currentItem;
Expand Down
3 changes: 2 additions & 1 deletion public/components/agents/vuls/inventory/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './api-requests';
export * from './api-requests';
export * from './utils';
10 changes: 10 additions & 0 deletions public/components/agents/vuls/inventory/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { formatUIDate } from '../../../../../react-services/time-service';

// This method was created because Wazuh API returns 1970-01-01T00:00:00Z dates or undefined ones
// when vulnerability module is not configured
// its meant to render nothing when such date is received
export function beautifyDate(date?: string) {
return date &&
(!['-'].includes(date) && !date.startsWith('1970')) ?
formatUIDate(date) : '-';
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ class WzFileEditor extends Component {
this._isMounted = true;
}

/**
* Check if the file content has changed and is not empty
*/
contentHasChanged() {
return !!this.state.content.trim() && (this.state.content.trim() !== this.state.initContent.trim());
}

/**
* Save the new content
Expand Down Expand Up @@ -129,7 +135,7 @@ class WzFileEditor extends Component {

let toastMessage;

if (this.props.state.addingFile != false) {
if (this.props.addingFile != false) {
//remove current invalid file if the file is new.
await this.resourcesHandler.deleteFile(name);
toastMessage = 'The new file was deleted.';
Expand Down Expand Up @@ -243,7 +249,7 @@ class WzFileEditor extends Component {
fill
iconType={isEditable && xmlError ? 'alert' : 'save'}
isLoading={this.state.isSaving}
isDisabled={nameForSaving.length <= 4 || !!(isEditable && xmlError)}
isDisabled={nameForSaving.length <= 4 || !!(isEditable && xmlError) || !this.contentHasChanged()}
onClick={() => this.save(nameForSaving, overwrite)}
>
{isEditable && xmlError ? 'XML format error' : 'Save'}
Expand Down
2 changes: 1 addition & 1 deletion server/controllers/wazuh-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ export class WazuhApiCtrl {

log('wazuh-api:csv', `Report ${tmpPath}`, 'debug');
// Real limit, regardless the user query
const params = { limit: HTTP_STATUS_CODES.INTERNAL_SERVER_ERROR };
const params = { limit: 500 };

if (filters.length) {
for (const filter of filters) {
Expand Down

0 comments on commit ac0ed63

Please sign in to comment.