105 Commits

Author SHA1 Message Date
argoyle 5b49b36a32 Merge pull request 'chore(release): prepare for v0.4.0' (#244) from next-release into main
Release / release (push) Successful in 1m17s
authz_client / test (push) Successful in 2m41s
authz_client / vulnerabilities (push) Successful in 2m41s
pre-commit / pre-commit (push) Successful in 4m51s
Reviewed-on: #244
2026-01-09 08:57:37 +00:00
releaser a06bae1da9 chore(release): prepare for v0.4.0 2026-01-09 08:55:47 +00:00
releaser 90084cc3a4 chore(release): prepare for v0.4.0 2026-01-09 08:55:36 +00:00
argoyle 7825fa17a6 Merge pull request 'ci: add pre-commit and release workflows' (#266) from add-workflows into main
authz_client / vulnerabilities (push) Successful in 1m30s
Release / release (push) Successful in 1m10s
authz_client / test (push) Has been cancelled
pre-commit / pre-commit (push) Has been cancelled
Reviewed-on: #266
2026-01-09 08:53:38 +00:00
argoyle 73f854ba06 ci: add pre-commit and release workflows
authz_client / test (pull_request) Successful in 3m9s
authz_client / vulnerabilities (pull_request) Successful in 3m53s
pre-commit / pre-commit (pull_request) Successful in 7m22s
2026-01-09 09:45:06 +01:00
argoyle 5b3527439f Merge pull request 'refactor: update module path to new repository location' (#267) from refactor-update-module-path into main
authz_client / vulnerabilities (push) Successful in 3m12s
authz_client / test (push) Successful in 4m3s
Reviewed-on: #267
2026-01-09 08:44:53 +00:00
argoyle 681afe2626 refactor: update module path to new repository location
authz_client / test (pull_request) Successful in 3m25s
authz_client / vulnerabilities (pull_request) Successful in 3m42s
Remove GitLab CI linter configuration and update module path from 
`gitlab.com/unboundsoftware/shiny/authz_client` to 
`git.unbound.se/shiny/authz_client` in all relevant files. 
These changes reflect a migration to a new hosting service.
2026-01-09 09:28:16 +01:00
argoyle 2e1eb327e0 Merge pull request 'chore(deps): update pre-commit hook golangci/golangci-lint to v2.8.0' (#265) from renovate/golangci-golangci-lint-2.x into main
authz_client / test (push) Successful in 1m1s
authz_client / vulnerabilities (push) Successful in 1m2s
Reviewed-on: #265
2026-01-09 04:11:30 +00:00
renovate 622d907e03 chore(deps): update pre-commit hook golangci/golangci-lint to v2.8.0
authz_client / vulnerabilities (pull_request) Successful in 1m45s
authz_client / test (pull_request) Successful in 1m47s
2026-01-08 21:02:44 +00:00
argoyle 4b38ce4f0f Merge pull request 'chore(deps): update actions/checkout action to v6' (#264) from renovate/actions-checkout-6.x into main
authz_client / test (push) Successful in 3m55s
authz_client / vulnerabilities (push) Successful in 4m13s
Reviewed-on: #264
2026-01-08 19:21:16 +00:00
renovate b82e15c49b chore(deps): update actions/checkout action to v6
authz_client / test (pull_request) Successful in 1m16s
authz_client / vulnerabilities (pull_request) Successful in 1m14s
2026-01-08 19:01:10 +00:00
argoyle f0ea0d7d26 Merge pull request 'chore(deps): update actions/setup-go action to v6' (#263) from renovate/actions-setup-go-6.x into main
authz_client / test (push) Successful in 2m42s
authz_client / vulnerabilities (push) Successful in 3m32s
Reviewed-on: #263
2026-01-08 18:28:51 +00:00
renovate 26de10c2b9 chore(deps): update actions/setup-go action to v6
authz_client / test (pull_request) Successful in 1m53s
authz_client / vulnerabilities (pull_request) Successful in 1m57s
2026-01-08 18:01:11 +00:00
argoyle 3865b1b5f7 Merge pull request 'feat: migrate from GitLab CI to Gitea Actions' (#262) from feat/gitea-actions into main
authz_client / vulnerabilities (push) Successful in 1m58s
authz_client / test (push) Successful in 2m0s
Reviewed-on: #262
2026-01-08 17:59:17 +00:00
argoyle cd84a51f91 feat: migrate from GitLab CI to Gitea Actions
authz_client / test (pull_request) Successful in 1m14s
authz_client / vulnerabilities (pull_request) Successful in 1m23s
2026-01-08 18:33:57 +01:00
Unbound Release eab39dc818 chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
Unbound Release 524cad9180 chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
Unbound Release b339804535 chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
Unbound Release d2ed9ed12a chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
Unbound Release f521fb29c9 chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
Unbound Release 123dd2a4c2 chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
Unbound Release c5943b41ec chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
Unbound Release 5644b061c0 chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
Unbound Release 8330219579 chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
Unbound Release 425013f115 chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
Unbound Release 7f3b78b000 chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
Unbound Release ab8a9809d5 chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
Unbound Release 9ef9084ffa chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
Unbound Release e48c5b3bb9 chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
Unbound Release 4421bcfbeb chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
Unbound Release 18748ceaad chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
Unbound Release 14d32b3b51 chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
Unbound Release d571e92a0b chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
Unbound Release d355edd642 chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
Unbound Release abd34b334a chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
Unbound Release da73907913 chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
Unbound Release becde50685 chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
Unbound Release a84a14a0d3 chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
Unbound Release 707e26b420 chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
Unbound Release ffa2eca348 chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
Unbound Release 76fc782c96 chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
Unbound Release 4d3147c65c chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
Unbound Release 6643990160 chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
Unbound Release 20d69f9c19 chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
Unbound Release d327307539 chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
Unbound Release 5dce8a0f2b chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
Unbound Release 6f6272cb02 chore(release): prepare for v0.3.2 2025-12-31 21:12:27 +00:00
argoyle 7eddad8d4b Merge branch 'claude-docs' into 'main'
docs: add CLAUDE.md for Claude Code integration

See merge request unboundsoftware/shiny/authz_client!258
2025-12-31 22:10:52 +01:00
argoyle 1fd3ae5123 docs: add CLAUDE.md for Claude Code integration 2025-12-31 22:06:51 +01:00
argoyle 247c04a710 Merge branch 'renovate/golang-1.25.5' into 'main'
chore(deps): update golang:1.25.5 docker digest to ad03ba9

See merge request unboundsoftware/shiny/authz_client!257
2025-12-30 16:01:41 +01:00
Renovate 37f6c63025 chore(deps): update golang:1.25.5 docker digest to ad03ba9 2025-12-30 04:04:50 +00:00
argoyle 215a9ed976 Merge branch 'renovate/golang-1.25.5' into 'main'
chore(deps): update golang:1.25.5 docker digest to 0c27bcf

See merge request unboundsoftware/shiny/authz_client!256
2025-12-09 09:56:00 +01:00
Renovate 006ebd101e chore(deps): update golang:1.25.5 docker digest to 0c27bcf 2025-12-09 02:18:45 +00:00
argoyle 600653518c Merge branch 'renovate/golangci-golangci-lint-2.x' into 'main'
chore(deps): update pre-commit hook golangci/golangci-lint to v2.7.2

See merge request unboundsoftware/shiny/authz_client!255
2025-12-08 09:49:47 +01:00
Renovate c95cd1c80a chore(deps): update pre-commit hook golangci/golangci-lint to v2.7.2 2025-12-07 17:05:12 +00:00
argoyle 881a6f0e3c Merge branch 'renovate/golangci-golangci-lint-2.x' into 'main'
chore(deps): update pre-commit hook golangci/golangci-lint to v2.7.1

See merge request unboundsoftware/shiny/authz_client!254
2025-12-04 17:29:56 +01:00
Renovate 84939fa04b chore(deps): update pre-commit hook golangci/golangci-lint to v2.7.1 2025-12-04 15:07:58 +00:00
argoyle 0821cbb6eb Merge branch 'renovate/golangci-golangci-lint-2.x' into 'main'
chore(deps): update pre-commit hook golangci/golangci-lint to v2.7.0

See merge request unboundsoftware/shiny/authz_client!253
2025-12-04 08:31:19 +01:00
Renovate 0cb8363ab1 chore(deps): update pre-commit hook golangci/golangci-lint to v2.7.0 2025-12-03 20:05:00 +00:00
argoyle 8a440bd28c Merge branch 'renovate/golang-1.x' into 'main'
chore(deps): update golang docker tag to v1.25.5

See merge request unboundsoftware/shiny/authz_client!252
2025-12-02 20:15:25 +01:00
argoyle 13461b43e3 Merge branch 'renovate/go-1.x' into 'main'
chore(deps): update dependency go to v1.25.5

See merge request unboundsoftware/shiny/authz_client!251
2025-12-02 19:31:56 +01:00
Renovate 49100894e9 chore(deps): update golang docker tag to v1.25.5 2025-12-02 18:19:27 +00:00
Renovate 7818f97a7c chore(deps): update dependency go to v1.25.5 2025-12-02 17:17:24 +00:00
argoyle 66c429bde1 Merge branch 'renovate/gitleaks-gitleaks-8.x' into 'main'
chore(deps): update pre-commit hook gitleaks/gitleaks to v8.30.0

See merge request unboundsoftware/shiny/authz_client!250
2025-11-27 00:08:10 +01:00
Renovate 585fa5dfa4 chore(deps): update pre-commit hook gitleaks/gitleaks to v8.30.0 2025-11-26 19:06:23 +00:00
argoyle 82cca9b09c Merge branch 'renovate/gitleaks-gitleaks-8.x' into 'main'
chore(deps): update pre-commit hook gitleaks/gitleaks to v8.29.1

See merge request unboundsoftware/shiny/authz_client!249
2025-11-20 09:26:39 +01:00
Renovate bcbddac138 chore(deps): update pre-commit hook gitleaks/gitleaks to v8.29.1 2025-11-19 22:05:31 +00:00
argoyle e62257d933 Merge branch 'renovate/golang-1.25.4' into 'main'
chore(deps): update golang:1.25.4 docker digest to efe81fa

See merge request unboundsoftware/shiny/authz_client!248
2025-11-18 15:46:41 +01:00
Renovate f45918bac8 chore(deps): update golang:1.25.4 docker digest to efe81fa 2025-11-18 12:05:17 +00:00
argoyle 77ac58202a Merge branch 'renovate/golangci-golangci-lint-2.x' into 'main'
chore(deps): update pre-commit hook golangci/golangci-lint to v2.6.2

See merge request unboundsoftware/shiny/authz_client!247
2025-11-14 16:25:46 +01:00
Renovate 257a97f191 chore(deps): update pre-commit hook golangci/golangci-lint to v2.6.2 2025-11-14 14:06:05 +00:00
argoyle 32e8127273 Merge branch 'renovate/golang-1.x' into 'main'
chore(deps): update golang docker tag to v1.25.4

See merge request unboundsoftware/shiny/authz_client!246
2025-11-06 07:06:32 +01:00
Renovate 223f65396d chore(deps): update golang docker tag to v1.25.4 2025-11-05 22:18:16 +00:00
argoyle 01d4a4bc9f Merge branch 'renovate/go-1.x' into 'main'
chore(deps): update dependency go to v1.25.4

See merge request unboundsoftware/shiny/authz_client!245
2025-11-05 21:40:35 +01:00
Renovate 1038cff1d9 chore(deps): update dependency go to v1.25.4 2025-11-05 20:16:30 +00:00
argoyle f961bf91f7 Merge branch 'renovate/gitleaks-gitleaks-8.x' into 'main'
chore(deps): update pre-commit hook gitleaks/gitleaks to v8.29.0

See merge request unboundsoftware/shiny/authz_client!244
2025-11-05 08:34:23 +01:00
Renovate 721cb1be91 chore(deps): update pre-commit hook gitleaks/gitleaks to v8.29.0 2025-11-05 02:05:39 +00:00
argoyle 2f570a0638 Merge branch 'renovate/golangci-golangci-lint-2.x' into 'main'
chore(deps): update pre-commit hook golangci/golangci-lint to v2.6.1

See merge request unboundsoftware/shiny/authz_client!243
2025-11-04 14:13:27 +01:00
argoyle ee52c50e76 Merge branch 'renovate/golang-1.25.3' into 'main'
chore(deps): update golang:1.25.3 docker digest to 9ac0edc

See merge request unboundsoftware/shiny/authz_client!242
2025-11-04 14:13:03 +01:00
Renovate 675ac0338f chore(deps): update pre-commit hook golangci/golangci-lint to v2.6.1 2025-11-04 12:07:17 +00:00
Renovate f708a18960 chore(deps): update golang:1.25.3 docker digest to 9ac0edc 2025-11-04 12:07:15 +00:00
argoyle a8ba5635e3 Merge branch 'test-concurrent-fetch-read-privileges' into 'main'
test: add concurrent fetch and read tests for privileges

See merge request unboundsoftware/shiny/authz_client!240
2025-11-03 12:46:01 +01:00
argoyle 4efc6572ee test: add concurrent fetch and read tests for privileges
Adds multiple tests to verify the thread-safety of the 
Fetch method and the handling of privileges in concurrent 
operations. Tests include concurrent fetching, reading 
privileges, and processing with multiple goroutines. 
Ensures no errors occur during operations and verifies 
privileges are set correctly.
2025-11-03 12:40:14 +01:00
argoyle 05c59fa4a5 Merge branch 'next-release' into 'main'
chore(release): prepare for v0.3.1

See merge request unboundsoftware/shiny/authz_client!236
2025-11-02 22:16:23 +01:00
Unbound Release 52ea18c616 chore(release): prepare for v0.3.1 2025-11-02 22:16:23 +01:00
argoyle 9dd2b5aaa8 Merge branch 'fix/thread-safety-json-unmarshal' into 'main'
fix: change to write lock for thread safety in json unmarshal

See merge request unboundsoftware/shiny/authz_client!239
2025-11-02 22:09:18 +01:00
argoyle af93e418f4 fix: change to write lock for thread safety in json unmarshal
Replace read lock with write lock in client.go to ensure thread 
safety during the unmarshalling of JSON data. This prevents 
concurrent read access and potential data races, improving 
the integrity of the privileges data structure.
2025-11-02 21:56:54 +01:00
argoyle 46e26efe67 Merge branch 'renovate/golangci-golangci-lint-2.x' into 'main'
chore(deps): update pre-commit hook golangci/golangci-lint to v2.6.0

See merge request unboundsoftware/shiny/authz_client!238
2025-10-29 23:19:58 +01:00
Renovate f65e3868e3 chore(deps): update pre-commit hook golangci/golangci-lint to v2.6.0 2025-10-29 20:05:28 +00:00
argoyle 003407ecaa Merge branch 'renovate/golang-1.25.3' into 'main'
chore(deps): update golang:1.25.3 docker digest to 69d1009

See merge request unboundsoftware/shiny/authz_client!237
2025-10-21 14:24:42 +02:00
Renovate 50849e8682 chore(deps): update golang:1.25.3 docker digest to 69d1009 2025-10-21 10:05:31 +00:00
argoyle 3e8b3d00e5 Merge branch 'ci-add-default-git-cliff-config' into 'main'
ci: add default configuration for git-cliff

See merge request unboundsoftware/shiny/authz_client!235
2025-10-14 11:32:12 +02:00
argoyle a5ac3c3500 ci: add default configuration for git-cliff
Introduce a default configuration file for git-cliff to manage 
changelog generation. This file includes customizable templates 
for the changelog header, body, and footer, and enables parsing 
of commit messages according to the conventional commits 
specification. The changes facilitate easier and standardized 
documentation of project updates and changes.
2025-10-14 11:26:09 +02:00
argoyle 2502c85497 Merge branch 'renovate/golang-1.x' into 'main'
chore(deps): update golang docker tag to v1.25.3

See merge request unboundsoftware/shiny/authz_client!234
2025-10-14 08:55:12 +02:00
argoyle ed60a0ccb3 Merge branch 'renovate/go-1.x' into 'main'
chore(deps): update dependency go to v1.25.3

See merge request unboundsoftware/shiny/authz_client!233
2025-10-14 08:54:53 +02:00
Renovate 047e09823d chore(deps): update golang docker tag to v1.25.3 2025-10-14 00:06:39 +00:00
Renovate a0326a1594 chore(deps): update dependency go to v1.25.3 2025-10-13 22:03:09 +00:00
argoyle fe5a401bfc Merge branch 'renovate/golang-1.x' into 'main'
chore(deps): update golang docker tag to v1.25.2

See merge request unboundsoftware/shiny/authz_client!232
2025-10-08 09:10:12 +02:00
Renovate c12617975f chore(deps): update golang docker tag to v1.25.2 2025-10-07 22:15:29 +00:00
Renovate 64a3a6e533 chore(deps): update dependency go to v1.25.2 2025-10-07 19:16:16 +00:00
Renovate c46753598d chore(deps): update pre-commit hook alessandrojcm/commitlint-pre-commit-hook to v9.23.0 2025-10-02 10:06:38 +00:00
Renovate 30637a081d chore(deps): update golang:1.25.1 docker digest to 12640a4 2025-10-01 14:06:27 +00:00
Renovate 44bebba3c1 chore(deps): update pre-commit hook golangci/golangci-lint to v2.5.0 2025-09-21 20:03:50 +00:00
Renovate 830e1307bd chore(deps): update pre-commit hook lietu/go-pre-commit to v1 2025-09-13 09:17:33 +00:00
Renovate f094014c90 chore(deps): update golang:1.25.1 docker digest to 53f7808 2025-09-08 23:29:32 +00:00
14 changed files with 762 additions and 51 deletions
+30
View File
@@ -0,0 +1,30 @@
name: authz_client
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: 'stable'
- name: Run tests
run: go test -race -coverprofile=coverage.txt ./...
vulnerabilities:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: 'stable'
- name: Check vulnerabilities
run: |
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./...
+25
View File
@@ -0,0 +1,25 @@
name: pre-commit
permissions: read-all
on:
pull_request:
push:
branches:
- main
jobs:
pre-commit:
runs-on: ubuntu-latest
env:
SKIP: no-commit-to-branch
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: stable
- uses: actions/setup-python@v5
with:
python-version: '3.14'
- name: Install goimports
run: go install golang.org/x/tools/cmd/goimports@latest
- uses: pre-commit/action@v3.0.1
+9
View File
@@ -0,0 +1,9 @@
name: Release
on:
push:
branches: [main]
jobs:
release:
uses: unboundsoftware/shared-workflows/.gitea/workflows/Release.yml@main
+2
View File
@@ -1,2 +1,4 @@
.idea
.claude
/release
coverage.txt
+2 -2
View File
@@ -7,7 +7,7 @@ include:
- project: unboundsoftware/ci-templates
file: Pre-Commit-Go.gitlab-ci.yml
image: amd64/golang:1.25.1@sha256:70de49a6a9bfd1bde2b332fde29d04a8cc65047464fa97ddb94251b05e572bc0
image: amd64/golang:1.25.5@sha256:ad03ba93327b8a6143b49373790b5d92c28067bdb814418509466122ee9c9e63
stages:
- deps
@@ -32,7 +32,7 @@ test:
vulnerabilities:
stage: test
image: amd64/golang:1.25.1@sha256:70de49a6a9bfd1bde2b332fde29d04a8cc65047464fa97ddb94251b05e572bc0
image: amd64/golang:1.25.5@sha256:ad03ba93327b8a6143b49373790b5d92c28067bdb814418509466122ee9c9e63
script:
- go install golang.org/x/vuln/cmd/govulncheck@latest
- govulncheck ./...
+5 -12
View File
@@ -10,15 +10,8 @@ repos:
args:
- --allow-multiple-documents
- id: check-added-large-files
- repo: https://gitlab.com/devopshq/gitlab-ci-linter
rev: v1.0.6
hooks:
- id: gitlab-ci-linter
args:
- --project
- unboundsoftware/shiny/authz_client
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.22.0
rev: v9.23.0
hooks:
- id: commitlint
stages: [ commit-msg ]
@@ -30,17 +23,17 @@ repos:
- id: go-imports
args:
- -local
- gitlab.com/unboundsoftware/shiny/authz_client
- git.unbound.se/shiny/authz_client
- repo: https://github.com/lietu/go-pre-commit
rev: v0.1.0
rev: v1.0.0
hooks:
- id: go-test
- id: gofumpt
- repo: https://github.com/golangci/golangci-lint
rev: v2.4.0
rev: v2.8.0
hooks:
- id: golangci-lint-full
- repo: https://github.com/gitleaks/gitleaks
rev: v8.28.0
rev: v8.30.0
hooks:
- id: gitleaks
+3
View File
@@ -0,0 +1,3 @@
{
"version": "v0.4.0"
}
+273 -30
View File
@@ -1,3 +1,69 @@
# Changelog
All notable changes to this project will be documented in this file.
## [0.4.0] - 2026-01-09
### 🚀 Features
- Migrate from GitLab CI to Gitea Actions
### 🚜 Refactor
- Update module path to new repository location
### 📚 Documentation
- Add CLAUDE.md for Claude Code integration
### 🧪 Testing
- Add concurrent fetch and read tests for privileges
### ⚙️ Miscellaneous Tasks
- *(deps)* Update golang:1.25.3 docker digest to 9ac0edc
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.6.1
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.29.0
- *(deps)* Update dependency go to v1.25.4
- *(deps)* Update golang docker tag to v1.25.4
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.6.2
- *(deps)* Update golang:1.25.4 docker digest to efe81fa
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.29.1
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.30.0
- *(deps)* Update dependency go to v1.25.5
- *(deps)* Update golang docker tag to v1.25.5
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.7.0
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.7.1
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.7.2
- *(deps)* Update golang:1.25.5 docker digest to 0c27bcf
- *(deps)* Update golang:1.25.5 docker digest to ad03ba9
- *(deps)* Update actions/setup-go action to v6
- *(deps)* Update actions/checkout action to v6
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.8.0
- Add pre-commit and release workflows
## [0.3.1] - 2025-11-02
### 🐛 Bug Fixes
- Change to write lock for thread safety in json unmarshal
### ⚙️ Miscellaneous Tasks
- *(deps)* Update golang:1.25.1 docker digest to 53f7808
- *(deps)* Update pre-commit hook lietu/go-pre-commit to v1
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.5.0
- *(deps)* Update golang:1.25.1 docker digest to 12640a4
- *(deps)* Update pre-commit hook alessandrojcm/commitlint-pre-commit-hook to v9.23.0
- *(deps)* Update dependency go to v1.25.2
- *(deps)* Update golang docker tag to v1.25.2
- *(deps)* Update dependency go to v1.25.3
- *(deps)* Update golang docker tag to v1.25.3
- Add default configuration for git-cliff
- *(deps)* Update golang:1.25.3 docker digest to 69d1009
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.6.0
## [0.3.0] - 2025-09-06
### 🚀 Features
@@ -10,6 +76,49 @@
- *(deps)* Update module github.com/sparetimecoders/goamqp to v0.3.3
- *(deps)* Update module github.com/stretchr/testify to v1.11.0
- *(deps)* Update module github.com/stretchr/testify to v1.11.1
### ⚙️ Miscellaneous Tasks
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.1.0
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.1.1
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.1.2
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.1.4
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.1.5
- *(deps)* Update golang:1.24.2 docker digest to bf7899c
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.25.0
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.25.1
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.1.6
- *(deps)* Update dependency go to v1.24.3
- *(deps)* Update golang docker tag to v1.24.3
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.26.0
- *(deps)* Update golang:1.24.3 docker digest to f255a7d
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.27.0
- *(deps)* Update dependency go to v1.24.4
- *(deps)* Update golang docker tag to v1.24.4
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.27.1
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.27.2
- *(deps)* Update golang:1.24.4 docker digest to 3494bbe
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.2.0
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.2.1
- *(deps)* Update golang:1.24.4 docker digest to 9f820b6
- *(deps)* Update dependency go to v1.24.5
- *(deps)* Update golang docker tag to v1.24.5
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.2.2
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.28.0
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.3.0
- *(deps)* Update golang:1.24.5 docker digest to 0a156a4
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.3.1
- *(deps)* Update dependency go to v1.24.6
- *(deps)* Update golang docker tag to v1.24.6
- *(deps)* Update pre-commit hook pre-commit/pre-commit-hooks to v6
- *(deps)* Update golang:1.24.6 docker digest to 958bfd1
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.4.0
- *(deps)* Update golang docker tag to v1.25.0
- *(deps)* Update dependency go to v1.25.0
- *(deps)* Update golang:1.25.0 docker digest to f6b9e1a
- *(deps)* Update dependency go to v1.25.1
- *(deps)* Update golang docker tag to v1.25.1
## [0.2.0] - 2025-04-11
### 🚀 Features
@@ -26,6 +135,82 @@
### 🚜 Refactor
- *(ci)* Remove pre-commit job and add new template
### ⚙️ Miscellaneous Tasks
- *(deps)* Update pre-commit hook pre-commit/pre-commit-hooks to v5
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.20.1
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.21.0
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.21.1
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.21.2
- *(deps)* Pin golang docker tag to ad5c126
- *(deps)* Pin unbound/pre-commit docker tag to 92fce44
- *(deps)* Update golang docker tag to v1.23.3
- *(deps)* Update unbound/pre-commit docker digest to 596abf5
- *(deps)* Update pre-commit hook golangci/golangci-lint to v1.62.0
- *(deps)* Update golang:1.23.3 docker digest to 8956c08
- *(deps)* Update unbound/pre-commit docker digest to e78425c
- *(deps)* Update golang:1.23.3 docker digest to 3694e36
- *(deps)* Update golang:1.23.3 docker digest to b2ca381
- *(deps)* Update golang:1.23.3 docker digest to 2660218
- *(deps)* Update golang:1.23.3 docker digest to c2d828f
- *(deps)* Update golang:1.23.3 docker digest to 73f06be
- *(deps)* Update pre-commit hook golangci/golangci-lint to v1.62.2
- *(deps)* Update pre-commit hook alessandrojcm/commitlint-pre-commit-hook to v9.19.0
- *(deps)* Update golang:1.23.3 docker digest to ee5f0ad
- *(deps)* Update golang:1.23.3 docker digest to b4aabba
- *(deps)* Update golang:1.23.3 docker digest to 2b01164
- *(deps)* Update golang:1.23.3 docker digest to 017ec6b
- *(deps)* Update golang docker tag to v1.23.4
- *(deps)* Update golang:1.23.4 docker digest to 574185e
- *(deps)* Update golang:1.23.4 docker digest to 7003184
- *(deps)* Update pre-commit hook alessandrojcm/commitlint-pre-commit-hook to v9.20.0
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.21.3
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.21.4
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.22.0
- *(deps)* Update golang:1.23.4 docker digest to 7ea4c9d
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.22.1
- *(deps)* Update pre-commit hook golangci/golangci-lint to v1.63.0
- *(deps)* Update pre-commit hook golangci/golangci-lint to v1.63.1
- *(deps)* Update pre-commit hook golangci/golangci-lint to v1.63.2
- *(deps)* Update pre-commit hook golangci/golangci-lint to v1.63.3
- *(deps)* Update pre-commit hook golangci/golangci-lint to v1.63.4
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.23.0
- *(deps)* Update golang:1.23.4 docker digest to 3b1a7de
- *(deps)* Update golang:1.23.4 docker digest to 08e1417
- *(deps)* Update golang:1.23.4 docker digest to 585103a
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.23.1
- *(deps)* Update golang:1.23.4 docker digest to 5305905
- *(deps)* Update golang:1.23.4 docker digest to 9820aca
- *(deps)* Update golang docker tag to v1.23.5
- *(deps)* Update golang:1.23.5 docker digest to 8c10f21
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.23.2
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.23.3
- *(deps)* Update golang:1.23.5 docker digest to e213430
- *(deps)* Update golang docker tag to v1.23.6
- *(deps)* Update golang:1.23.6 docker digest to 958bd2e
- *(deps)* Update golang:1.23.6 docker digest to 9271129
- *(deps)* Update pre-commit hook golangci/golangci-lint to v1.64.2
- *(deps)* Update golang docker tag to v1.24.0
- *(deps)* Update pre-commit hook golangci/golangci-lint to v1.64.4
- *(deps)* Update pre-commit hook golangci/golangci-lint to v1.64.5
- *(deps)* Update pre-commit hook alessandrojcm/commitlint-pre-commit-hook to v9.21.0
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.24.0
- *(deps)* Update golang:1.24.0 docker digest to 4a3f101
- *(deps)* Update pre-commit hook golangci/golangci-lint to v1.64.6
- *(deps)* Update golang docker tag to v1.24.1
- *(deps)* Update pre-commit hook alessandrojcm/commitlint-pre-commit-hook to v9.22.0
- *(deps)* Update pre-commit hook golangci/golangci-lint to v1.64.7
- *(deps)* Update pre-commit hook golangci/golangci-lint to v1.64.8
- *(deps)* Update golang:1.24.1 docker digest to 5ecf333
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.24.2
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.0.1
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.0.2
- *(deps)* Update golang docker tag to v1.24.2
- *(deps)* Update golang:1.24.2 docker digest to aebb7df
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.24.3
## [0.1.4] - 2024-10-05
### 🐛 Bug Fixes
@@ -33,30 +218,67 @@
- *(deps)* Update module github.com/stretchr/testify to v1.9.0
- *(deps)* Update module github.com/sparetimecoders/goamqp to v0.3.1
### 💼 Other
- *(deps)* Bump github.com/sparetimecoders/goamqp from 0.2.1 to 0.3.0
### ⚙️ Miscellaneous Tasks
- Update to Go 1.21.6
- Update to Go 1.22.0
- *(deps)* Update node.js to v20
- *(deps)* Update pre-commit hook devopshq/gitlab-ci-linter to v1.0.6
- *(deps)* Update pre-commit hook alessandrojcm/commitlint-pre-commit-hook to v9.11.0
- *(deps)* Update pre-commit hook golangci/golangci-lint to v1.56.2
- *(deps)* Update pre-commit hook lietu/go-pre-commit to v0.1.0
- *(deps)* Update pre-commit hook pre-commit/pre-commit-hooks to v4.5.0
- *(deps)* Update pre-commit hook alessandrojcm/commitlint-pre-commit-hook to v9.12.0
- *(deps)* Update pre-commit hook alessandrojcm/commitlint-pre-commit-hook to v9.13.0
- *(deps)* Update golang docker tag to v1.22.1
- *(deps)* Update pre-commit hook golangci/golangci-lint to v1.57.0
- *(deps)* Update pre-commit hook golangci/golangci-lint to v1.57.1
- Add gitleaks to pre-commit setup
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.18.2
- *(deps)* Update pre-commit hook golangci/golangci-lint to v1.57.2
- *(deps)* Update pre-commit hook alessandrojcm/commitlint-pre-commit-hook to v9.14.0
- *(deps)* Update golang docker tag to v1.22.2
- *(deps)* Update pre-commit hook pre-commit/pre-commit-hooks to v4.6.0
- *(deps)* Update pre-commit hook alessandrojcm/commitlint-pre-commit-hook to v9.15.0
- *(deps)* Update pre-commit hook alessandrojcm/commitlint-pre-commit-hook to v9.16.0
- *(deps)* Update pre-commit hook golangci/golangci-lint to v1.58.0
- *(deps)* Update golang docker tag to v1.22.3
- *(deps)* Update pre-commit hook golangci/golangci-lint to v1.58.1
- *(deps)* Update pre-commit hook golangci/golangci-lint to v1.58.2
- *(deps)* Update pre-commit hook golangci/golangci-lint to v1.59.0
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.18.3
- *(deps)* Update golang docker tag to v1.22.4
- *(deps)* Update pre-commit hook golangci/golangci-lint to v1.59.1
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.18.4
- *(deps)* Update golang docker tag to v1.22.5
- *(deps)* Update golang docker tag to v1.22.6
- *(deps)* Update pre-commit hook golangci/golangci-lint to v1.60.1
- *(deps)* Update golang docker tag to v1.23.0
- Update golangci-lint to use full version
- *(deps)* Update pre-commit hook golangci/golangci-lint to v1.60.2
- *(deps)* Update pre-commit hook golangci/golangci-lint to v1.60.3
- *(deps)* Update pre-commit hook alessandrojcm/commitlint-pre-commit-hook to v9.17.0
- *(deps)* Update golang docker tag to v1.23.1
- *(deps)* Update pre-commit hook golangci/golangci-lint to v1.61.0
- *(deps)* Update pre-commit hook alessandrojcm/commitlint-pre-commit-hook to v9.18.0
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.19.1
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.19.2
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.19.3
- *(deps)* Update golang docker tag to v1.23.2
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.20.0
- Add release flow
- Remove old release job
### Build
- *(deps)* Bump github.com/sparetimecoders/goamqp from 0.2.1 to 0.3.0
## [0.1.3] - 2023-12-26
### 🐛 Bug Fixes
- Prohibit concurrent read/write
### 💼 Other
- *(deps)* Bump github.com/sparetimecoders/goamqp from 0.1.4 to 0.1.5
- *(deps)* Bump github.com/sparetimecoders/goamqp from 0.1.5 to 0.2.0
- *(deps)* Bump github.com/sparetimecoders/goamqp from 0.2.0 to 0.2.1
### ⚙️ Miscellaneous Tasks
- Update Go version
@@ -68,31 +290,31 @@
- Use 1.21.1 in go.mod for Dependabot
- Update to go 1.21.3 and remove patch level
- Update version of Go
### Build
- *(deps)* Bump github.com/sparetimecoders/goamqp from 0.1.4 to 0.1.5
- *(deps)* Bump github.com/sparetimecoders/goamqp from 0.1.5 to 0.2.0
- *(deps)* Bump github.com/sparetimecoders/goamqp from 0.2.0 to 0.2.1
## [0.1.2] - 2023-06-04
### 💼 Other
- *(deps)* Bump github.com/stretchr/testify from 1.8.2 to 1.8.3
- *(deps)* Bump github.com/stretchr/testify from 1.8.3 to 1.8.4
### ⚙️ Miscellaneous Tasks
- Update pre-commit and fix golangci-lint
- Update golangci-lint
### Build
- *(deps)* Bump github.com/stretchr/testify from 1.8.2 to 1.8.3
- *(deps)* Bump github.com/stretchr/testify from 1.8.3 to 1.8.4
## [0.1.1] - 2023-05-11
### 🐛 Bug Fixes
- Run builds with Go 1.19.2 to fix vulnerabilities
### 💼 Other
- *(deps)* Bump github.com/stretchr/testify from 1.8.0 to 1.8.1
- *(deps)* Bump github.com/sparetimecoders/goamqp from 0.1.1 to 0.1.2
- *(deps)* Bump github.com/sparetimecoders/goamqp from 0.1.2 to 0.1.3
- *(deps)* Bump github.com/stretchr/testify from 1.8.1 to 1.8.2
- *(deps)* Bump github.com/sparetimecoders/goamqp from 0.1.3 to 0.1.4
### ⚙️ Miscellaneous Tasks
- Add vulnerability-check
@@ -106,13 +328,32 @@
- Update Go verion for vulnerabilities scan
- Update to Go 1.20.3
- Update Go version and fix gitlabci lint
### Build
- *(deps)* Bump github.com/stretchr/testify from 1.8.0 to 1.8.1
- *(deps)* Bump github.com/sparetimecoders/goamqp from 0.1.1 to 0.1.2
- *(deps)* Bump github.com/sparetimecoders/goamqp from 0.1.2 to 0.1.3
- *(deps)* Bump github.com/stretchr/testify from 1.8.1 to 1.8.2
- *(deps)* Bump github.com/sparetimecoders/goamqp from 0.1.3 to 0.1.4
## [0.1.0] - 2022-07-20
### 🐛 Bug Fixes
- Pipeline
### 💼 Other
### ⚙️ Miscellaneous Tasks
- Add dependabot config
- *(deps)* Bump gitlab.com/sparetimecoders/goamqp from 0.3.1 to 0.3.2
- *(deps)* Bump github.com/stretchr/testify from 1.4.0 to 1.7.0
- Remove dependabot-standalone
- Change to codecov binary instead of bash uploader
- *(deps)* Bump gitlab.com/sparetimecoders/goamqp from 0.3.2 to 0.4.0
- Switch to moved goamqp
### Build
- Add params to codecov
- *(deps)* Bump github.com/stretchr/testify from 1.7.0 to 1.7.1
@@ -122,12 +363,6 @@
- *(deps)* Bump github.com/stretchr/testify from 1.7.4 to 1.7.5
- *(deps)* Bump github.com/stretchr/testify from 1.7.5 to 1.8.0
### ⚙️ Miscellaneous Tasks
- Add dependabot config
- Remove dependabot-standalone
- Change to codecov binary instead of bash uploader
- Switch to moved goamqp
## [0.0.8] - 2021-05-15
### ⚙️ Miscellaneous Tasks
@@ -139,6 +374,7 @@
- Rename master -> main
- Group imports
- Update to latest version of goamqp
## [0.0.7] - 2020-04-12
### 🐛 Bug Fixes
@@ -146,6 +382,7 @@
- Update to Go 1.14 to fix test errors
- Use go mod download
- Sort companies before comparing since map-iteration is not stable
## [0.0.6] - 2020-04-12
### 🐛 Bug Fixes
@@ -156,21 +393,25 @@
- Add tests
- Modify event structure
## [0.0.5] - 2019-12-31
### 🚀 Features
- Add handling of removed privilege
## [0.0.4] - 2019-12-08
### 🚀 Features
- Add name and registration number to event
## [0.0.3] - 2019-11-22
### 🐛 Bug Fixes
- Print unexpected messages
## [0.0.2] - 2019-11-06
### 🚀 Features
@@ -180,3 +421,5 @@
### 🐛 Bug Fixes
- Rename module
<!-- generated by git-cliff -->
+46
View File
@@ -0,0 +1,46 @@
# authz_client
Shared Go library for authorization service client integration.
## Shared Documentation
@../docs/claude/architecture.md
@../docs/claude/go-services.md
@../docs/claude/conventions.md
## Library Information
### Purpose
Provides a client for the authz-service, handling privilege management for users across companies. Used by all microservices that need to check user permissions.
### Usage
```go
import client "git.unbound.se/shiny/authz_client"
// Create handler with options
handler := client.New(client.WithBaseURL("http://authz-service"))
// Check user privileges
privileges := handler.Get(email, companyID)
if privileges.Invoicing {
// User has invoicing privileges
}
```
### Privileges
The `CompanyPrivileges` struct contains permission flags:
- `Admin` - Administrative access
- `Company` - Company management
- `Consumer` - Consumer/customer access
- `Time` - Time tracking
- `Invoicing` - Invoice management
- `Accounting` - Accounting access
- `Supplier` - Supplier management
- `Salary` - Salary/payroll access
### Event Handling
Implements `goamqp` message handlers to receive privilege update events from the authz-service, keeping the local privilege cache up-to-date.
-3
View File
@@ -1,4 +1 @@
# Shiny authz-client
[![Build Status](https://gitlab.com/unboundsoftware/shiny/authz_client/badges/main/pipeline.svg)](https://gitlab.com/unboundsoftware/shiny/authz_client/commits/main)
[![codecov](https://codecov.io/gl/unboundsoftware:shiny/authz_client/branch/main/graph/badge.svg?token=AQS7QVLCEQ)](https://codecov.io/gl/unboundsoftware:shiny/authz_client)
+2 -2
View File
@@ -67,8 +67,8 @@ func (h *PrivilegeHandler) Fetch() error {
return err
}
h.RLock()
defer h.RUnlock()
h.Lock()
defer h.Unlock()
err = json.Unmarshal(buff, &h.privileges)
if err != nil {
return err
+283
View File
@@ -5,6 +5,7 @@ import (
"net/http"
"net/http/httptest"
"sort"
"sync"
"testing"
"github.com/sparetimecoders/goamqp"
@@ -332,3 +333,285 @@ func TestPrivilegeHandler_Fetch_Valid(t *testing.T) {
}
assert.Equal(t, expectedPrivileges, handler.privileges)
}
func TestPrivilegeHandler_Fetch_Concurrent_Fetches(t *testing.T) {
privileges := `
{
"jim@example.org": {
"00010203-0405-4607-8809-0a0b0c0d0e0f": {
"admin": false,
"company": true,
"consumer": false,
"time": true,
"invoicing": true,
"accounting": false,
"supplier": false,
"salary": true
}
}
}`
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
_, _ = w.Write([]byte(privileges))
}))
defer server.Close()
baseURL := server.Listener.Addr().String()
handler := New(WithBaseURL(fmt.Sprintf("http://%s", baseURL)))
// Run multiple Fetch calls concurrently to test thread-safety
var wg sync.WaitGroup
errors := make(chan error, 10)
for i := 0; i < 10; i++ {
wg.Add(1)
go func() {
defer wg.Done()
if err := handler.Fetch(); err != nil {
errors <- err
}
}()
}
wg.Wait()
close(errors)
// Check no errors occurred
for err := range errors {
assert.NoError(t, err)
}
// Verify privileges were set correctly
expectedPrivileges := map[string]map[string]*CompanyPrivileges{
"jim@example.org": {
"00010203-0405-4607-8809-0a0b0c0d0e0f": {
Admin: false,
Company: true,
Consumer: false,
Time: true,
Invoicing: true,
Accounting: false,
Supplier: false,
Salary: true,
},
},
}
assert.Equal(t, expectedPrivileges, handler.privileges)
}
func TestPrivilegeHandler_Concurrent_Fetch_And_Read(t *testing.T) {
privileges := `
{
"jim@example.org": {
"abc-123": {
"admin": true,
"company": true,
"consumer": false,
"time": false,
"invoicing": false,
"accounting": false,
"supplier": false,
"salary": false
}
}
}`
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
_, _ = w.Write([]byte(privileges))
}))
defer server.Close()
baseURL := server.Listener.Addr().String()
handler := New(WithBaseURL(fmt.Sprintf("http://%s", baseURL)))
var wg sync.WaitGroup
errors := make(chan error, 100)
// Start multiple Fetch operations
for i := 0; i < 10; i++ {
wg.Add(1)
go func() {
defer wg.Done()
if err := handler.Fetch(); err != nil {
errors <- err
}
}()
}
// Concurrently read privileges while Fetch is running
for i := 0; i < 50; i++ {
wg.Add(1)
go func() {
defer wg.Done()
_ = handler.CompaniesByUser("jim@example.org", func(privileges CompanyPrivileges) bool {
return privileges.Admin
})
}()
}
// Concurrently check privileges while Fetch is running
for i := 0; i < 50; i++ {
wg.Add(1)
go func() {
defer wg.Done()
_ = handler.IsAllowed("jim@example.org", "abc-123", func(privileges CompanyPrivileges) bool {
return privileges.Admin
})
}()
}
wg.Wait()
close(errors)
// Check no errors occurred
for err := range errors {
assert.NoError(t, err)
}
// Verify privileges are correct after all concurrent operations
companies := handler.CompaniesByUser("jim@example.org", func(privileges CompanyPrivileges) bool {
return privileges.Admin
})
assert.Equal(t, []string{"abc-123"}, companies)
isAllowed := handler.IsAllowed("jim@example.org", "abc-123", func(privileges CompanyPrivileges) bool {
return privileges.Admin && privileges.Company
})
assert.True(t, isAllowed)
}
func TestPrivilegeHandler_Concurrent_Process_And_Read(t *testing.T) {
handler := New(WithBaseURL("base"))
var wg sync.WaitGroup
// Concurrently add privileges via Process
for i := 0; i < 100; i++ {
wg.Add(1)
companyID := fmt.Sprintf("company-%d", i%10)
go func(id string) {
defer wg.Done()
_, _ = handler.Process(&PrivilegeAdded{
Email: "jim@example.org",
CompanyID: id,
Privilege: PrivilegeAdmin,
}, goamqp.Headers{})
}(companyID)
}
// Concurrently read privileges while Process is running
for i := 0; i < 100; i++ {
wg.Add(1)
go func() {
defer wg.Done()
_ = handler.CompaniesByUser("jim@example.org", func(privileges CompanyPrivileges) bool {
return privileges.Admin
})
}()
}
wg.Wait()
// Verify all companies were added
companies := handler.CompaniesByUser("jim@example.org", func(privileges CompanyPrivileges) bool {
return privileges.Admin
})
sort.Strings(companies)
expected := make([]string, 10)
for i := 0; i < 10; i++ {
expected[i] = fmt.Sprintf("company-%d", i)
}
sort.Strings(expected)
assert.Equal(t, expected, companies)
}
func TestPrivilegeHandler_Concurrent_Multiple_Operations(t *testing.T) {
privileges := `
{
"jim@example.org": {
"initial-company": {
"admin": true,
"company": true,
"consumer": false,
"time": false,
"invoicing": false,
"accounting": false,
"supplier": false,
"salary": false
}
}
}`
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
_, _ = w.Write([]byte(privileges))
}))
defer server.Close()
baseURL := server.Listener.Addr().String()
handler := New(WithBaseURL(fmt.Sprintf("http://%s", baseURL)))
var wg sync.WaitGroup
// Fetch
for i := 0; i < 5; i++ {
wg.Add(1)
go func() {
defer wg.Done()
_ = handler.Fetch()
}()
}
// Process PrivilegeAdded
for i := 0; i < 20; i++ {
wg.Add(1)
go func(idx int) {
defer wg.Done()
_, _ = handler.Process(&PrivilegeAdded{
Email: "jane@example.org",
CompanyID: fmt.Sprintf("company-%d", idx%5),
Privilege: PrivilegeCompany,
}, goamqp.Headers{})
}(i)
}
// CompaniesByUser reads
for i := 0; i < 50; i++ {
wg.Add(1)
email := "jim@example.org"
if i%2 == 0 {
email = "jane@example.org"
}
go func(e string) {
defer wg.Done()
_ = handler.CompaniesByUser(e, func(privileges CompanyPrivileges) bool {
return privileges.Admin || privileges.Company
})
}(email)
}
// IsAllowed reads
for i := 0; i < 50; i++ {
wg.Add(1)
go func() {
defer wg.Done()
_ = handler.IsAllowed("jim@example.org", "initial-company", func(privileges CompanyPrivileges) bool {
return privileges.Admin
})
}()
}
wg.Wait()
// Verify final state is consistent
jimCompanies := handler.CompaniesByUser("jim@example.org", func(privileges CompanyPrivileges) bool {
return privileges.Admin
})
assert.Contains(t, jimCompanies, "initial-company")
janeCompanies := handler.CompaniesByUser("jane@example.org", func(privileges CompanyPrivileges) bool {
return privileges.Company
})
sort.Strings(janeCompanies)
expectedJane := []string{"company-0", "company-1", "company-2", "company-3", "company-4"}
assert.Equal(t, expectedJane, janeCompanies)
}
+80
View File
@@ -0,0 +1,80 @@
# git-cliff ~ default configuration file
# https://git-cliff.org/docs/configuration
#
# Lines starting with "#" are comments.
# Configuration options are organized into tables and keys.
# See documentation for more information on available options.
[changelog]
# template for the changelog header
header = """
# Changelog\n
All notable changes to this project will be documented in this file.\n
"""
# template for the changelog body
# https://keats.github.io/tera/docs/#introduction
body = """
{% if version %}\
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
{% else %}\
## [unreleased]
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | striptags | trim | upper_first }}
{% for commit in commits %}
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
{% if commit.breaking %}[**breaking**] {% endif %}\
{{ commit.message | upper_first }}\
{% endfor %}
{% endfor %}\n
"""
# template for the changelog footer
footer = """
<!-- generated by git-cliff -->
"""
# remove the leading and trailing s
trim = true
# postprocessors
postprocessors = [
# { pattern = '<REPO>', replace = "https://github.com/orhun/git-cliff" }, # replace repository URL
]
# render body even when there are no releases to process
# render_always = true
# output file path
# output = "test.md"
[git]
# parse the commits based on https://www.conventionalcommits.org
conventional_commits = true
# filter out the commits that are not conventional
filter_unconventional = true
# process each line of a commit as an individual commit
split_commits = false
# regex for preprocessing the commit messages
commit_preprocessors = [
# Replace issue numbers
#{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))"},
# Check spelling of the commit with https://github.com/crate-ci/typos
# If the spelling is incorrect, it will be automatically fixed.
#{ pattern = '.*', replace_command = 'typos --write-changes -' },
]
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^feat", group = "<!-- 0 -->🚀 Features" },
{ message = "^fix", group = "<!-- 1 -->🐛 Bug Fixes" },
{ message = "^doc", group = "<!-- 3 -->📚 Documentation" },
{ message = "^perf", group = "<!-- 4 -->⚡ Performance" },
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
{ message = "^style", group = "<!-- 5 -->🎨 Styling" },
{ message = "^test", group = "<!-- 6 -->🧪 Testing" },
{ message = "^chore\\(release\\): prepare for", skip = true },
{ message = "^chore|^ci", group = "<!-- 7 -->⚙️ Miscellaneous Tasks" },
{ body = ".*security", group = "<!-- 8 -->🛡️ Security" },
{ message = "^revert", group = "<!-- 9 -->◀️ Revert" },
]
# filter out the commits that are not matched by commit parsers
filter_commits = false
# sort the tags topologically
topo_order = false
# sort the commits inside sections by oldest/newest order
sort_commits = "oldest"
+2 -2
View File
@@ -1,8 +1,8 @@
module gitlab.com/unboundsoftware/shiny/authz_client
module git.unbound.se/shiny/authz_client
go 1.22.12
toolchain go1.25.1
toolchain go1.25.5
require (
github.com/sparetimecoders/goamqp v0.3.3