Skip to content

Commit

Permalink
change: update from main
Browse files Browse the repository at this point in the history
  • Loading branch information
daniele-mng committed Sep 23, 2024
1 parent 2cce73f commit 28cac79
Show file tree
Hide file tree
Showing 111 changed files with 9,176 additions and 1,039 deletions.
3 changes: 3 additions & 0 deletions allowedSnakeCase.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ module.exports = [
'_asset_id',
'asset_id',
'assigned_to',
'audit_report',
'audit_reports',
'auth_algorithm',
'auth_conf_setting',
'auth_method',
Expand Down Expand Up @@ -248,6 +250,7 @@ module.exports = [
'highest_severity',
'high_per_host',
'host_allow',
'host_compliance',
'host_cves',
'hostnames_by_ip',
'hosts_allow',
Expand Down
1,724 changes: 955 additions & 769 deletions package-lock.json

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gsa",
"version": "23.2.2-dev1",
"version": "23.3.1-dev1",
"description": "Greenbone Security Assistant",
"keywords": [
"openvas",
Expand Down Expand Up @@ -35,7 +35,7 @@
"@greenbone/opensight-ui-components": "^0.3.0",
"@mantine/core": "^6.0.0",
"@reduxjs/toolkit": "^2.2.7",
"@sentry/react": "^8.22.0",
"@sentry/react": "^8.28.0",
"@visx/axis": "^3.10.1",
"@visx/gradient": "^3.3.0",
"@visx/shape": "^3.5.0",
Expand All @@ -49,21 +49,21 @@
"d3-interpolate": "^3.0.1",
"d3-scale": "^4.0.2",
"d3-shape": "^3.2.0",
"downshift": "^9.0.7",
"downshift": "^9.0.8",
"fast-deep-equal": "^3.1.3",
"fast-xml-parser": "^4.4.1",
"history": "^4.10.1",
"hoist-non-react-statics": "^3.3.2",
"i18next": "^23.12.2",
"i18next-http-backend": "^2.5.2",
"i18next": "^23.14.0",
"i18next-http-backend": "^2.6.1",
"ical.js": "^2.0.0",
"lucide-react": "^0.439.0",
"memoize-one": "^6.0.0",
"moment": "^2.30.1",
"moment-timezone": "^0.5.45",
"prop-types": "^15.8.1",
"qhistory": "^1.1.0",
"qs": "^6.12.3",
"qs": "^6.13.0",
"react": "^18.3.1",
"react-beautiful-dnd": "^13.1.1",
"react-dom": "^18.3.1",
Expand All @@ -73,40 +73,40 @@
"redux": "^5.0.1",
"redux-logger": "^3.0.6",
"resize-observer-polyfill": "^1.5.1",
"styled-components": "^6.1.12",
"styled-components": "^6.1.13",
"uuid": "^10.0.0",
"whatwg-fetch": "^3.6.20"
},
"devDependencies": {
"@babel/cli": "^7.24.8",
"@babel/cli": "^7.25.6",
"@pandatix/js-cvss": "^0.4.4",
"@testing-library/jest-dom": "^6.4.8",
"@testing-library/react": "^16.0.0",
"@testing-library/jest-dom": "^6.5.0",
"@testing-library/react": "^16.0.1",
"@testing-library/user-event": "^14.5.2",
"@types/react": "^18.3.3",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/eslint-plugin": "^8.4.0",
"@typescript-eslint/parser": "^8.0.0",
"@vitejs/plugin-legacy": "^5.4.1",
"@vitejs/plugin-legacy": "^5.4.2",
"@vitejs/plugin-react": "^4.3.1",
"@vitest/coverage-v8": "^2.0.5",
"@vitest/ui": "^2.0.5",
"babel-plugin-i18next-extract": "^0.10.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-react": "^7.35.0",
"eslint-plugin-react": "^7.35.2",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.9",
"eslint-plugin-react-refresh": "^0.4.11",
"eslint-plugin-vitest": "^0.5.4",
"eslint-plugin-vitest-globals": "^1.5.0",
"husky": "^2.7.0",
"jest-styled-components": "^7.2.0",
"jsdom": "^24.1.1",
"jsdom": "^25.0.0",
"lint-staged": "^13.1.0",
"prettier": "^3.3.3",
"typescript": "^5.5.4",
"vite": "^5.3.5",
"vite": "^5.4.3",
"vite-plugin-eslint": "^1.8.1",
"vite-plugin-eslint2": "^4.4.0",
"vite-plugin-svgr": "^4.2.0",
Expand Down
9 changes: 9 additions & 0 deletions public/locales/gsa-de.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@
"Audit made visible for:\n{{user}}\n{{role}}\n{{group}}": "Audit sichtbar gemacht für:\n{{user}}\n{{role}}\n{{group}}",
"Audit: {{name}}": "Audit: {{name}}",
"Audits": "Audits",
"Audit Reports by Compliance (Total: {{count}})": "Audit-Berichte nach Compliance (Gesamt: {{count}})",
"Audit Reports": "Audit-Berichte",
"Audit Report": "Audit-Bericht",
"Audits using this Policy": "Audits, die diese Richtlinie verwenden",
"Auth": "Auth.",
"Auth Algorithm": "Auth-Algorithmus",
Expand Down Expand Up @@ -245,6 +248,7 @@
"Certificate in use will expire at {{date}}": "Aktuelles Zertifikat wird am {{date}} ablaufen",
"Change Password": "Passwort ändern",
"Changed": "Verändert",
"Chart: Audit Reports by Compliance": "Diagramm: Audit-Berichte nach Compliance",
"Chart: CERT-Bund Advisories by CVSS": "Diagramm: CERT-Bund-Advisories nach CVSS",
"Chart: CERT-Bund Advisories by Creation Time": "Diagramm: CERT-Bund-Advisories nach Erstellungszeit",
"Chart: CERT-Bund Advisories by Severity Class": "Diagramm: CERT-Bund-Advisories nach Schweregradklasse",
Expand Down Expand Up @@ -325,6 +329,8 @@
"Complete": "Vollständig",
"Complexity": "Komplexität",
"Compliance Audits": "Compliance Audits",
"Compliance Audit Reports": "Compliance-Audit-Berichte",
"Compliance Percent": "Compliance-Prozent",
"Compliance Policies": "Compliance Richtlinien",
"Compliance Status": "Compliance Status",
"Compose": "Zusammenstellen",
Expand Down Expand Up @@ -849,6 +855,7 @@
"Include log messages in your filter settings.": "Log-Nachrichten in die Filtereinstellungen einbeziehen.",
"Include report": "Bericht einfügen",
"Included": "Beinhaltet",
"Incomplete": "Unvollständig",
"Info": "Info",
"Information": "Informationen",
"Inheriting user": "Erbender Benutzer",
Expand Down Expand Up @@ -1554,6 +1561,7 @@
"TLS Certificates by Modification Time (Total: {{count}})": "TLS-Zertifikate nach Änderungszeit (Gesamt: {{count}})",
"TLS Certificates by Status (Total: {{count}})": "TLS-Zertifikate nach Status (Gesamt: {{count}})",
"TLS Certificates for this Host": "TLS-Zertifikate für diesen Host",
"Table: Audit Reports by Compliance": "Tabelle: Audit-Berichte nach Compliance",
"Table: CERT-Bund Advisories by CVSS": "Tabelle: CERT-Bund-Advisories nach CVSS",
"Table: CERT-Bund Advisories by Creation Time": "Tabelle: CERT-Bund-Advisories nach Erstellungszeit",
"Table: CERT-Bund Advisories by Severity Class": "Tabelle: CERT-Bund-Advisories nach Schweregradklasse",
Expand Down Expand Up @@ -1920,6 +1928,7 @@
"task": "Aufgabe",
"to": "für",
"undefined": "undefiniert",
"Undefined": "Undefiniert",
"until {{- enddate}}": "bis {{- enddate}}",
"verinice Connector": "verinice-Konnektor",
"verinice.PRO Connector": "verinice.PRO-Konnektor",
Expand Down
15 changes: 11 additions & 4 deletions src/gmp/capabilities/capabilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {pluralizeType} from 'gmp/utils/entitytype';
import {parseBoolean} from 'gmp/parser';

const types = {
audit: 'task',
audits: 'task',
auditreport: 'audit_report',
auditreports: 'audit_reports',
host: 'asset',
hosts: 'asset',
os: 'asset',
Expand Down Expand Up @@ -42,12 +42,19 @@ const types = {
tlscertificates: 'tls_certificate',
};

const subtypes = {
audit: 'task',
audits: 'task',
audit_report: 'report',
audit_reports: 'reports',
};

const convertType = type => {
const ctype = types[type];
if (isDefined(ctype)) {
return ctype;
type = ctype;
}
return type;
return subtypes[type] || type;
};

class Capabilities {
Expand Down
33 changes: 33 additions & 0 deletions src/gmp/commands/__tests__/auditreport.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* SPDX-FileCopyrightText: 2024 Greenbone AG
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import {describe, test, expect} from '@gsa/testing';
import {createHttp, createEntityResponse} from 'gmp/commands/testing';
import {AuditReportCommand} from 'gmp/commands/auditreports';

describe('AuditReportCommand tests', () => {
test('should request single audit report', () => {
const response = createEntityResponse('report', {_id: 'foo'});
const fakeHttp = createHttp(response);

expect.hasAssertions();

const cmd = new AuditReportCommand(fakeHttp);
return cmd.get({id: 'foo'}).then(resp => {
expect(fakeHttp.request).toHaveBeenCalledWith('get', {
args: {
cmd: 'get_report',
report_id: 'foo',
ignore_pagination: 1,
details: 1,
lean: 1,
},
});

const {data} = resp;
expect(data.id).toEqual('foo');
});
});
});
92 changes: 92 additions & 0 deletions src/gmp/commands/__tests__/auditreports.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/* SPDX-FileCopyrightText: 2024 Greenbone AG
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import {describe, test, expect} from '@gsa/testing';
import {ALL_FILTER} from 'gmp/models/filter';

import {
createHttp,
createEntitiesResponse,
createAggregatesResponse,
} from '../testing';
import {AuditReportsCommand} from 'gmp/commands/auditreports';

describe('AuditReportsCommand tests', () => {
test('should return all audit reports', () => {
const response = createEntitiesResponse('report', [
{
_id: '1',
},
{
_id: '2',
},
]);

const fakeHttp = createHttp(response);

expect.hasAssertions();

const cmd = new AuditReportsCommand(fakeHttp);
return cmd.getAll().then(resp => {
expect(fakeHttp.request).toHaveBeenCalledWith('get', {
args: {
cmd: 'get_reports',
details: 0,
filter: ALL_FILTER.toFilterString(),
usage_type: 'audit',
},
});
const {data} = resp;
expect(data.length).toEqual(2);
});
});

test('should return results', () => {
const response = createEntitiesResponse('report', [
{
_id: '1',
},
{
_id: '2',
},
]);

const fakeHttp = createHttp(response);

expect.hasAssertions();

const cmd = new AuditReportsCommand(fakeHttp);
return cmd.get().then(resp => {
expect(fakeHttp.request).toHaveBeenCalledWith('get', {
args: {
cmd: 'get_reports',
details: 0,
usage_type: 'audit',
},
});
const {data} = resp;
expect(data.length).toEqual(2);
});
});

test('should aggregate compliance counts', () => {
const response = createAggregatesResponse();
const fakeHttp = createHttp(response);

expect.hasAssertions();

const cmd = new AuditReportsCommand(fakeHttp);
return cmd.getComplianceAggregates().then(resp => {
expect(fakeHttp.request).toHaveBeenCalledWith('get', {
args: {
cmd: 'get_aggregate',
aggregate_type: 'report',
group_column: 'compliant',
usage_type: 'audit',
},
});
});
});
});
2 changes: 2 additions & 0 deletions src/gmp/commands/__tests__/reports.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe('ReportsCommand tests', () => {
cmd: 'get_reports',
details: 0,
filter: ALL_FILTER.toFilterString(),
usage_type: 'scan',
},
});
const {data} = resp;
Expand Down Expand Up @@ -59,6 +60,7 @@ describe('ReportsCommand tests', () => {
args: {
cmd: 'get_reports',
details: 0,
usage_type: 'scan',
},
});
const {data} = resp;
Expand Down
Loading

0 comments on commit 28cac79

Please sign in to comment.