@kyverno/backstage-plugin-policy-reporter-backend 2.5.0 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +45 -0
- package/config.schema.json +19 -0
- package/dist/index.d.ts +190 -4
- package/dist/plugin.cjs.js +8 -2
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/schema/openapi/generated/router.cjs.js +1108 -11
- package/dist/schema/openapi/generated/router.cjs.js.map +1 -1
- package/dist/service/policyReporterService.cjs.js +188 -0
- package/dist/service/policyReporterService.cjs.js.map +1 -0
- package/dist/service/router.cjs.js +139 -78
- package/dist/service/router.cjs.js.map +1 -1
- package/package.json +23 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
1
|
# @kyverno/backstage-plugin-policy-reporter-backend
|
|
2
2
|
|
|
3
|
+
## 2.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 32f327e: Add cluster-scoped source, kind, category and policy filters.
|
|
8
|
+
- 32f327e: Add support for fetching cluster-scoped policy results.
|
|
9
|
+
- 32f327e: Backstage verion bump to v1.55.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [32f327e]
|
|
14
|
+
- Updated dependencies [32f327e]
|
|
15
|
+
- Updated dependencies [32f327e]
|
|
16
|
+
- @kyverno/backstage-plugin-policy-reporter-common@2.6.0
|
|
17
|
+
|
|
18
|
+
## 2.6.0
|
|
19
|
+
|
|
20
|
+
### Minor Changes
|
|
21
|
+
|
|
22
|
+
- fa25ccc: Added additional responses to all routes, they can now also return 404, 502 and 503
|
|
23
|
+
- 256fb9a: Added source filtering to the PolicyReportsPage. Users can now filter the list of policy reports by selecting one or more sources from the selected cluster.
|
|
24
|
+
- 2f4ac45: Added policy filtering to the PolicyReportsPage. Users can now filter the list of policy reports by selecting one or more policies from the selected cluster.
|
|
25
|
+
- d598ade: Added category filtering to the PolicyReportsPage. Users can now filter the list of policy reports by selecting one or more categories from the selected cluster.
|
|
26
|
+
- a664d0c: Added kind filtering to the PolicyReportsPage. Users can now filter the list of policy reports by selecting one or more kinds from the selected cluster.
|
|
27
|
+
- 880eecc: Backstage version bump to v1.51.1
|
|
28
|
+
- fa25ccc: Add support for configuring requestHeaders for the Policy Reporter Backend in your config using policyReporter.requestHeaders. This can be used for configuring Basic Auth credentials to the backend.
|
|
29
|
+
|
|
30
|
+
```yaml
|
|
31
|
+
policyReporter:
|
|
32
|
+
requestHeaders:
|
|
33
|
+
Authorization: Bearer ${POLICY_REPORTER_API_TOKEN}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
- 44c5238: Backstage version bump to v1.52.0
|
|
37
|
+
|
|
38
|
+
### Patch Changes
|
|
39
|
+
|
|
40
|
+
- Updated dependencies [256fb9a]
|
|
41
|
+
- Updated dependencies [2f4ac45]
|
|
42
|
+
- Updated dependencies [d598ade]
|
|
43
|
+
- Updated dependencies [a664d0c]
|
|
44
|
+
- Updated dependencies [880eecc]
|
|
45
|
+
- Updated dependencies [44c5238]
|
|
46
|
+
- @kyverno/backstage-plugin-policy-reporter-common@2.5.0
|
|
47
|
+
|
|
3
48
|
## 2.5.0
|
|
4
49
|
|
|
5
50
|
### Minor Changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"policyReporter": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"requestHeaders": {
|
|
9
|
+
"type": "object",
|
|
10
|
+
"additionalProperties": {
|
|
11
|
+
"type": "string"
|
|
12
|
+
},
|
|
13
|
+
"description": "Optional HTTP headers forwarded with every outbound request to every Policy Reporter API Typically used to authenticate through a gateway/proxy.",
|
|
14
|
+
"visibility": "backend"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,199 @@
|
|
|
1
1
|
import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
|
|
2
|
-
import { LoggerService, RootConfigService
|
|
2
|
+
import { LoggerService, RootConfigService } from '@backstage/backend-plugin-api';
|
|
3
3
|
import express from 'express';
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
type Direction = 'asc' | 'desc';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
type Severity = 'unknown' | 'info' | 'low' | 'medium' | 'high' | 'critical';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
type Status = 'fail' | 'skip' | 'pass' | 'warn' | 'error' | 'summary';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Filter options for policy results
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
interface Filter {
|
|
25
|
+
/**
|
|
26
|
+
* Filter by a list of sources
|
|
27
|
+
*/
|
|
28
|
+
sources?: Array<string>;
|
|
29
|
+
/**
|
|
30
|
+
* Filter by a list of namespaces
|
|
31
|
+
*/
|
|
32
|
+
namespaces?: Array<string>;
|
|
33
|
+
/**
|
|
34
|
+
* Filter by a list of kinds
|
|
35
|
+
*/
|
|
36
|
+
kinds?: Array<string>;
|
|
37
|
+
/**
|
|
38
|
+
* Filter by a list of resources
|
|
39
|
+
*/
|
|
40
|
+
resources?: Array<string>;
|
|
41
|
+
/**
|
|
42
|
+
* Filter by a list of categories
|
|
43
|
+
*/
|
|
44
|
+
categories?: Array<string>;
|
|
45
|
+
/**
|
|
46
|
+
* Filter by a list of policies
|
|
47
|
+
*/
|
|
48
|
+
policies?: Array<string>;
|
|
49
|
+
/**
|
|
50
|
+
* Filter by a list of status
|
|
51
|
+
*/
|
|
52
|
+
status?: Array<Status>;
|
|
53
|
+
/**
|
|
54
|
+
* Filter by a list of severities
|
|
55
|
+
*/
|
|
56
|
+
severities?: Array<Severity>;
|
|
57
|
+
/**
|
|
58
|
+
* Filter by search string
|
|
59
|
+
*/
|
|
60
|
+
search?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Filter by label-value pairs
|
|
63
|
+
*/
|
|
64
|
+
labels?: Array<string>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* @public
|
|
69
|
+
*/
|
|
70
|
+
interface ListResult {
|
|
71
|
+
/**
|
|
72
|
+
* Unique identifier for the result
|
|
73
|
+
*/
|
|
74
|
+
id: string;
|
|
75
|
+
/**
|
|
76
|
+
* Kubernetes namespace
|
|
77
|
+
*/
|
|
78
|
+
namespace: string;
|
|
79
|
+
/**
|
|
80
|
+
* Kubernetes resource kind
|
|
81
|
+
*/
|
|
82
|
+
kind: string;
|
|
83
|
+
/**
|
|
84
|
+
* Resource name
|
|
85
|
+
*/
|
|
86
|
+
name: string;
|
|
87
|
+
/**
|
|
88
|
+
* Unique resource identifier
|
|
89
|
+
*/
|
|
90
|
+
resourceId: string;
|
|
91
|
+
/**
|
|
92
|
+
* Policy result message
|
|
93
|
+
*/
|
|
94
|
+
message: string;
|
|
95
|
+
/**
|
|
96
|
+
* Policy name
|
|
97
|
+
*/
|
|
98
|
+
policy: string;
|
|
99
|
+
/**
|
|
100
|
+
* Policy rule name
|
|
101
|
+
*/
|
|
102
|
+
rule: string;
|
|
103
|
+
status: Status;
|
|
104
|
+
severity: Severity;
|
|
105
|
+
/**
|
|
106
|
+
* Unix timestamp of the result
|
|
107
|
+
*/
|
|
108
|
+
timestamp: number;
|
|
109
|
+
/**
|
|
110
|
+
* Additional key-value properties
|
|
111
|
+
*/
|
|
112
|
+
properties: {
|
|
113
|
+
[key: string]: string;
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Pagination options for results
|
|
119
|
+
* @public
|
|
120
|
+
*/
|
|
121
|
+
interface Pagination {
|
|
122
|
+
/**
|
|
123
|
+
* Requested list page number
|
|
124
|
+
*/
|
|
125
|
+
page?: number;
|
|
126
|
+
/**
|
|
127
|
+
* Number of results per page
|
|
128
|
+
*/
|
|
129
|
+
offset?: number;
|
|
130
|
+
/**
|
|
131
|
+
* Fields to sort by
|
|
132
|
+
*/
|
|
133
|
+
sortBy?: Array<string>;
|
|
134
|
+
direction?: Direction;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* @public
|
|
139
|
+
*/
|
|
140
|
+
interface ResultList {
|
|
141
|
+
items: Array<ListResult>;
|
|
142
|
+
/**
|
|
143
|
+
* Total number of results
|
|
144
|
+
*/
|
|
145
|
+
count: number;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
interface PolicyReporterApi {
|
|
149
|
+
getNamespacedResourceResults(options: {
|
|
150
|
+
entityRef: string;
|
|
151
|
+
query: Filter & Pagination;
|
|
152
|
+
}): Promise<ResultList>;
|
|
153
|
+
getClusterResourceResults(options: {
|
|
154
|
+
entityRef: string;
|
|
155
|
+
query: Pick<Filter, 'sources' | 'kinds' | 'categories' | 'policies' | 'status' | 'severities' | 'search' | 'labels'> & Pagination;
|
|
156
|
+
}): Promise<ResultList>;
|
|
157
|
+
getNamespaces(options: {
|
|
158
|
+
entityRef: string;
|
|
159
|
+
query: Pick<Filter, 'sources' | 'categories' | 'policies'>;
|
|
160
|
+
}): Promise<string[]>;
|
|
161
|
+
getSources(options: {
|
|
162
|
+
entityRef: string;
|
|
163
|
+
}): Promise<string[]>;
|
|
164
|
+
getKinds(options: {
|
|
165
|
+
entityRef: string;
|
|
166
|
+
query: Pick<Filter, 'sources' | 'kinds'>;
|
|
167
|
+
}): Promise<string[]>;
|
|
168
|
+
getCategories(options: {
|
|
169
|
+
entityRef: string;
|
|
170
|
+
query: Pick<Filter, 'sources' | 'namespaces'>;
|
|
171
|
+
}): Promise<string[]>;
|
|
172
|
+
getPolicies(options: {
|
|
173
|
+
entityRef: string;
|
|
174
|
+
query: Pick<Filter, 'sources' | 'namespaces' | 'categories'>;
|
|
175
|
+
}): Promise<string[]>;
|
|
176
|
+
getClusterSources(options: {
|
|
177
|
+
entityRef: string;
|
|
178
|
+
}): Promise<string[]>;
|
|
179
|
+
getClusterKinds(options: {
|
|
180
|
+
entityRef: string;
|
|
181
|
+
query: Pick<Filter, 'sources' | 'namespaces'>;
|
|
182
|
+
}): Promise<string[]>;
|
|
183
|
+
getClusterCategories(options: {
|
|
184
|
+
entityRef: string;
|
|
185
|
+
query: Pick<Filter, 'sources'>;
|
|
186
|
+
}): Promise<string[]>;
|
|
187
|
+
getClusterPolicies(options: {
|
|
188
|
+
entityRef: string;
|
|
189
|
+
query: Pick<Filter, 'sources' | 'categories'>;
|
|
190
|
+
}): Promise<string[]>;
|
|
191
|
+
}
|
|
5
192
|
|
|
6
193
|
interface RouterOptions {
|
|
7
194
|
logger: LoggerService;
|
|
8
195
|
config: RootConfigService;
|
|
9
|
-
|
|
10
|
-
authService: AuthService;
|
|
196
|
+
policyReporterService: PolicyReporterApi;
|
|
11
197
|
}
|
|
12
198
|
declare function createRouter(options: RouterOptions): Promise<express.Router>;
|
|
13
199
|
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var backendPluginApi = require('@backstage/backend-plugin-api');
|
|
4
4
|
var router = require('./service/router.cjs.js');
|
|
5
5
|
var pluginCatalogNode = require('@backstage/plugin-catalog-node');
|
|
6
|
+
var policyReporterService = require('./service/policyReporterService.cjs.js');
|
|
6
7
|
|
|
7
8
|
const kyvernoPolicyReportsPlugin = backendPluginApi.createBackendPlugin({
|
|
8
9
|
pluginId: "policy-reporter",
|
|
@@ -16,12 +17,17 @@ const kyvernoPolicyReportsPlugin = backendPluginApi.createBackendPlugin({
|
|
|
16
17
|
authService: backendPluginApi.coreServices.auth
|
|
17
18
|
},
|
|
18
19
|
async init({ httpRouter, logger, config, catalogService, authService }) {
|
|
20
|
+
const policyReporterService$1 = new policyReporterService.PolicyReporterService({
|
|
21
|
+
logger,
|
|
22
|
+
configService: config,
|
|
23
|
+
catalogService,
|
|
24
|
+
authService
|
|
25
|
+
});
|
|
19
26
|
httpRouter.use(
|
|
20
27
|
await router.createRouter({
|
|
21
28
|
logger,
|
|
22
29
|
config,
|
|
23
|
-
|
|
24
|
-
authService
|
|
30
|
+
policyReporterService: policyReporterService$1
|
|
25
31
|
})
|
|
26
32
|
);
|
|
27
33
|
}
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["../src/plugin.ts"],"sourcesContent":["import {\n coreServices,\n createBackendPlugin,\n} from '@backstage/backend-plugin-api';\nimport { createRouter } from './service/router';\nimport { catalogServiceRef } from '@backstage/plugin-catalog-node';\n\n/**\n * kyvernoPolicyReportsPlugin backend plugin\n *\n * @public\n */\nexport const kyvernoPolicyReportsPlugin = createBackendPlugin({\n pluginId: 'policy-reporter',\n register(env) {\n env.registerInit({\n deps: {\n httpRouter: coreServices.httpRouter,\n logger: coreServices.logger,\n config: coreServices.rootConfig,\n catalogService: catalogServiceRef,\n authService: coreServices.auth,\n },\n async init({ httpRouter, logger, config, catalogService, authService }) {\n httpRouter.use(\n await createRouter({\n logger,\n config,\n
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["../src/plugin.ts"],"sourcesContent":["import {\n coreServices,\n createBackendPlugin,\n} from '@backstage/backend-plugin-api';\nimport { createRouter } from './service/router';\nimport { catalogServiceRef } from '@backstage/plugin-catalog-node';\nimport { PolicyReporterService } from './service/policyReporterService';\n\n/**\n * kyvernoPolicyReportsPlugin backend plugin\n *\n * @public\n */\nexport const kyvernoPolicyReportsPlugin = createBackendPlugin({\n pluginId: 'policy-reporter',\n register(env) {\n env.registerInit({\n deps: {\n httpRouter: coreServices.httpRouter,\n logger: coreServices.logger,\n config: coreServices.rootConfig,\n catalogService: catalogServiceRef,\n authService: coreServices.auth,\n },\n async init({ httpRouter, logger, config, catalogService, authService }) {\n const policyReporterService = new PolicyReporterService({\n logger,\n configService: config,\n catalogService,\n authService,\n });\n\n httpRouter.use(\n await createRouter({\n logger,\n config,\n policyReporterService,\n }),\n );\n },\n });\n },\n});\n"],"names":["createBackendPlugin","coreServices","catalogServiceRef","policyReporterService","PolicyReporterService","createRouter"],"mappings":";;;;;;;AAaO,MAAM,6BAA6BA,oCAAA,CAAoB;AAAA,EAC5D,QAAA,EAAU,iBAAA;AAAA,EACV,SAAS,GAAA,EAAK;AACZ,IAAA,GAAA,CAAI,YAAA,CAAa;AAAA,MACf,IAAA,EAAM;AAAA,QACJ,YAAYC,6BAAA,CAAa,UAAA;AAAA,QACzB,QAAQA,6BAAA,CAAa,MAAA;AAAA,QACrB,QAAQA,6BAAA,CAAa,UAAA;AAAA,QACrB,cAAA,EAAgBC,mCAAA;AAAA,QAChB,aAAaD,6BAAA,CAAa;AAAA,OAC5B;AAAA,MACA,MAAM,KAAK,EAAE,UAAA,EAAY,QAAQ,MAAA,EAAQ,cAAA,EAAgB,aAAY,EAAG;AACtE,QAAA,MAAME,uBAAA,GAAwB,IAAIC,2CAAA,CAAsB;AAAA,UACtD,MAAA;AAAA,UACA,aAAA,EAAe,MAAA;AAAA,UACf,cAAA;AAAA,UACA;AAAA,SACD,CAAA;AAED,QAAA,UAAA,CAAW,GAAA;AAAA,UACT,MAAMC,mBAAA,CAAa;AAAA,YACjB,MAAA;AAAA,YACA,MAAA;AAAA,mCACAF;AAAA,WACD;AAAA,SACH;AAAA,MACF;AAAA,KACD,CAAA;AAAA,EACH;AACF,CAAC;;;;"}
|