Skip to content

fix: race condition when making multiple keycloak API calls#4105

Open
rocketeerbkw wants to merge 1 commit into
mainfrom
fix-keycloak-api-race
Open

fix: race condition when making multiple keycloak API calls#4105
rocketeerbkw wants to merge 1 commit into
mainfrom
fix-keycloak-api-race

Conversation

@rocketeerbkw

Copy link
Copy Markdown
Member

General Checklist

  • Affected Issues have been mentioned in the Closing issues section
  • Documentation has been written/updated
  • PR title is ready for inclusion in changelog

Database Migrations

n/a

Description

A shared keycloak client is used in the Lagoon API. A race condition exists where an API request can fail or return unexpected data if it is done in the middle of another API request getting an access token.

The fix is to use a new/separate keycloak client for access tokens.

The easiest way to reproduce is to run the query described in #3907, but disable the group member cache so it is 100% reproducible:

const members = await models.GroupModel.getGroupMembership(group, false);

Closing issues

closes #3907

@github-actions

Copy link
Copy Markdown

Overview

Image reference testlagoon/api:main lagoon/api:ci-latest
- digest 9b0c85021dd9 bbb2035fd734
- tag main ci-latest
- vulnerabilities critical: 5 high: 80 medium: 67 low: 10 critical: 5 high: 80 medium: 67 low: 10
- platform linux/amd64 linux/amd64
- size 152 MB 183 MB (+31 MB)
- packages 1568 1568
Base Image node:22-alpine
also known as:
22-alpine3.23
22.22-alpine
22.22-alpine3.23
22.22.3-alpine
22.22.3-alpine3.23
jod-alpine
jod-alpine3.23
node:22-alpine
also known as:
22-alpine3.23
22.22-alpine
22.22-alpine3.23
22.22.3-alpine
22.22.3-alpine3.23
jod-alpine
jod-alpine3.23
- vulnerabilities critical: 1 high: 9 medium: 8 low: 2 critical: 1 high: 9 medium: 8 low: 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Querying for group members sometimes fails

2 participants