foreman_openscap 4.3.0 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/api/v2/compliance/arf_reports_controller.rb +0 -6
- data/app/controllers/api/v2/compliance/oval_policies_controller.rb +1 -1
- data/app/helpers/arf_report_dashboard_helper.rb +2 -4
- data/app/helpers/compliance_hosts_helper.rb +1 -1
- data/app/helpers/policies_helper.rb +1 -1
- data/app/services/foreman_openscap/client_config/base.rb +1 -0
- data/app/services/foreman_openscap/client_config/puppet.rb +6 -2
- data/app/views/api/v2/compliance/oval_contents/destroy.json.rabl +3 -0
- data/app/views/arf_reports/_metrics.html.erb +4 -4
- data/app/views/compliance_hosts/show.html.erb +4 -6
- data/app/views/dashboard/_compliance_reports_breakdown_widget.html.erb +4 -3
- data/app/views/policy_dashboard/_policy_chart_widget.html.erb +3 -2
- data/db/migrate/20200117135424_migrate_port_overrides_to_int.rb +2 -1
- data/db/migrate/20201202110213_update_puppet_port_param_type.rb +2 -1
- data/lib/foreman_openscap/engine.rb +0 -7
- data/lib/foreman_openscap/version.rb +1 -1
- data/package.json +48 -0
- data/test/functional/api/v2/compliance/oval_reports_controller_test.rb +1 -1
- data/test/functional/api/v2/compliance/policies_controller_test.rb +2 -0
- data/test/helpers/arf_report_dashboard_helper_test.rb +9 -10
- data/test/helpers/policy_dashboard_helper_test.rb +1 -1
- data/test/test_plugin_helper.rb +9 -4
- data/test/unit/policy_test.rb +1 -1
- data/test/unit/services/config_name_service_test.rb +1 -0
- data/test/unit/services/hostgroup_overrider_test.rb +2 -1
- data/test/unit/services/lookup_key_overrider_test.rb +4 -1
- data/webpack/components/EmptyState.js +73 -0
- data/webpack/components/IndexLayout.js +35 -0
- data/webpack/components/IndexLayout.scss +3 -0
- data/webpack/components/IndexTable/IndexTableHelper.js +9 -0
- data/webpack/components/IndexTable/index.js +65 -0
- data/webpack/components/RuleSeverity/RuleSeverity.scss +3 -0
- data/webpack/components/RuleSeverity/RuleSeverity.test.js +13 -0
- data/webpack/components/RuleSeverity/__snapshots__/RuleSeverity.test.js.snap +41 -0
- data/webpack/components/RuleSeverity/i_severity-critical.svg +61 -0
- data/webpack/components/RuleSeverity/i_severity-high.svg +61 -0
- data/webpack/components/RuleSeverity/i_severity-low.svg +62 -0
- data/webpack/components/RuleSeverity/i_severity-med.svg +62 -0
- data/webpack/components/RuleSeverity/i_unknown.svg +33 -0
- data/webpack/components/RuleSeverity/index.js +33 -0
- data/webpack/components/withLoading.js +87 -0
- data/webpack/global_index.js +5 -0
- data/webpack/graphql/queries/currentUserAttributes.gql +11 -0
- data/webpack/graphql/queries/cves.gql +23 -0
- data/webpack/graphql/queries/ovalContents.gql +16 -0
- data/webpack/graphql/queries/ovalPolicies.gql +17 -0
- data/webpack/graphql/queries/ovalPolicy.gql +26 -0
- data/webpack/helpers/commonHelper.js +1 -0
- data/webpack/helpers/globalIdHelper.js +13 -0
- data/webpack/helpers/pageParamsHelper.js +31 -0
- data/webpack/helpers/pathsHelper.js +22 -0
- data/webpack/helpers/permissionsHelper.js +42 -0
- data/webpack/helpers/tableHelper.js +9 -0
- data/webpack/index.js +8 -0
- data/webpack/routes/OvalContents/OvalContentsIndex/OvalContentsIndex.js +46 -0
- data/webpack/routes/OvalContents/OvalContentsIndex/OvalContentsTable.js +46 -0
- data/webpack/routes/OvalContents/OvalContentsIndex/__tests__/OvalContentsIndex.fixtures.js +120 -0
- data/webpack/routes/OvalContents/OvalContentsIndex/__tests__/OvalContentsIndex.test.js +101 -0
- data/webpack/routes/OvalContents/OvalContentsIndex/index.js +7 -0
- data/webpack/routes/OvalPolicies/OvalPoliciesIndex/OvalPoliciesIndex.js +47 -0
- data/webpack/routes/OvalPolicies/OvalPoliciesIndex/OvalPoliciesTable.js +44 -0
- data/webpack/routes/OvalPolicies/OvalPoliciesIndex/__tests__/OvalPoliciesIndex.fixtures.js +95 -0
- data/webpack/routes/OvalPolicies/OvalPoliciesIndex/__tests__/OvalPoliciesIndex.test.js +98 -0
- data/webpack/routes/OvalPolicies/OvalPoliciesIndex/index.js +7 -0
- data/webpack/routes/OvalPolicies/OvalPoliciesShow/CvesTab.js +49 -0
- data/webpack/routes/OvalPolicies/OvalPoliciesShow/CvesTable.js +63 -0
- data/webpack/routes/OvalPolicies/OvalPoliciesShow/OvalPoliciesShow.js +78 -0
- data/webpack/routes/OvalPolicies/OvalPoliciesShow/OvalPoliciesShowHelper.js +39 -0
- data/webpack/routes/OvalPolicies/OvalPoliciesShow/__tests__/OvalPoliciesShow.fixtures.js +87 -0
- data/webpack/routes/OvalPolicies/OvalPoliciesShow/__tests__/OvalPoliciesShow.test.js +129 -0
- data/webpack/routes/OvalPolicies/OvalPoliciesShow/index.js +36 -0
- data/webpack/routes/routes.js +28 -0
- data/webpack/testHelper.js +96 -0
- metadata +56 -7
@@ -0,0 +1,36 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import { useQuery } from '@apollo/client';
|
4
|
+
|
5
|
+
import { translate as __ } from 'foremanReact/common/I18n';
|
6
|
+
|
7
|
+
import OvalPoliciesShow from './OvalPoliciesShow';
|
8
|
+
import { encodeId } from '../../../helpers/globalIdHelper';
|
9
|
+
|
10
|
+
import ovalPolicy from '../../../graphql/queries/ovalPolicy.gql';
|
11
|
+
|
12
|
+
const WrappedOvalPoliciesShow = props => {
|
13
|
+
const id = encodeId('ForemanOpenscap::OvalPolicy', props.match.params.id);
|
14
|
+
|
15
|
+
const useFetchFn = componentProps =>
|
16
|
+
useQuery(ovalPolicy, { variables: { id } });
|
17
|
+
|
18
|
+
const renameData = data => ({ policy: data.ovalPolicy });
|
19
|
+
|
20
|
+
return (
|
21
|
+
<OvalPoliciesShow
|
22
|
+
{...props}
|
23
|
+
fetchFn={useFetchFn}
|
24
|
+
renameData={renameData}
|
25
|
+
resultPath="ovalPolicy"
|
26
|
+
emptyStateTitle={__('No OVAL Policy found')}
|
27
|
+
permissions={['view_oval_policies']}
|
28
|
+
/>
|
29
|
+
);
|
30
|
+
};
|
31
|
+
|
32
|
+
WrappedOvalPoliciesShow.propTypes = {
|
33
|
+
match: PropTypes.object.isRequired,
|
34
|
+
};
|
35
|
+
|
36
|
+
export default WrappedOvalPoliciesShow;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import OvalContentsIndex from './OvalContents/OvalContentsIndex';
|
3
|
+
import OvalPoliciesIndex from './OvalPolicies/OvalPoliciesIndex';
|
4
|
+
import OvalPoliciesShow from './OvalPolicies/OvalPoliciesShow';
|
5
|
+
|
6
|
+
import {
|
7
|
+
ovalContentsPath,
|
8
|
+
ovalPoliciesPath,
|
9
|
+
ovalPoliciesShowPath,
|
10
|
+
} from '../helpers/pathsHelper';
|
11
|
+
|
12
|
+
export default [
|
13
|
+
{
|
14
|
+
path: ovalContentsPath,
|
15
|
+
render: props => <OvalContentsIndex {...props} />,
|
16
|
+
exact: true,
|
17
|
+
},
|
18
|
+
{
|
19
|
+
path: ovalPoliciesPath,
|
20
|
+
render: props => <OvalPoliciesIndex {...props} />,
|
21
|
+
exact: true,
|
22
|
+
},
|
23
|
+
{
|
24
|
+
path: ovalPoliciesShowPath,
|
25
|
+
render: props => <OvalPoliciesShow {...props} />,
|
26
|
+
exact: true,
|
27
|
+
},
|
28
|
+
];
|
@@ -0,0 +1,96 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { MockedProvider } from '@apollo/react-testing';
|
3
|
+
import { MemoryRouter } from 'react-router-dom';
|
4
|
+
import { getForemanContext } from 'foremanReact/Root/Context/ForemanContext';
|
5
|
+
|
6
|
+
export const withRouter = Component => props => (
|
7
|
+
<MemoryRouter>
|
8
|
+
<Component {...props} />
|
9
|
+
</MemoryRouter>
|
10
|
+
);
|
11
|
+
|
12
|
+
export const withMockedProvider = Component => props => {
|
13
|
+
const ForemanContext = getForemanContext(ctx);
|
14
|
+
// eslint-disable-next-line react/prop-types
|
15
|
+
const { mocks, ...rest } = props;
|
16
|
+
|
17
|
+
const ctx = {
|
18
|
+
metadata: {
|
19
|
+
UISettings: {
|
20
|
+
perPage: 20,
|
21
|
+
},
|
22
|
+
},
|
23
|
+
};
|
24
|
+
|
25
|
+
return (
|
26
|
+
<ForemanContext.Provider value={ctx}>
|
27
|
+
<MockedProvider mocks={mocks}>
|
28
|
+
<Component {...rest} />
|
29
|
+
</MockedProvider>
|
30
|
+
</ForemanContext.Provider>
|
31
|
+
);
|
32
|
+
};
|
33
|
+
|
34
|
+
// use to resolve async mock requests for apollo MockedProvider
|
35
|
+
export const tick = () => new Promise(resolve => setTimeout(resolve, 0));
|
36
|
+
|
37
|
+
export const historyMock = {
|
38
|
+
location: {
|
39
|
+
search: '',
|
40
|
+
},
|
41
|
+
};
|
42
|
+
|
43
|
+
export const admin = {
|
44
|
+
__typename: 'User',
|
45
|
+
id: 'MDE6VXNlci00',
|
46
|
+
login: 'admin',
|
47
|
+
admin: true,
|
48
|
+
permissions: {
|
49
|
+
nodes: [],
|
50
|
+
},
|
51
|
+
};
|
52
|
+
|
53
|
+
export const userFactory = (login, permissions = []) => ({
|
54
|
+
__typename: 'User',
|
55
|
+
id: 'MDE6VXNlci01',
|
56
|
+
login,
|
57
|
+
admin: false,
|
58
|
+
permissions: {
|
59
|
+
nodes: permissions,
|
60
|
+
},
|
61
|
+
});
|
62
|
+
|
63
|
+
export const intruder = userFactory('intruder', [
|
64
|
+
{
|
65
|
+
__typename: 'Permission',
|
66
|
+
id: 'MDE6UGVybWlzc2lvbi0x',
|
67
|
+
name: 'view_architectures',
|
68
|
+
},
|
69
|
+
]);
|
70
|
+
|
71
|
+
export const mockFactory = (resultName, query) => (
|
72
|
+
variables,
|
73
|
+
modelResults,
|
74
|
+
{ errors = [], currentUser = null }
|
75
|
+
) => {
|
76
|
+
const mock = {
|
77
|
+
request: {
|
78
|
+
query,
|
79
|
+
variables,
|
80
|
+
},
|
81
|
+
result: {
|
82
|
+
data: {
|
83
|
+
[resultName]: modelResults,
|
84
|
+
},
|
85
|
+
},
|
86
|
+
};
|
87
|
+
|
88
|
+
if (errors.length !== 0) {
|
89
|
+
mock.result.errors = errors;
|
90
|
+
}
|
91
|
+
|
92
|
+
if (currentUser) {
|
93
|
+
mock.result.data.currentUser = currentUser;
|
94
|
+
}
|
95
|
+
return [mock];
|
96
|
+
};
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_openscap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- slukasik@redhat.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -152,6 +152,7 @@ files:
|
|
152
152
|
- app/views/api/v2/compliance/common/_org.json.rabl
|
153
153
|
- app/views/api/v2/compliance/oval_contents/base.json.rabl
|
154
154
|
- app/views/api/v2/compliance/oval_contents/create.json.rabl
|
155
|
+
- app/views/api/v2/compliance/oval_contents/destroy.json.rabl
|
155
156
|
- app/views/api/v2/compliance/oval_contents/index.json.rabl
|
156
157
|
- app/views/api/v2/compliance/oval_contents/show.json.rabl
|
157
158
|
- app/views/api/v2/compliance/oval_contents/sync.json.rabl
|
@@ -354,6 +355,7 @@ files:
|
|
354
355
|
- locale/zh_TW/LC_MESSAGES/foreman_openscap.mo
|
355
356
|
- locale/zh_TW/foreman_openscap.edit.po
|
356
357
|
- locale/zh_TW/foreman_openscap.po
|
358
|
+
- package.json
|
357
359
|
- test/factories/arf_report_factory.rb
|
358
360
|
- test/factories/asset_factory.rb
|
359
361
|
- test/factories/compliance_host_factory.rb
|
@@ -412,6 +414,53 @@ files:
|
|
412
414
|
- test/unit/services/report_dashboard/data_test.rb
|
413
415
|
- test/unit/services/tailoring_files_proxy_check_test.rb
|
414
416
|
- test/unit/tailoring_file_test.rb
|
417
|
+
- webpack/components/EmptyState.js
|
418
|
+
- webpack/components/IndexLayout.js
|
419
|
+
- webpack/components/IndexLayout.scss
|
420
|
+
- webpack/components/IndexTable/IndexTableHelper.js
|
421
|
+
- webpack/components/IndexTable/index.js
|
422
|
+
- webpack/components/RuleSeverity/RuleSeverity.scss
|
423
|
+
- webpack/components/RuleSeverity/RuleSeverity.test.js
|
424
|
+
- webpack/components/RuleSeverity/__snapshots__/RuleSeverity.test.js.snap
|
425
|
+
- webpack/components/RuleSeverity/i_severity-critical.svg
|
426
|
+
- webpack/components/RuleSeverity/i_severity-high.svg
|
427
|
+
- webpack/components/RuleSeverity/i_severity-low.svg
|
428
|
+
- webpack/components/RuleSeverity/i_severity-med.svg
|
429
|
+
- webpack/components/RuleSeverity/i_unknown.svg
|
430
|
+
- webpack/components/RuleSeverity/index.js
|
431
|
+
- webpack/components/withLoading.js
|
432
|
+
- webpack/global_index.js
|
433
|
+
- webpack/graphql/queries/currentUserAttributes.gql
|
434
|
+
- webpack/graphql/queries/cves.gql
|
435
|
+
- webpack/graphql/queries/ovalContents.gql
|
436
|
+
- webpack/graphql/queries/ovalPolicies.gql
|
437
|
+
- webpack/graphql/queries/ovalPolicy.gql
|
438
|
+
- webpack/helpers/commonHelper.js
|
439
|
+
- webpack/helpers/globalIdHelper.js
|
440
|
+
- webpack/helpers/pageParamsHelper.js
|
441
|
+
- webpack/helpers/pathsHelper.js
|
442
|
+
- webpack/helpers/permissionsHelper.js
|
443
|
+
- webpack/helpers/tableHelper.js
|
444
|
+
- webpack/index.js
|
445
|
+
- webpack/routes/OvalContents/OvalContentsIndex/OvalContentsIndex.js
|
446
|
+
- webpack/routes/OvalContents/OvalContentsIndex/OvalContentsTable.js
|
447
|
+
- webpack/routes/OvalContents/OvalContentsIndex/__tests__/OvalContentsIndex.fixtures.js
|
448
|
+
- webpack/routes/OvalContents/OvalContentsIndex/__tests__/OvalContentsIndex.test.js
|
449
|
+
- webpack/routes/OvalContents/OvalContentsIndex/index.js
|
450
|
+
- webpack/routes/OvalPolicies/OvalPoliciesIndex/OvalPoliciesIndex.js
|
451
|
+
- webpack/routes/OvalPolicies/OvalPoliciesIndex/OvalPoliciesTable.js
|
452
|
+
- webpack/routes/OvalPolicies/OvalPoliciesIndex/__tests__/OvalPoliciesIndex.fixtures.js
|
453
|
+
- webpack/routes/OvalPolicies/OvalPoliciesIndex/__tests__/OvalPoliciesIndex.test.js
|
454
|
+
- webpack/routes/OvalPolicies/OvalPoliciesIndex/index.js
|
455
|
+
- webpack/routes/OvalPolicies/OvalPoliciesShow/CvesTab.js
|
456
|
+
- webpack/routes/OvalPolicies/OvalPoliciesShow/CvesTable.js
|
457
|
+
- webpack/routes/OvalPolicies/OvalPoliciesShow/OvalPoliciesShow.js
|
458
|
+
- webpack/routes/OvalPolicies/OvalPoliciesShow/OvalPoliciesShowHelper.js
|
459
|
+
- webpack/routes/OvalPolicies/OvalPoliciesShow/__tests__/OvalPoliciesShow.fixtures.js
|
460
|
+
- webpack/routes/OvalPolicies/OvalPoliciesShow/__tests__/OvalPoliciesShow.test.js
|
461
|
+
- webpack/routes/OvalPolicies/OvalPoliciesShow/index.js
|
462
|
+
- webpack/routes/routes.js
|
463
|
+
- webpack/testHelper.js
|
415
464
|
homepage: https://github.com/theforeman/foreman_openscap
|
416
465
|
licenses:
|
417
466
|
- GPL-3.0
|
@@ -454,7 +503,6 @@ test_files:
|
|
454
503
|
- test/files/tailoring_files/ssg-firefox-ds-tailoring-2.xml
|
455
504
|
- test/files/tailoring_files/ssg-firefox-ds-tailoring.xml
|
456
505
|
- test/files/oval_contents/ansible-2.9.oval.xml.bz2
|
457
|
-
- test/functional/api/v2/compliance/policies_controller_test.rb
|
458
506
|
- test/functional/api/v2/compliance/scap_content_profiles_controller_test.rb
|
459
507
|
- test/functional/api/v2/compliance/scap_contents_controller_test.rb
|
460
508
|
- test/functional/api/v2/compliance/tailoring_files_controller_test.rb
|
@@ -462,6 +510,7 @@ test_files:
|
|
462
510
|
- test/functional/api/v2/compliance/oval_contents_controller_test.rb
|
463
511
|
- test/functional/api/v2/compliance/oval_policies_controller_test.rb
|
464
512
|
- test/functional/api/v2/compliance/oval_reports_controller_test.rb
|
513
|
+
- test/functional/api/v2/compliance/policies_controller_test.rb
|
465
514
|
- test/functional/api/v2/hosts_controller_test.rb
|
466
515
|
- test/functional/arf_reports_controller_test.rb
|
467
516
|
- test/functional/openscap_proxies_controller_test.rb
|
@@ -478,18 +527,18 @@ test_files:
|
|
478
527
|
- test/unit/openscap_host_test.rb
|
479
528
|
- test/unit/policy_mailer_test.rb
|
480
529
|
- test/unit/scap_content_test.rb
|
481
|
-
- test/unit/services/config_name_service_test.rb
|
482
|
-
- test/unit/services/hostgroup_overrider_test.rb
|
483
|
-
- test/unit/services/lookup_key_overrider_test.rb
|
484
530
|
- test/unit/services/report_dashboard/data_test.rb
|
485
531
|
- test/unit/services/tailoring_files_proxy_check_test.rb
|
486
532
|
- test/unit/services/oval/cves_test.rb
|
487
533
|
- test/unit/services/oval/setup_test.rb
|
534
|
+
- test/unit/services/config_name_service_test.rb
|
535
|
+
- test/unit/services/hostgroup_overrider_test.rb
|
536
|
+
- test/unit/services/lookup_key_overrider_test.rb
|
488
537
|
- test/unit/tailoring_file_test.rb
|
489
|
-
- test/unit/policy_test.rb
|
490
538
|
- test/unit/oval_host_test.rb
|
491
539
|
- test/unit/oval_policy_test.rb
|
492
540
|
- test/unit/oval_status_test.rb
|
541
|
+
- test/unit/policy_test.rb
|
493
542
|
- test/fixtures/cve_fixtures.rb
|
494
543
|
- test/graphql/queries/oval_contents_query_test.rb
|
495
544
|
- test/graphql/queries/oval_policies_query_test.rb
|