Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: duplicate configapi scopes in cn update #2851

Closed
moabu opened this issue Nov 3, 2022 · 5 comments
Closed

fix: duplicate configapi scopes in cn update #2851

moabu opened this issue Nov 3, 2022 · 5 comments
Assignees
Labels
kind-bug Issue or PR is a bug in existing functionality
Milestone

Comments

@moabu
Copy link
Member

moabu commented Nov 3, 2022

Describe the bug
Upon upgrading jans cn setup from 1.0.2 to the latest currently 1.0.4_dev multiple duplicate scopes are created.

config-api replicas: 1

persistence and config jobs were ran on upgrade

Config API scope https://jans.io/oauth/config/jwks.delete
Config API scope https://jans.io/oauth/config/agama.delete
Config API scope https://jans.io/oauth/config/agama.readonly
Config API scope https://jans.io/oauth/config/agama.write
Config API scope https://jans.io/oauth/jans-auth-server/session.delete
Config API scope https://jans.io/oauth/jans-auth-server/session.readonly

Expected behavior
Existing scopes should be skipped

@moabu moabu assigned moabu and iromli Nov 3, 2022
@mo-auto mo-auto added the kind-bug Issue or PR is a bug in existing functionality label Nov 3, 2022
@moabu moabu added this to the 1.0.4 milestone Nov 3, 2022
@iromli
Copy link
Contributor

iromli commented Nov 4, 2022

I was unable to replicate the issue when using 1 replica, but it does occurs when using 2 replicas.

There was race condition when multiple replicas trying to create new scopes.

Each of them assume there are missing scopes in persistence hence each of config-api creates new scopes which eventually are persisted into persistence.

@iromli
Copy link
Contributor

iromli commented Nov 4, 2022

I tested by reverting back scopes creation to old scopes.ldif template (created statically before running config-api), but after that multiple jans-config-api replicas are creating missing scopes at the same time.

Eventually, multiple scopes with same jansId are created (checked by querying persistence and found entries with same jansId -- DN is prefixed with UUID4 format).

@iromli
Copy link
Contributor

iromli commented Nov 4, 2022

to summarize the multiple scopes issue:

  1. multiple scopes creation (where DN prefix is 1800.mmmmmm-nnnnnn) can be avoided if we revert back to static scopes.ldif (v1.0.2 and lower)
  2. multiple scopes creation (where DN prefix is UUID4 format) need to be investigated in jans-upstream jans-config-api

@iromli
Copy link
Contributor

iromli commented Nov 6, 2022

Point no. 1 is tracked in #2869

@moabu moabu modified the milestones: 1.0.4, 1.0.5 Nov 14, 2022
@moabu moabu modified the milestones: 1.0.5, 1.0.6 Dec 1, 2022
@moabu moabu modified the milestones: 1.0.6, 1.0.7 Jan 9, 2023
@iromli
Copy link
Contributor

iromli commented Jan 13, 2023

The scope insertion is now based on static inum instead of jansId hence duplicate inum will be rejected.

@iromli iromli closed this as completed Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind-bug Issue or PR is a bug in existing functionality
Projects
None yet
Development

No branches or pull requests

3 participants