@continuoussecuritytooling/keycloak-reporter 0.5.0 → 0.5.1
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/.ct.yaml +1 -1
- package/.github/workflows/pipeline.yml +23 -18
- package/.github/workflows/release.yml +23 -3
- package/Dockerfile +4 -2
- package/README.md +6 -7
- package/charts/keycloak-reporter/Chart.yaml +1 -1
- package/charts/keycloak-reporter/templates/_helpers.tpl +21 -0
- package/charts/keycloak-reporter/templates/cronjob.yaml +5 -3
- package/charts/keycloak-reporter/values.yaml +3 -7
- package/cli.ts +30 -26
- package/config.json +9 -0
- package/dist/cli.js +11 -6
- package/dist/cli.js.map +1 -1
- package/e2e/spec/webhooks.js +6 -2
- package/k8s.yaml +51 -0
- package/keycloak-reporter-0.5.0.tgz +0 -0
- package/package.json +3 -3
- package/test.values.yaml +8 -0
package/.ct.yaml
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
name: Build
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
|
+
pull_request:
|
|
4
5
|
merge_group:
|
|
5
6
|
push:
|
|
7
|
+
branches:
|
|
8
|
+
- develop
|
|
6
9
|
|
|
7
10
|
jobs:
|
|
8
11
|
build:
|
|
9
|
-
name:
|
|
10
|
-
runs-on:
|
|
12
|
+
name: 'Build and Test on Node ${{ matrix.node_version }} and ${{ matrix.os }}'
|
|
13
|
+
runs-on: '${{ matrix.os }}'
|
|
11
14
|
strategy:
|
|
12
15
|
matrix:
|
|
13
16
|
node_version:
|
|
@@ -19,10 +22,10 @@ jobs:
|
|
|
19
22
|
- windows-latest
|
|
20
23
|
steps:
|
|
21
24
|
- uses: actions/checkout@v4
|
|
22
|
-
- name:
|
|
25
|
+
- name: 'Use Node.js ${{ matrix.node_version }}'
|
|
23
26
|
uses: actions/setup-node@v3
|
|
24
27
|
with:
|
|
25
|
-
node-version:
|
|
28
|
+
node-version: '${{ matrix.node_version }}'
|
|
26
29
|
- name: npm build and test
|
|
27
30
|
run: |
|
|
28
31
|
npm run clean
|
|
@@ -30,7 +33,7 @@ jobs:
|
|
|
30
33
|
npm run test
|
|
31
34
|
|
|
32
35
|
chart:
|
|
33
|
-
name:
|
|
36
|
+
name: 'Build and Test Helm Chart'
|
|
34
37
|
runs-on: ubuntu-latest
|
|
35
38
|
|
|
36
39
|
steps:
|
|
@@ -46,7 +49,7 @@ jobs:
|
|
|
46
49
|
|
|
47
50
|
- uses: actions/setup-python@v4
|
|
48
51
|
with:
|
|
49
|
-
python-version:
|
|
52
|
+
python-version: '3.9'
|
|
50
53
|
check-latest: true
|
|
51
54
|
|
|
52
55
|
- name: Helm Chart Testing
|
|
@@ -62,7 +65,7 @@ jobs:
|
|
|
62
65
|
|
|
63
66
|
- name: Run chart-testing (lint)
|
|
64
67
|
if: steps.list-changed.outputs.changed == 'true'
|
|
65
|
-
run: ct lint --target-branch ${{ github.event.repository.default_branch }}
|
|
68
|
+
run: ct lint --target-branch ${{ github.event.repository.default_branch }}
|
|
66
69
|
|
|
67
70
|
- name: Create kind cluster
|
|
68
71
|
if: steps.list-changed.outputs.changed == 'true'
|
|
@@ -78,26 +81,25 @@ jobs:
|
|
|
78
81
|
path: dist
|
|
79
82
|
|
|
80
83
|
end2end:
|
|
81
|
-
name:
|
|
82
|
-
runs-on:
|
|
84
|
+
name: 'End2End Test on Node ${{ matrix.node_version }} and ${{ matrix.os }}'
|
|
85
|
+
runs-on: '${{ matrix.os }}'
|
|
83
86
|
strategy:
|
|
84
87
|
matrix:
|
|
85
88
|
node_version:
|
|
86
89
|
- 18
|
|
87
|
-
- 20
|
|
88
90
|
os:
|
|
89
91
|
- ubuntu-latest
|
|
90
92
|
steps:
|
|
91
93
|
- uses: actions/checkout@v4
|
|
92
|
-
- name:
|
|
94
|
+
- name: 'Use Node.js ${{ matrix.node_version }}'
|
|
93
95
|
uses: actions/setup-node@v3
|
|
94
96
|
with:
|
|
95
|
-
node-version:
|
|
97
|
+
node-version: '${{ matrix.node_version }}'
|
|
96
98
|
- name: Install Java
|
|
97
99
|
uses: actions/setup-java@v3
|
|
98
100
|
with:
|
|
99
|
-
distribution:
|
|
100
|
-
java-version:
|
|
101
|
+
distribution: 'temurin' # See 'Supported distributions' for available options
|
|
102
|
+
java-version: '17'
|
|
101
103
|
- name: npm build and test
|
|
102
104
|
run: |
|
|
103
105
|
npm run clean
|
|
@@ -112,10 +114,13 @@ jobs:
|
|
|
112
114
|
run: .bin/wait-for-server.sh
|
|
113
115
|
|
|
114
116
|
- name: Run end2end tests
|
|
115
|
-
run:
|
|
117
|
+
run: |
|
|
118
|
+
env
|
|
119
|
+
npm run end2end:test
|
|
116
120
|
env:
|
|
117
121
|
WEBHOOK_TESTING_TEAMS: ${{ secrets.WEBHOOK_TESTING_TEAMS }}
|
|
118
122
|
WEBHOOK_TESTING_SLACK: ${{ secrets.WEBHOOK_TESTING_SLACK }}
|
|
123
|
+
WEBHOOK_ADDITIONAL_MESSAGE: ${{ github.head_ref || github.ref_name }}
|
|
119
124
|
|
|
120
125
|
package:
|
|
121
126
|
name: Build Container Image
|
|
@@ -129,8 +134,8 @@ jobs:
|
|
|
129
134
|
- uses: actions/setup-node@v3
|
|
130
135
|
# TODO: Support Node 16+
|
|
131
136
|
with:
|
|
132
|
-
node-version:
|
|
133
|
-
- name:
|
|
137
|
+
node-version: '16'
|
|
138
|
+
- name: 'Build Package'
|
|
134
139
|
run: |
|
|
135
140
|
npm run clean
|
|
136
141
|
npm run build
|
|
@@ -139,7 +144,7 @@ jobs:
|
|
|
139
144
|
uses: redhat-actions/buildah-build@v2
|
|
140
145
|
with:
|
|
141
146
|
image: continuoussecuritytooling/keycloak-reporting-cli
|
|
142
|
-
tags:
|
|
147
|
+
tags: 'v1 ${{ github.sha }}'
|
|
143
148
|
containerfiles: |
|
|
144
149
|
./Dockerfile
|
|
145
150
|
- name: Push To Docker Hub
|
|
@@ -25,13 +25,33 @@ jobs:
|
|
|
25
25
|
|
|
26
26
|
- name: Install Helm
|
|
27
27
|
uses: azure/setup-helm@v3
|
|
28
|
+
- name: Install Python
|
|
29
|
+
uses: actions/setup-python@v4
|
|
30
|
+
with:
|
|
31
|
+
python-version: '3.9'
|
|
32
|
+
check-latest: true
|
|
33
|
+
- name: Set up chart-testing
|
|
34
|
+
uses: helm/chart-testing-action@v2.4.0
|
|
28
35
|
|
|
29
36
|
- name: Run chart-testing (lint)
|
|
30
|
-
run: ct lint --
|
|
37
|
+
run: ct lint --config .ct.yaml
|
|
31
38
|
|
|
32
39
|
- name: Run chart-releaser
|
|
33
40
|
uses: helm/chart-releaser-action@v1.5.0
|
|
34
41
|
with:
|
|
35
|
-
|
|
42
|
+
charts_dir: charts/
|
|
36
43
|
env:
|
|
37
|
-
CR_TOKEN:
|
|
44
|
+
CR_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
|
|
45
|
+
|
|
46
|
+
- name: Login to GitHub Container Registry
|
|
47
|
+
run: |
|
|
48
|
+
echo ${{ secrets.CT_OCI_GITHUB_TOKEN }} | helm registry login ghcr.io -u $ --password-stdin
|
|
49
|
+
|
|
50
|
+
- name: Push Charts to GHCR
|
|
51
|
+
run: |
|
|
52
|
+
for pkg in .cr-release-packages/*; do
|
|
53
|
+
if [ -z "${pkg:-}" ]; then
|
|
54
|
+
break
|
|
55
|
+
fi
|
|
56
|
+
helm push "${pkg}" oci://ghcr.io/cloudtooling/helm-charts
|
|
57
|
+
done
|
package/Dockerfile
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
FROM node:
|
|
1
|
+
FROM node:18
|
|
2
|
+
|
|
3
|
+
LABEL org.opencontainers.image.source https://github.com/ContinuousSecurityTooling/keycloak-reporter
|
|
2
4
|
|
|
3
5
|
ENV CONFIG_FILE=/app/config.json
|
|
4
6
|
|
|
@@ -6,6 +8,6 @@ COPY dist/ docker_entrypoint.sh package.json /app
|
|
|
6
8
|
|
|
7
9
|
WORKDIR /app
|
|
8
10
|
|
|
9
|
-
RUN cd /app &&
|
|
11
|
+
RUN cd /app && npm i
|
|
10
12
|
|
|
11
13
|
ENTRYPOINT ["/app/docker_entrypoint.sh"]
|
package/README.md
CHANGED
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
[](LICENSE)
|
|
5
5
|
[](https://github.com/ContinuousSecurityTooling/keycloak-reporter/actions/workflows/pipeline.yml)
|
|
6
|
-
[](https://www.npmjs.com/package/@continuoussecuritytooling/keycloak-reporter)
|
|
6
|
+
[](https://www.npmjs.com/package/@continuoussecuritytooling/keycloak-reporter)
|
|
7
|
+
[](https://www.npmjs.com/package/@continuoussecuritytooling/keycloak-reporter)
|
|
9
8
|
[](https://hub.docker.com/r/continuoussecuritytooling/keycloak-reporting-cli/)
|
|
10
9
|
[](https://snyk.io/test/github/ContinuousSecurityTooling/keycloak-reporter)
|
|
11
10
|
|
|
@@ -57,13 +56,13 @@ Valid commands are:
|
|
|
57
56
|
|
|
58
57
|
## Advanced
|
|
59
58
|
|
|
60
|
-
|
|
61
59
|
### Helm
|
|
62
|
-
~
|
|
63
60
|
|
|
64
|
-
|
|
61
|
+
To install the Helm Chart use the OCI Package:
|
|
65
62
|
|
|
66
|
-
|
|
63
|
+
```
|
|
64
|
+
helm install keycloak-reporter oci://cloudtooling/helm-charts
|
|
65
|
+
```
|
|
67
66
|
|
|
68
67
|
### Config file
|
|
69
68
|
|
|
@@ -15,7 +15,7 @@ type: application
|
|
|
15
15
|
# This is the chart version. This version number should be incremented each time you make changes
|
|
16
16
|
# to the chart and its templates, including the app version.
|
|
17
17
|
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
|
18
|
-
version: 0.
|
|
18
|
+
version: 1.0.0
|
|
19
19
|
|
|
20
20
|
# This is the version number of the application being deployed. This version number should be
|
|
21
21
|
# incremented each time you make changes to the application. Versions are not expected to
|
|
@@ -60,3 +60,24 @@ Create the name of the service account to use
|
|
|
60
60
|
{{- default "default" .Values.serviceAccount.name }}
|
|
61
61
|
{{- end }}
|
|
62
62
|
{{- end }}
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
{{/*
|
|
67
|
+
Create the name of the service account to use
|
|
68
|
+
*/}}
|
|
69
|
+
{{- define "keycloak-reporter.cronJobs" }}
|
|
70
|
+
{{- $cronJobs := list -}}
|
|
71
|
+
{{- if .Values.cronjobs.users }}
|
|
72
|
+
{{- $userCron := dict "name" "users" "script" "listUsers" "schedule" .Values.cronjobs.users }}
|
|
73
|
+
{{- $cronJobs = printf "%s" $userCron . | append $cronJobs -}}
|
|
74
|
+
{{- end }}
|
|
75
|
+
{{- if .Values.cronjobs.clients }}
|
|
76
|
+
{{- $clientCron := dict "name" "users" "script" "listClients" "schedule" .Values.cronjobs.clients }}
|
|
77
|
+
{{- $cronJobs = printf "%s" $clientCron . | append $cronJobs -}}
|
|
78
|
+
{{- end }}
|
|
79
|
+
{{ join "," $cronJobs }}
|
|
80
|
+
{{- end }}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
{{- $fullName := include "keycloak-reporter.fullname" .
|
|
2
|
-
{{- range .
|
|
1
|
+
{{- $fullName := include "keycloak-reporter.fullname" . }}
|
|
2
|
+
{{- range include "keycloak-reporter.cronJobs" $ | split "," }}
|
|
3
3
|
apiVersion: batch/v1
|
|
4
4
|
kind: CronJob
|
|
5
5
|
metadata:
|
|
@@ -25,7 +25,8 @@ spec:
|
|
|
25
25
|
command:
|
|
26
26
|
- /bin/sh
|
|
27
27
|
- -c
|
|
28
|
-
-
|
|
28
|
+
- |
|
|
29
|
+
node /app/cli.js {{ .script }}
|
|
29
30
|
env:
|
|
30
31
|
- name: CONFIG_FILE
|
|
31
32
|
value: "/app/config.json"
|
|
@@ -35,6 +36,7 @@ spec:
|
|
|
35
36
|
volumeMounts:
|
|
36
37
|
- name: config-file
|
|
37
38
|
mountPath: "/app/config.json"
|
|
39
|
+
subPath: "config.json"
|
|
38
40
|
readOnly: true
|
|
39
41
|
{{- if ($.Values.keycloak.config.volumes).reports }}
|
|
40
42
|
- name: reports-dir
|
|
@@ -8,7 +8,7 @@ image:
|
|
|
8
8
|
repository: continuoussecuritytooling/keycloak-reporting-cli
|
|
9
9
|
pullPolicy: IfNotPresent
|
|
10
10
|
# Overrides the image tag whose default is the chart appVersion.
|
|
11
|
-
tag: "latest"
|
|
11
|
+
#tag: "latest"
|
|
12
12
|
|
|
13
13
|
imagePullSecrets: []
|
|
14
14
|
nameOverride: ""
|
|
@@ -52,12 +52,8 @@ keycloak:
|
|
|
52
52
|
reports: ""
|
|
53
53
|
|
|
54
54
|
cronjobs:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
schedule: 0 0 1 */3 *
|
|
58
|
-
- name: users
|
|
59
|
-
script: /app/index.js listUsers
|
|
60
|
-
schedule: 0 0 1 */3 *
|
|
55
|
+
clients: "0 0 1 */3 *"
|
|
56
|
+
users: "0 0 1 */3 *"
|
|
61
57
|
|
|
62
58
|
resources: {}
|
|
63
59
|
# We usually recommend not to specify default resources and to leave this as a conscious
|
package/cli.ts
CHANGED
|
@@ -100,26 +100,28 @@ yargs(hideBin(process.argv))
|
|
|
100
100
|
() => {},
|
|
101
101
|
async (argv) => {
|
|
102
102
|
const users = await listUsers(<Options>{
|
|
103
|
-
clientId:
|
|
104
|
-
clientSecret:
|
|
105
|
-
?
|
|
106
|
-
:
|
|
107
|
-
rootUrl:
|
|
103
|
+
clientId: config.clientId ? config.clientId : (argv.clientId as string),
|
|
104
|
+
clientSecret: config.clientSecret
|
|
105
|
+
? config.clientSecret
|
|
106
|
+
: (argv.clientSecret as string),
|
|
107
|
+
rootUrl: config.url ? config.url : (argv.url as string)
|
|
108
108
|
});
|
|
109
109
|
await convert(
|
|
110
|
-
argv.format as string,
|
|
111
|
-
argv.output as string,
|
|
110
|
+
config.format ? config.format : (argv.format as string),
|
|
111
|
+
config.output ? config.output : (argv.output as string),
|
|
112
112
|
{
|
|
113
113
|
name: 'user_listing',
|
|
114
|
-
directory: argv.reports as string
|
|
114
|
+
directory: argv.reports ? (argv.reports as string) : config.reports
|
|
115
115
|
},
|
|
116
116
|
new WebhookConfig(
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
config.webhookType
|
|
118
|
+
? config.webhookType
|
|
119
|
+
: (argv.webhookType as string),
|
|
120
|
+
config.webhookUrl ? config.webhookUrl : (argv.webhookUrl as string),
|
|
119
121
|
'User Listing',
|
|
120
|
-
|
|
121
|
-
?
|
|
122
|
-
:
|
|
122
|
+
config.webhookMessage
|
|
123
|
+
? config.webhookMessage
|
|
124
|
+
: (argv.webhookMessage as string)
|
|
123
125
|
),
|
|
124
126
|
users
|
|
125
127
|
);
|
|
@@ -132,26 +134,28 @@ yargs(hideBin(process.argv))
|
|
|
132
134
|
() => {},
|
|
133
135
|
async (argv) => {
|
|
134
136
|
const clients = await listClients(<Options>{
|
|
135
|
-
clientId:
|
|
136
|
-
clientSecret:
|
|
137
|
-
?
|
|
138
|
-
:
|
|
139
|
-
rootUrl:
|
|
137
|
+
clientId: config.clientId ? config.clientId : (argv.clientId as string),
|
|
138
|
+
clientSecret: config.clientSecret
|
|
139
|
+
? config.clientSecret
|
|
140
|
+
: (argv.clientSecret as string),
|
|
141
|
+
rootUrl: config.url ? config.url : (argv.url as string)
|
|
140
142
|
});
|
|
141
143
|
await convert(
|
|
142
|
-
argv.format as string,
|
|
143
|
-
argv.output as string,
|
|
144
|
+
config.format ? config.format : (argv.format as string),
|
|
145
|
+
config.output ? config.output : (argv.output as string),
|
|
144
146
|
{
|
|
145
147
|
name: 'client_listing',
|
|
146
|
-
directory: argv.reports as string
|
|
148
|
+
directory: argv.reports ? (argv.reports as string) : config.reports
|
|
147
149
|
},
|
|
148
150
|
new WebhookConfig(
|
|
149
|
-
|
|
150
|
-
|
|
151
|
+
config.webhookType
|
|
152
|
+
? config.webhookType
|
|
153
|
+
: (argv.webhookType as string),
|
|
154
|
+
config.webhookUrl ? config.webhookUrl : (argv.webhookUrl as string),
|
|
151
155
|
'Client Listing',
|
|
152
|
-
|
|
153
|
-
?
|
|
154
|
-
:
|
|
156
|
+
config.webhookMessage
|
|
157
|
+
? config.webhookMessage
|
|
158
|
+
: (argv.webhookMessage as string)
|
|
155
159
|
),
|
|
156
160
|
clients
|
|
157
161
|
);
|
package/config.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"url": "https://id.m13t.de",
|
|
3
|
+
"clientId": "admin-cli",
|
|
4
|
+
"clientSecret": "PWkJ98Atq36QFP5Z25YXJDWs4tvsGvkI",
|
|
5
|
+
"output": "webhook",
|
|
6
|
+
"webhookType": "teams",
|
|
7
|
+
"webhookUrl": "https://m13t4mgmt.webhook.office.com/webhookb2/02950819-c8ca-4c83-9751-808d801e8810@09f6f098-3af9-474c-a398-d17786fff1bf/IncomingWebhook/b06222e267a04255aaa32a341acb1749/a4f92b5b-01c7-40a8-91ff-0695e08d76ff",
|
|
8
|
+
"webhookMessage": "TEST"
|
|
9
|
+
}
|
package/dist/cli.js
CHANGED
|
@@ -17,6 +17,7 @@ class ReportConfig {
|
|
|
17
17
|
}
|
|
18
18
|
async function convert(format, output, reports, config, json) {
|
|
19
19
|
let outputContent;
|
|
20
|
+
console.log(output);
|
|
20
21
|
switch (format) {
|
|
21
22
|
case 'csv':
|
|
22
23
|
outputContent = (await convertJSON2CSV(json)).toString();
|
|
@@ -64,10 +65,12 @@ yargs(hideBin(process.argv))
|
|
|
64
65
|
: config.clientSecret,
|
|
65
66
|
rootUrl: argv.url ? argv.url : config.url
|
|
66
67
|
});
|
|
67
|
-
await convert(argv.format, argv.output, {
|
|
68
|
+
await convert(config.format ? config.format : argv.format, config.output ? config.output : argv.output, {
|
|
68
69
|
name: 'user_listing',
|
|
69
|
-
directory: argv.reports
|
|
70
|
-
}, new WebhookConfig(
|
|
70
|
+
directory: argv.reports ? argv.reports : config.reports
|
|
71
|
+
}, new WebhookConfig(config.webhookType
|
|
72
|
+
? config.webhookType
|
|
73
|
+
: argv.webhookType, config.webhookUrl ? config.webhookUrl : argv.webhookUrl, 'User Listing', argv.webhookMessage
|
|
71
74
|
? argv.webhookMessage
|
|
72
75
|
: config.webhookMessage), users);
|
|
73
76
|
})
|
|
@@ -81,10 +84,12 @@ yargs(hideBin(process.argv))
|
|
|
81
84
|
: config.clientSecret,
|
|
82
85
|
rootUrl: argv.url ? argv.url : config.url
|
|
83
86
|
});
|
|
84
|
-
await convert(argv.format, argv.output, {
|
|
87
|
+
await convert(config.format ? config.format : argv.format, config.output ? config.output : argv.output, {
|
|
85
88
|
name: 'client_listing',
|
|
86
|
-
directory: argv.reports
|
|
87
|
-
}, new WebhookConfig(
|
|
89
|
+
directory: argv.reports ? argv.reports : config.reports
|
|
90
|
+
}, new WebhookConfig(config.webhookType
|
|
91
|
+
? config.webhookType
|
|
92
|
+
: argv.webhookType, config.webhookUrl ? config.webhookUrl : argv.webhookUrl, 'Client Listing', argv.webhookMessage
|
|
88
93
|
? argv.webhookMessage
|
|
89
94
|
: config.webhookMessage), clients);
|
|
90
95
|
})
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,aAAa,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EACL,SAAS,EACT,WAAW,EAEX,eAAe,EACf,YAAY,EACb,MAAM,YAAY,CAAC;AACpB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,aAAa;IAKjB,YAAY,IAAY,EAAE,GAAW,EAAE,KAAa,EAAE,OAAgB;QACpE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,K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AK,EAAE,GAAG;IACV,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,iBAAiB;CAC/B,CAAC;KACD,MAAM,CAAC,YAAY,EAAE;IACpB,KAAK,EAAE,GAAG;IACV,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,aAAa;CAC3B,CAAC;KACD,MAAM,CAAC,SAAS,EAAE;IACjB,KAAK,EAAE,GAAG;IACV,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,mBAAmB;CACjC,CAAC;KACD,KAAK,EAAE,CAAC"}
|
package/e2e/spec/webhooks.js
CHANGED
|
@@ -49,7 +49,9 @@ test(
|
|
|
49
49
|
'--output=webhook',
|
|
50
50
|
'--webhookType=teams',
|
|
51
51
|
'--webhookUrl=' + process.env.WEBHOOK_TESTING_TEAMS,
|
|
52
|
-
'--webhookMessage="
|
|
52
|
+
'--webhookMessage="' +
|
|
53
|
+
(process.env.WEBHOOK_ADDITIONAL_MESSAGE || 'From Github Actions') +
|
|
54
|
+
'"'
|
|
53
55
|
],
|
|
54
56
|
{
|
|
55
57
|
env: {
|
|
@@ -84,7 +86,9 @@ test(
|
|
|
84
86
|
'--output=webhook',
|
|
85
87
|
'--webhookType=slack',
|
|
86
88
|
'--webhookUrl=' + process.env.WEBHOOK_TESTING_SLACK,
|
|
87
|
-
'--webhookMessage="
|
|
89
|
+
'--webhookMessage="' +
|
|
90
|
+
(process.env.WEBHOOK_ADDITIONAL_MESSAGE || 'From Github Actions') +
|
|
91
|
+
'"'
|
|
88
92
|
],
|
|
89
93
|
{
|
|
90
94
|
env: {
|
package/k8s.yaml
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
apiVersion: batch/v1
|
|
2
|
+
kind: Job
|
|
3
|
+
metadata:
|
|
4
|
+
name: test-job
|
|
5
|
+
namespace: kc-reporter
|
|
6
|
+
spec:
|
|
7
|
+
suspend: false
|
|
8
|
+
template:
|
|
9
|
+
spec:
|
|
10
|
+
containers:
|
|
11
|
+
- command:
|
|
12
|
+
- /bin/sh
|
|
13
|
+
- -c
|
|
14
|
+
- |
|
|
15
|
+
while true; do sleep 30; done;
|
|
16
|
+
env:
|
|
17
|
+
- name: CONFIG_FILE
|
|
18
|
+
value: /app/config.json
|
|
19
|
+
image: continuoussecuritytooling/keycloak-reporting-cli:0.5.1
|
|
20
|
+
imagePullPolicy: IfNotPresent
|
|
21
|
+
name: users
|
|
22
|
+
resources: {}
|
|
23
|
+
terminationMessagePath: /dev/termination-log
|
|
24
|
+
terminationMessagePolicy: File
|
|
25
|
+
volumeMounts:
|
|
26
|
+
- mountPath: /app/config.json
|
|
27
|
+
name: config-file
|
|
28
|
+
readOnly: true
|
|
29
|
+
subPath: config.json
|
|
30
|
+
dnsPolicy: ClusterFirst
|
|
31
|
+
restartPolicy: OnFailure
|
|
32
|
+
schedulerName: default-scheduler
|
|
33
|
+
securityContext: {}
|
|
34
|
+
terminationGracePeriodSeconds: 30
|
|
35
|
+
volumes:
|
|
36
|
+
- name: config-file
|
|
37
|
+
secret:
|
|
38
|
+
defaultMode: 420
|
|
39
|
+
secretName: kc-reporter-test-keycloak-reporter
|
|
40
|
+
status:
|
|
41
|
+
conditions:
|
|
42
|
+
- lastProbeTime: "2023-10-07T07:43:08Z"
|
|
43
|
+
lastTransitionTime: "2023-10-07T07:43:08Z"
|
|
44
|
+
message: Job has reached the specified backoff limit
|
|
45
|
+
reason: BackoffLimitExceeded
|
|
46
|
+
status: "True"
|
|
47
|
+
type: Failed
|
|
48
|
+
failed: 1
|
|
49
|
+
ready: 0
|
|
50
|
+
startTime: "2023-10-07T07:37:15Z"
|
|
51
|
+
uncountedTerminatedPods: {}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@continuoussecuritytooling/keycloak-reporter",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Reporting Tools for Keycloak",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"homepage": "https://github.com/ContinuousSecurityTooling/keycloak-reporter#readme",
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@json2csv/node": "^7.0.0",
|
|
29
|
-
"@keycloak/keycloak-admin-client": "^
|
|
29
|
+
"@keycloak/keycloak-admin-client": "^22.0.0",
|
|
30
30
|
"@slack/webhook": "^6.1.0",
|
|
31
31
|
"ajv": "^8.12.0",
|
|
32
32
|
"install": "^0.13.0",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"yargs": "^17.7.2"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@octokit/rest": "^
|
|
40
|
+
"@octokit/rest": "^20.0.0",
|
|
41
41
|
"@types/jest": "^29.5.1",
|
|
42
42
|
"@types/node": "^20.1.5",
|
|
43
43
|
"@types/yargs": "^17.0.24",
|
package/test.values.yaml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
installCRDs: true
|
|
2
|
+
keycloak:
|
|
3
|
+
config:
|
|
4
|
+
clientId: admin-cli
|
|
5
|
+
clientSecret: PWkJ98Atq36QFP5Z25YXJDWs4tvsGvkI
|
|
6
|
+
webhookType: teams
|
|
7
|
+
webhookUrl: https://m13t4mgmt.webhook.office.com/webhookb2/02950819-c8ca-4c83-9751-808d801e8810@09f6f098-3af9-474c-a398-d17786fff1bf/IncomingWebhook/b06222e267a04255aaa32a341acb1749/a4f92b5b-01c7-40a8-91ff-0695e08d76ff
|
|
8
|
+
webhookMessage: TEST
|