@continuoussecuritytooling/keycloak-reporter 0.8.14 → 1.0.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.
@@ -24,7 +24,7 @@ await startServer()
24
24
  async function startServer () {
25
25
  await downloadServer()
26
26
 
27
- console.info('Starting server…')
27
+ console.info('Starting server …')
28
28
 
29
29
  const args = process.argv.slice(2)
30
30
  const child = spawn(
@@ -32,8 +32,8 @@ async function startServer () {
32
32
  ['start-dev', ...args],
33
33
  {
34
34
  env: {
35
- KEYCLOAK_ADMIN: 'admin',
36
- KEYCLOAK_ADMIN_PASSWORD: 'admin',
35
+ KC_BOOTSTRAP_ADMIN_USERNAME: 'master-admin',
36
+ KC_BOOTSTRAP_ADMIN_PASSWORD: 'admin',
37
37
  ...process.env
38
38
  }
39
39
  }
@@ -44,7 +44,7 @@ async function startServer () {
44
44
  }
45
45
 
46
46
  async function downloadServer () {
47
- const directoryExists = fs.existsSync(SERVER_DIR)
47
+ const directoryExists = fs.existsSync(path.join(SERVER_DIR, `bin/kc${SCRIPT_EXTENSION}`))
48
48
 
49
49
  if (directoryExists) {
50
50
  console.info('Server installation found, skipping download.')
@@ -54,6 +54,7 @@ async function downloadServer () {
54
54
  console.info('Downloading and extracting server…')
55
55
 
56
56
  const nightlyAsset = await getNightlyAsset()
57
+ //console.log(nightlyAsset)
57
58
  const assetStream = await getAssetAsStream(nightlyAsset)
58
59
 
59
60
  await extractTarball(assetStream, SERVER_DIR, { strip: 1 })
@@ -61,14 +62,19 @@ async function downloadServer () {
61
62
 
62
63
  async function getNightlyAsset () {
63
64
  const api = new Octokit()
65
+ const tag = process.env.kcVersion || 'nightly';
64
66
  const release = await api.repos.getReleaseByTag({
65
67
  owner: 'keycloak',
66
68
  repo: 'keycloak',
67
- tag: 'nightly'
69
+ tag: tag
68
70
  })
71
+ let assertName = `keycloak-${tag}.tar.gz`
72
+ if (tag == 'nightly') {
73
+ assertName = 'keycloak-999.0.0-SNAPSHOT.tar.gz'
74
+ }
69
75
 
70
76
  return release.data.assets.find(
71
- ({ name }) => name === 'keycloak-999.0.0-SNAPSHOT.tar.gz'
77
+ ({ name }) => name === assertName
72
78
  )
73
79
  }
74
80
 
@@ -16,9 +16,8 @@ jobs:
16
16
  strategy:
17
17
  matrix:
18
18
  node_version:
19
- - 18
20
19
  - 20
21
- - 21
20
+ - 22
22
21
  os:
23
22
  - ubuntu-latest
24
23
  - macOS-latest
@@ -80,7 +79,11 @@ jobs:
80
79
 
81
80
  - name: Run chart-testing (install - with args)
82
81
  if: steps.list-changed.outputs.changed == 'true'
83
- run: ct install --target-branch ${{ github.event.repository.default_branch }} --helm-extra-set-args "-f charts/keycloak-reporter/ci.values.yaml"
82
+ run: |
83
+ kubectl create ns kc-reporter
84
+ kubectl -n kc-reporter create secret generic kc-reporter \
85
+ --from-literal=clientSecret=test
86
+ ct install --target-branch ${{ github.event.repository.default_branch }} --namespace kc-reporter --helm-extra-set-args "-f charts/keycloak-reporter/ci.values.yaml"
84
87
 
85
88
  - uses: actions/upload-artifact@v4
86
89
  with:
@@ -95,9 +98,8 @@ jobs:
95
98
  fail-fast: true
96
99
  matrix:
97
100
  node_version:
98
- - 18
99
101
  - 20
100
- - 21
102
+ - 22
101
103
  os:
102
104
  - ubuntu-latest
103
105
  steps:
@@ -138,6 +140,23 @@ jobs:
138
140
  WEBHOOK_TESTING_SLACK: ${{ secrets.WEBHOOK_TESTING_SLACK }}
139
141
  WEBHOOK_ADDITIONAL_MESSAGE: ${{ github.head_ref || github.ref_name }}
140
142
 
143
+ build-results:
144
+ name: Build results
145
+ if: ${{ always() }}
146
+ runs-on: ubuntu-latest
147
+ needs:
148
+ - build
149
+ - chart
150
+ - end2end
151
+ steps:
152
+ - run: exit 1
153
+ # see https://stackoverflow.com/a/67532120/4907315
154
+ if: >-
155
+ ${{
156
+ contains(needs.*.result, 'failure')
157
+ || contains(needs.*.result, 'cancelled')
158
+ || contains(needs.*.result, 'skipped')
159
+ }}
141
160
  package:
142
161
  name: Package Application
143
162
  runs-on: ubuntu-latest
@@ -150,7 +169,7 @@ jobs:
150
169
  - uses: actions/setup-node@v4
151
170
  with:
152
171
  # renovate: datasource=docker depName=node
153
- node-version: '20'
172
+ node-version: '22'
154
173
  - name: 'Build Package'
155
174
  run: |
156
175
  npm run clean
@@ -19,10 +19,6 @@ jobs:
19
19
  attestations: write
20
20
  id-token: write
21
21
  steps:
22
- - name: Checkout
23
- uses: actions/checkout@v4
24
- with:
25
- fetch-depth: 0
26
22
 
27
23
  - uses: actions/create-github-app-token@v1
28
24
  id: app-token
@@ -30,6 +26,24 @@ jobs:
30
26
  app-id: ${{ vars.CI_APP_ID }}
31
27
  private-key: ${{ secrets.CI_PRIVATE_KEY }}
32
28
 
29
+ - name: Checkout
30
+ uses: actions/checkout@v4
31
+ with:
32
+ fetch-depth: 0
33
+ token: ${{ steps.app-token.outputs.token }}
34
+ ref: ${{ github.head_ref }}
35
+
36
+ - name: Get GitHub App User ID
37
+ id: get-user-id
38
+ run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
39
+ env:
40
+ GH_TOKEN: ${{ steps.app-token.outputs.token }}
41
+
42
+ - name: Configure Git author
43
+ run: |
44
+ git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
45
+ git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>'
46
+
33
47
  - name: Setup NodeJS
34
48
  uses: actions/setup-node@v4
35
49
  with:
@@ -42,18 +56,25 @@ jobs:
42
56
  distribution: 'temurin' # As good as any other, see: https://github.com/actions/setup-java#supported-distributions
43
57
  java-version: '21'
44
58
 
45
- - name: Configure git
46
- run: |
47
- git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
48
- git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>'
49
- - name: npm build and test
59
+ - name: Package Application
50
60
  run: |
51
61
  npm run clean
52
62
  npm version --no-git-tag-version ${{ github.event.inputs.releaseversion }}
53
63
  npm run build
54
64
 
65
+ - name: Write version vars
66
+ run: |
67
+ BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"`
68
+ BRANCH=${GITHUB_REF_NAME#v}
69
+ APP_VERSION=$(cat package.json | grep version| head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g')
70
+ echo Version: $APP_VERSION
71
+ echo "VERSION=$APP_VERSION" >> $GITHUB_ENV
72
+ echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV
73
+ echo "BUILD_DATE=$BUILD_DATE" >> $GITHUB_ENV
74
+
55
75
  - name: Install Helm
56
76
  uses: azure/setup-helm@v4
77
+
57
78
  - name: Install Python
58
79
  uses: actions/setup-python@v5
59
80
  with:
@@ -70,9 +91,67 @@ jobs:
70
91
 
71
92
  - name: Helm Package
72
93
  run: |
94
+
95
+ # Increment a version string using Semantic Versioning (SemVer) terminology.
96
+ # Parse command line options.
97
+ # Source: https://github.com/fmahnke/shell-semver
98
+ #
99
+ # usage: increment_version.sh [-Mmp] major.minor.patch
100
+ increment_version() {
101
+ while getopts ":Mmp" Option
102
+ do
103
+ case $Option in
104
+ M ) major=true;;
105
+ m ) minor=true;;
106
+ p ) patch=true;;
107
+ * ) patch=true;;
108
+ esac
109
+ done
110
+
111
+ # shellcheck disable=SC2004,SC2206
112
+ shift $(($OPTIND - 1))
113
+
114
+ version=$1
115
+
116
+ # Build array from version string.
117
+ # shellcheck disable=SC2206
118
+ a=( ${version//./ } )
119
+ # If version string is missing or has the wrong number of members, show usage message.
120
+ if [ ${#a[@]} -ne 3 ]
121
+ then
122
+ echo "usage: $(basename $0) [-Mmp] major.minor.patch"
123
+ exit 1
124
+ fi
125
+
126
+ # Increment version numbers as requested.
127
+
128
+ if [ -n "$major" ]
129
+ then
130
+ ((a[0]++))
131
+ a[1]=0
132
+ a[2]=0
133
+ fi
134
+
135
+ if [ -n "$minor" ]
136
+ then
137
+ ((a[1]++))
138
+ a[2]=0
139
+ fi
140
+
141
+ if [ -n "$patch" ]
142
+ then
143
+ ((a[2]++))
144
+ fi
145
+
146
+ echo "${a[0]}.${a[1]}.${a[2]}"
147
+ }
148
+
73
149
  export HELM_CHART_DIR=charts/keycloak-reporter
74
150
  chartVersion=$(cat $HELM_CHART_DIR/Chart.yaml | grep "version: " | sed -E -n "s/^version: \s*(.*)$/\1/p")
75
- sed -i 's/version: '"$chartVersion"'/version: '"${{ github.event.inputs.releaseversion }}"'/g' $HELM_CHART_DIR/Chart.yaml
151
+ appVersion=$(cat $HELM_CHART_DIR/Chart.yaml | grep "appVersion: " | sed -E -n "s/^appVersion: \s*(.*)$/\1/p")
152
+ newVersion=$(increment_version -p $chartVersion)
153
+ sed -i 's/version: '"$chartVersion"'/version: '"$newVersion"'/g' $HELM_CHART_DIR/Chart.yaml
154
+ sed -i 's/appVersion: '"$appVersion"'/appVersion: '"${{ github.event.inputs.releaseversion }}"'/g' $HELM_CHART_DIR/Chart.yaml
76
155
  helm-docs
77
156
  helm package $HELM_CHART_DIR
78
157
  git add .
@@ -85,11 +164,12 @@ jobs:
85
164
  uses: TriPSs/conventional-changelog-action@v5
86
165
  with:
87
166
  input-file: CHANGELOG.md
88
- github-token: ${{ secrets.GITHUB_TOKEN }}
167
+ github-token: ${{ steps.app-token.outputs.token }}
89
168
  version-file: package.json
90
169
  pre-release: true
91
170
  skip-bump: true
92
- skip-on-empty: false
171
+ skip-tag: true
172
+ skip-on-empty: true
93
173
  tag-prefix: 'v'
94
174
 
95
175
  - name: Create Release on GH
@@ -102,6 +182,28 @@ jobs:
102
182
  env:
103
183
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
104
184
 
185
+ - name: Build Container Image
186
+ id: build-image
187
+ uses: redhat-actions/buildah-build@v2
188
+ with:
189
+ image: continuoussecuritytooling/keycloak-reporting-cli
190
+ tags: 'latest ${{ env.APP_VERSION }}'
191
+ containerfiles: |
192
+ ./Dockerfile
193
+ build-args: |
194
+ BUILD_DATE=${{ env.BUILD_DATE }}
195
+ APP_VERSION=${{ env.APP_VERSION }}
196
+
197
+ - name: Push To Docker Hub
198
+ id: push-to-dockerhub-preview
199
+ uses: redhat-actions/push-to-registry@v2
200
+ with:
201
+ image: ${{ steps.build-image.outputs.image }}
202
+ tags: 'latest ${{ env.APP_VERSION }}'
203
+ registry: registry.hub.docker.com
204
+ username: continuoussecuritytooling
205
+ password: ${{ secrets.DOCKER_HUB_TOKEN }}
206
+
105
207
  - name: Publish npm package
106
208
  run: |
107
209
  npm publish
package/CHANGELOG.md CHANGED
@@ -1,3 +1,45 @@
1
+ ## [1.0.1](https://github.com/ContinuousSecurityTooling/keycloak-reporter/compare/v1.0.0...v1.0.1) (2024-10-31)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Correcting docker publish on release ([8930206](https://github.com/ContinuousSecurityTooling/keycloak-reporter/commit/89302069cd56c8ec324cf5a028dd52e07ba3212a))
7
+ * **deps:** update dependency @keycloak/keycloak-admin-client to v26.0.1 ([4b640f2](https://github.com/ContinuousSecurityTooling/keycloak-reporter/commit/4b640f2b9899bbc4055c08c9c6d807639495f3fd))
8
+ * **deps:** update dependency @keycloak/keycloak-admin-client to v26.0.2 ([7b2b427](https://github.com/ContinuousSecurityTooling/keycloak-reporter/commit/7b2b42793de329365109e85d0f8f9dcc24ef66b1))
9
+ * **deps:** update dependency @keycloak/keycloak-admin-client to v26.0.4 ([12f2a15](https://github.com/ContinuousSecurityTooling/keycloak-reporter/commit/12f2a154ee328505691cc8b635f3c916b08e2f0d))
10
+ * **deps:** update dependency openid-client to v6.1.0 ([1238436](https://github.com/ContinuousSecurityTooling/keycloak-reporter/commit/1238436517af761c1cb27e28a1ecd27a0f501b95))
11
+ * **deps:** update dependency openid-client to v6.1.1 ([46c92db](https://github.com/ContinuousSecurityTooling/keycloak-reporter/commit/46c92db73ed39b4c0f4a07f12369270460affaef))
12
+ * **deps:** update dependency openid-client to v6.1.3 ([530087b](https://github.com/ContinuousSecurityTooling/keycloak-reporter/commit/530087b716f8fbe6a7cbe304edfc03107c25189b))
13
+ * **Tests:** Adjust end2end config for keycloak v26 ([79c6d9c](https://github.com/ContinuousSecurityTooling/keycloak-reporter/commit/79c6d9c61b27157cb915f5532e2eb29674e2b763))
14
+ * **Tests:** Adjust test spec ([431c1c6](https://github.com/ContinuousSecurityTooling/keycloak-reporter/commit/431c1c6d6fa951d5c4d987b89d66a644cef5e250))
15
+ * **Tests:** Adjust test to changed config ([8163c80](https://github.com/ContinuousSecurityTooling/keycloak-reporter/commit/8163c80f7a46659d52ab88e9af0b3caf5d412218))
16
+
17
+
18
+
19
+ # [1.0.0](https://github.com/ContinuousSecurityTooling/keycloak-reporter/compare/v0.8.12...v1.0.0) (2024-10-17)
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * **Chart:** Correcting chart version ([bd7eb36](https://github.com/ContinuousSecurityTooling/keycloak-reporter/commit/bd7eb36b0e0c77cfedef23005c25190f2d9aa156))
25
+ * **deps:** update dependency @continuoussecuritytooling/keycloak-auditor to v1.1.10 ([ac7118b](https://github.com/ContinuousSecurityTooling/keycloak-reporter/commit/ac7118bbcdd08dc4df3e33aca1d207ff946abbe6))
26
+ * **deps:** update dependency @continuoussecuritytooling/keycloak-auditor to v1.1.16 ([2c4a9b7](https://github.com/ContinuousSecurityTooling/keycloak-reporter/commit/2c4a9b7e10d481fcfb663ce257abdfd0facc7ae1))
27
+ * **deps:** update dependency @continuoussecuritytooling/keycloak-auditor to v2 ([ecee366](https://github.com/ContinuousSecurityTooling/keycloak-reporter/commit/ecee366ba32cba49e14f116d0e0dffb836182d81))
28
+ * **deps:** update dependency @keycloak/keycloak-admin-client to v25.0.4 ([e79d129](https://github.com/ContinuousSecurityTooling/keycloak-reporter/commit/e79d129308de45c661374303990aad06a3264a48))
29
+ * **deps:** update dependency @keycloak/keycloak-admin-client to v25.0.5 ([179de86](https://github.com/ContinuousSecurityTooling/keycloak-reporter/commit/179de86d06f61eadf6975bee86784fab0fc510a2))
30
+ * **deps:** update dependency @keycloak/keycloak-admin-client to v25.0.6 ([291594b](https://github.com/ContinuousSecurityTooling/keycloak-reporter/commit/291594b23d396d53de98ed458ce133f1b541f779))
31
+ * **deps:** update dependency @keycloak/keycloak-admin-client to v26 ([813c5b1](https://github.com/ContinuousSecurityTooling/keycloak-reporter/commit/813c5b1c80bd657e97f7d7e1dd323d3f1a1d47a4))
32
+ * **deps:** update dependency @slack/webhook to v7.0.3 ([483dce5](https://github.com/ContinuousSecurityTooling/keycloak-reporter/commit/483dce5975e0722e531f673035703ef78983afa0))
33
+ * **deps:** update dependency ms-teams-webhook to v2.2.0 ([38e4184](https://github.com/ContinuousSecurityTooling/keycloak-reporter/commit/38e41849a6a5eb41edafe813f8d9dcd7bfc37f7e))
34
+ * **deps:** update dependency ms-teams-webhook to v2.2.1 ([eb91bcf](https://github.com/ContinuousSecurityTooling/keycloak-reporter/commit/eb91bcff5142099cada7ed1cb9cceac71ebfd9bd))
35
+ * **deps:** update dependency ms-teams-webhook to v2.2.2 ([1ccd777](https://github.com/ContinuousSecurityTooling/keycloak-reporter/commit/1ccd7771918077cadbe74e88e78554e7307871b1))
36
+ * **deps:** update dependency npm to v10.8.3 ([b14ebf4](https://github.com/ContinuousSecurityTooling/keycloak-reporter/commit/b14ebf4f2fa6295aad533f610949425313cb92ce))
37
+ * **deps:** update dependency npm to v10.9.0 ([f2d65c4](https://github.com/ContinuousSecurityTooling/keycloak-reporter/commit/f2d65c43374fc5a32262269d479355ede46ae7f8))
38
+ * **deps:** update dependency openid-client to v5.7.0 ([8688200](https://github.com/ContinuousSecurityTooling/keycloak-reporter/commit/8688200de26bd62077aeec9f01ce8f503e92e296))
39
+ * **deps:** update dependency openid-client to v6 ([cd3edc3](https://github.com/ContinuousSecurityTooling/keycloak-reporter/commit/cd3edc35ca2193a53bd5912d2dd6a074524e647b))
40
+
41
+
42
+
1
43
  ## [0.8.14](https://github.com/ContinuousSecurityTooling/keycloak-reporter/compare/v0.8.12...v0.8.14) (2024-09-17)
2
44
 
3
45
 
package/Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM node:20.17.0-slim
1
+ FROM node:22.11.0-slim
2
2
 
3
3
  ARG BUILD_DATE
4
4
  ARG APP_VERSION
@@ -15,14 +15,14 @@ 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.8.14
18
+ version: 1.3.6
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
22
22
  # follow Semantic Versioning. They should reflect the version the application is using.
23
23
  # It is recommended to use it with quotes.
24
24
  # renovate: datasource=docker depName=ContinuousSecurityTooling/keycloak-reporter
25
- appVersion: '0.8.10'
25
+ appVersion: 1.0.1
26
26
  maintainers:
27
27
  # Martin Reinhardt
28
28
  - name: hypery2k
@@ -1,6 +1,6 @@
1
1
  # keycloak-reporter
2
2
 
3
- ![Version: 0.8.14](https://img.shields.io/badge/Version-0.8.14-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.8.10](https://img.shields.io/badge/AppVersion-0.8.10-informational?style=flat-square)
3
+ ![Version: 1.3.6](https://img.shields.io/badge/Version-1.3.6-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.0.1](https://img.shields.io/badge/AppVersion-1.0.1-informational?style=flat-square)
4
4
 
5
5
  Keycloak user and client reporting tool for automated regular access checks.
6
6
 
@@ -0,0 +1 @@
1
+ sha256:b707ebf14cb1176d648babdfb527909e36ccaaf0c6c4029533d956a4125e6a09