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

Explicit Compliance #1495

Merged
merged 66 commits into from
Jul 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
e0ce85a
Add basic pages for policies and audits
sarahd93 Jun 4, 2019
d76ef8e
add a basic createauditdialog
sarahd93 Jun 5, 2019
e549e46
add policy as scanconfig and compliance tag to dialog
sarahd93 Jun 6, 2019
54fcb3f
improve dialog and add import and delete for policies
sarahd93 Jun 13, 2019
6a66c89
add edit dialog and remove some unused code
sarahd93 Jun 13, 2019
3277dfd
add greenbone compliance report download
sarahd93 Jun 18, 2019
16b1532
add create and import policy
sarahd93 Jun 18, 2019
900c815
clean up policy files and add basis for detailspage
sarahd93 Jun 19, 2019
d2755d2
clean up audit files and add basis for detailspage
sarahd93 Jun 20, 2019
b92e182
add import and edit dialog for policies
sarahd93 Jun 21, 2019
330db09
add policy and audit icons
sarahd93 Jun 21, 2019
116f726
add more options to create audit dialog
sarahd93 Jun 24, 2019
e71f6bb
Separate policies and scanconfigs and use policy model and commands
sarahd93 Jul 5, 2019
25f6fe9
add edit dialog for policies
sarahd93 Jul 8, 2019
665e6e0
add detailspage for policies
sarahd93 Jul 8, 2019
07569c6
remove tags, manual icons and filter dialog from policies
sarahd93 Jul 8, 2019
2397bd4
rename some variables
sarahd93 Jul 9, 2019
92711cd
add create audit dialog to audit page
sarahd93 Jul 9, 2019
794c3cf
separate audits and tasks and use audit model and commands
sarahd93 Jul 10, 2019
4d34238
add detailspage for audits and adjust detailspage for policies
sarahd93 Jul 10, 2019
2cc59e5
rename some variables
sarahd93 Jul 11, 2019
c0a8091
add compliance status
sarahd93 Jul 11, 2019
1775682
Fix edit policy dialog
sarahd93 Jul 15, 2019
7168fc9
remove manual icon and filter dialog from audits
sarahd93 Jul 15, 2019
c8f5b9f
rename some variables for audits
sarahd93 Jul 15, 2019
746f16b
add capabilities to compliance menu
sarahd93 Jul 16, 2019
3fb262b
fix audit dialog and clean up audit component
sarahd93 Jul 16, 2019
3e3bdb9
add usage_type to scanconfig and task commands
sarahd93 Jul 16, 2019
11b5c32
rename some variables for policies
sarahd93 Jul 16, 2019
249ffb2
redirect audits to audit detailspage
sarahd93 Jul 17, 2019
5119989
move policies and audits to resilience menu
sarahd93 Jul 17, 2019
7b61644
add audits and policies to trashcan
sarahd93 Jul 18, 2019
979d471
add permissions for policies and audits
sarahd93 Jul 18, 2019
14d1b96
remove tags and filterdialog
sarahd93 Jul 18, 2019
6c611a4
change audit commands and variables to camel case
sarahd93 Jul 19, 2019
bd85965
add new themes for compliance status
sarahd93 Jul 19, 2019
2dd44e6
update task command test and datepicker snapshot
sarahd93 Jul 19, 2019
2b4dbe4
update reducers test
sarahd93 Jul 22, 2019
8948ba4
adjust date in copyright
sarahd93 Jul 22, 2019
07d5483
add tests for compliance status bar
sarahd93 Jul 22, 2019
a9a50be
add tests for store for audits and policies
sarahd93 Jul 22, 2019
253fccd
add tests for audit and policy models
sarahd93 Jul 22, 2019
2f32723
remove import report for audits
sarahd93 Jul 23, 2019
a4c8366
add tests for audit start icon and audit resume icon
sarahd93 Jul 24, 2019
ebc9475
Fix empty tables in trashcan are not visible
sarahd93 Jul 25, 2019
de93455
add tests for audit actions and fix icon tooltips
sarahd93 Jul 26, 2019
383cd5d
adjust gcr report download
sarahd93 Jul 26, 2019
68c8032
use same change handler for all entities in audit component
sarahd93 Jul 26, 2019
68dbef8
use new filename format for report download
sarahd93 Jul 26, 2019
3357d47
add missing details to audits
sarahd93 Jul 26, 2019
fa65e6a
adjust audit table
sarahd93 Jul 26, 2019
ac536fa
fix permissions command
sarahd93 Jul 29, 2019
a83c727
update actions and datepicker snapshots
sarahd93 Jul 29, 2019
5139340
update policy model and commands
sarahd93 Jul 29, 2019
e15bae8
update audit model
sarahd93 Jul 30, 2019
d1e44de
fix audit model
sarahd93 Jul 30, 2019
0e2f303
update policy header and table
sarahd93 Jul 30, 2019
35bfb3a
only use one audit dialog
sarahd93 Jul 30, 2019
ef8103c
update theme
sarahd93 Jul 30, 2019
ab71f71
fix compliance status bar imports
sarahd93 Jul 30, 2019
f1f012e
move constants to task model
sarahd93 Jul 31, 2019
dea4f87
fix policy row
sarahd93 Jul 31, 2019
49d8da6
update changelog
sarahd93 Jul 31, 2019
6e9c61b
fix capabilities in menubar
sarahd93 Jul 31, 2019
d2dc30e
use scanconfig import dialog for policies
sarahd93 Jul 31, 2019
4787a67
remove unused variables from policy dialog
sarahd93 Jul 31, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased]

### Added
- Added Explicit Compliance [#1495](https://github.com/greenbone/gsa/pull/1495)
- added tasktrendgroup component for tasks filter dialog [#1511](https://github.com/greenbone/gsa/pull/1511)
- Added HorizontalSep component for horizontal lists. [#1494](https://github.com/greenbone/gsa/pull/1494)
- added BooleanFilterGroup and changed notes filter dialog [#1493](https://github.com/greenbone/gsa/pull/1493)
Expand Down
4 changes: 4 additions & 0 deletions gsa/src/gmp/capabilities/capabilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import {map} from '../utils/array';
import {pluralizeType} from '../utils/entitytype';

const types = {
audit: 'task',
audits: 'task',
host: 'asset',
hosts: 'asset',
os: 'asset',
Expand All @@ -43,6 +45,8 @@ const types = {
certbunds: 'info',
secinfo: 'info',
secinfos: 'info',
policy: 'config',
policies: 'config',
portlist: 'port_list',
portlists: 'port_list',
reportformat: 'report_format',
Expand Down
2 changes: 2 additions & 0 deletions gsa/src/gmp/commands/__tests__/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ describe('TaskCommand tests', () => {
source_iface: undefined,
task_id: 'task1',
target_id: 0,
usage_type: 'scan',
},
});

Expand Down Expand Up @@ -287,6 +288,7 @@ describe('TaskCommand tests', () => {
source_iface: 'eth0',
task_id: 'task1',
target_id: 't1',
usage_type: 'scan',
},
});

Expand Down
219 changes: 219 additions & 0 deletions gsa/src/gmp/commands/audits.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
/* Copyright (C) 2019 Greenbone Networks GmbH
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/
import logger from '../log';

import registerCommand from '../command';

import {NO_VALUE} from '../parser';

import Audit, {HOSTS_ORDERING_SEQUENTIAL} from '../models/audit';

import EntitiesCommand from './entities';
import EntityCommand from './entity';

const log = logger.getLogger('gmp.commands.audits');

export class AuditCommand extends EntityCommand {
constructor(http) {
super(http, 'task', Audit);
}

start({id}) {
log.debug('Starting audit...');

return this.httpPost({
cmd: 'start_task',
id,
})
.then(() => {
log.debug('Started audit');
return this.get({id});
})
.catch(err => {
log.error('An error occurred while starting the audit', id, err);
throw err;
});
}

stop({id}) {
log.debug('Stopping audit');

return this.httpPost({
cmd: 'stop_task',
id,
})
.then(() => {
log.debug('Stopped audit');
return this.get({id});
})
.catch(err => {
log.error('An error occurred while stopping the audit', id, err);
throw err;
});
}

resume({id}) {
return this.httpPost({
cmd: 'resume_task',
id,
})
.then(() => {
log.debug('Resumed audit');
return this.get({id});
})
.catch(err => {
log.error('An error occurred while resuming the audit', id, err);
throw err;
});
}

create(args) {
const {
addTag,
alertIds = [],
alterable,
applyOverrides,
autoDelete,
autoDeleteData,
comment = '',
policyId,
hostsOrdering,
inAssets,
maxChecks,
maxHosts,
minQod,
name,
scannerType,
scannerId,
scheduleId,
schedulePeriods,
sourceIface,
tagId,
targetId,
} = args;

const data = {
cmd: 'create_task',
add_tag: addTag,
'alert_ids:': alertIds,
alterable,
apply_overrides: applyOverrides,
auto_delete: autoDelete,
auto_delete_data: autoDeleteData,
comment,
config_id: policyId,
hosts_ordering: hostsOrdering,
in_assets: inAssets,
max_checks: maxChecks,
max_hosts: maxHosts,
min_qod: minQod,
name,
scanner_id: scannerId,
scanner_type: scannerType,
schedule_id: scheduleId,
schedule_periods: schedulePeriods,
source_iface: sourceIface,
tag_id: tagId,
target_id: targetId,
usage_type: 'audit',
};
log.debug('Creating audit', args, data);
return this.action(data);
}

save(args) {
const {
alertIds = [],
alterable,
autoDelete,
autoDeleteData,
applyOverrides,
comment = '',
policyId = NO_VALUE,
hostsOrdering = HOSTS_ORDERING_SEQUENTIAL,
id,
inAssets,
maxChecks,
maxHosts,
minQod,
name,
scannerId = NO_VALUE,
scannerType,
scheduleId = NO_VALUE,
schedulePeriods,
targetId = NO_VALUE,
sourceIface,
} = args;
const data = {
alterable,
'alert_ids:': alertIds,
apply_overrides: applyOverrides,
auto_delete: autoDelete,
auto_delete_data: autoDeleteData,
comment,
config_id: policyId,
cmd: 'save_task',
hosts_ordering: hostsOrdering,
in_assets: inAssets,
max_checks: maxChecks,
max_hosts: maxHosts,
min_qod: minQod,
name,
scanner_id: scannerId,
scanner_type: scannerType,
schedule_id: scheduleId,
schedule_periods: schedulePeriods,
source_iface: sourceIface,
target_id: targetId,
task_id: id,
usage_type: 'audit',
};
log.debug('Saving audit', args, data);
return this.action(data);
}

getElementFromRoot(root) {
return root.get_task.get_tasks_response.task;
}
}

class AuditsCommand extends EntitiesCommand {
constructor(http) {
super(http, 'task', Audit);
}

getEntitiesResponse(root) {
return root.get_tasks.get_tasks_response;
}

get(params, options) {
params = {...params, usage_type: 'audit'};
return this.httpGet(params, options).then(response => {
const {entities, filter, counts} = this.getCollectionListFromRoot(
response.data,
);
return response.set(entities, {filter, counts});
});
}
}

registerCommand('audit', AuditCommand);
registerCommand('audits', AuditsCommand);

// vim: set ts=2 sw=2 tw=80:
12 changes: 12 additions & 0 deletions gsa/src/gmp/commands/permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ class PermissionCommand extends EntityCommand {
resourceType,
subjectType,
}) {
if (resourceType === 'policy') {
resourceType = 'config';
} else if (resourceType === 'audit') {
resourceType = 'task';
}

const data = {
cmd: 'create_permission',
comment,
Expand Down Expand Up @@ -109,6 +115,12 @@ class PermissionsCommand extends EntitiesCommand {
includeRelated,
related = [],
}) {
if (entityType === 'policy') {
entityType = 'config';
} else if (entityType === 'audit') {
entityType = 'task';
}

const data = {
cmd: 'create_permissions',
comment,
Expand Down
Loading