Skip to content

providers/scim: fix SCIM ID incorrectly used as primary key - #9557

Merged
BeryJu merged 4 commits into
mainfrom
providers/scim/fix-incorrect-pk
May 5, 2024
Merged

BeryJu merged 4 commits into
mainfrom
providers/scim/fix-incorrect-pk

Conversation

@BeryJu

@BeryJu BeryJu commented May 3, 2024 •

Copy link
Copy Markdown
Member

Details

Previously we incorrectly used the SCIM ID given by the external system as a primary key on the SCIMUser and SCIMGroup objects, causing them to be globally unique. This PR fixes that by adding the scim_id column to hold this value, and set the primary key to a UUID


Checklist

  • Local tests pass (ak test authentik/)
  • The code has been formatted (make lint-fix)

If an API change has been made

  • The API schema has been updated (make gen-build)

If changes to the frontend have been made

  • The code has been formatted (make web)

If applicable

  • The documentation has been updated
  • The documentation has been formatted (make website)

@BeryJu
BeryJu requested a review from a team as a code owner May 3, 2024 13:14
@netlify

netlify Bot commented May 3, 2024 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit 1cfd568
🔍 Latest deploy log https://app.netlify.com/sites/authentik-storybook/deploys/6637956d05296d0008076b5b
😎 Deploy Preview https://deploy-preview-9557--authentik-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@netlify

netlify Bot commented May 3, 2024 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit 1cfd568
🔍 Latest deploy log https://app.netlify.com/sites/authentik-docs/deploys/6637956d55f44f00084ea22e
😎 Deploy Preview https://deploy-preview-9557--authentik-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Signed-off-by: Jens Langhammer <[email protected]>
@codecov

codecov Bot commented May 3, 2024 •

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 94.28571% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 92.52%. Comparing base (49cf10e) to head (1cfd568).
Report is 3 commits behind head on main.

Files Patch % Lines
authentik/providers/scim/clients/group.py 83.33% 1 Missing ⚠️
authentik/providers/scim/clients/user.py 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9557      +/-   ##
==========================================
+ Coverage   92.46%   92.52%   +0.06%     
==========================================
  Files         669      669              
  Lines       32751    32873     +122     
==========================================
+ Hits        30282    30415     +133     
+ Misses       2469     2458      -11     
Flag Coverage Δ
e2e 50.57% <20.00%> (-0.06%) ⬇️
integration 25.93% <20.00%> (-0.06%) ⬇️
unit 89.82% <94.28%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions

github-actions Bot commented May 3, 2024 •

Copy link
Copy Markdown
Contributor

authentik PR Installation instructions

Instructions for docker-compose

Add the following block to your .env file:

AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-ghcr.io/goauthentik/dev-server:gh-1cfd56824244d4a4a1f7553d4d0830f57dbbb22f
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s

For arm64, use these values:

AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-ghcr.io/goauthentik/dev-server:gh-1cfd56824244d4a4a1f7553d4d0830f57dbbb22f-arm64
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s

Afterwards, run the upgrade commands from the latest release notes.

Instructions for Kubernetes

Add the following block to your values.yml file:

authentik:
    outposts:
        container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
image:
    repository: ghcr.io/goauthentik/dev-server
    tag: gh-ghcr.io/goauthentik/dev-server:gh-1cfd56824244d4a4a1f7553d4d0830f57dbbb22f

For arm64, use these values:

authentik:
    outposts:
        container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
image:
    repository: ghcr.io/goauthentik/dev-server
    tag: gh-ghcr.io/goauthentik/dev-server:gh-1cfd56824244d4a4a1f7553d4d0830f57dbbb22f-arm64

Afterwards, run the upgrade commands from the latest release notes.

@BeryJu

BeryJu commented May 3, 2024

Copy link
Copy Markdown
Member Author

/cherry-pick version-2024.4

Signed-off-by: Jens Langhammer <[email protected]>

@kensternberg-authentik kensternberg-authentik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks standard. I'm glad to see the unique_together in the metadata, but should SCIM_ID also be "not empty" or adhere to a pattern for validation?

Signed-off-by: Jens Langhammer <[email protected]>
@BeryJu
BeryJu merged commit 3c54e94 into main May 5, 2024
@BeryJu
BeryJu deleted the providers/scim/fix-incorrect-pk branch May 5, 2024 15:32
gcp-cherry-pick-bot Bot pushed a commit that referenced this pull request May 5, 2024
* providers/scim: fix SCIM ID incorrectly used as primary key

Signed-off-by: Jens Langhammer <[email protected]>

* fix unique together

Signed-off-by: Jens Langhammer <[email protected]>

* add test

Signed-off-by: Jens Langhammer <[email protected]>

* add check for empty scim ID

Signed-off-by: Jens Langhammer <[email protected]>

---------

Signed-off-by: Jens Langhammer <[email protected]>
BeryJu added a commit that referenced this pull request May 6, 2024
…ick #9557) (#9579)

providers/scim: fix SCIM ID incorrectly used as primary key (#9557)

* providers/scim: fix SCIM ID incorrectly used as primary key



* fix unique together



* add test



* add check for empty scim ID



---------

Signed-off-by: Jens Langhammer <[email protected]>
Co-authored-by: Jens L <[email protected]>
BeryJu added a commit that referenced this pull request May 6, 2024
Signed-off-by: Jens Langhammer <[email protected]>
BeryJu added a commit that referenced this pull request May 7, 2024
…#9384)

* providers/google: initial account sync to google workspace

Signed-off-by: Jens Langhammer <[email protected]>

* start separating scim sync client

Signed-off-by: Jens Langhammer <[email protected]>

* generalize more...ish

Signed-off-by: Jens Langhammer <[email protected]>

* set dispatch_uid

Signed-off-by: Jens Langhammer <[email protected]>

* start generalizing task

Signed-off-by: Jens Langhammer <[email protected]>

* fully separate tasks

Signed-off-by: Jens Langhammer <[email protected]>

* fix more

Signed-off-by: Jens Langhammer <[email protected]>

* fix signals...?

Signed-off-by: Jens Langhammer <[email protected]>

* start google dedupe

Signed-off-by: Jens Langhammer <[email protected]>

* drawing the rest of the owl

Signed-off-by: Jens Langhammer <[email protected]>

* more

Signed-off-by: Jens Langhammer <[email protected]>

* juse use a whole lot less magic

Signed-off-by: Jens Langhammer <[email protected]>

* member sync, better implement conflict/retry-able exceptions

Signed-off-by: Jens Langhammer <[email protected]>

* max wizards taller

Signed-off-by: Jens Langhammer <[email protected]>

* gen api, basic UI

Signed-off-by: Jens Langhammer <[email protected]>

* fix some bugs

Signed-off-by: Jens Langhammer <[email protected]>

* fix a bunch more bugs

Signed-off-by: Jens Langhammer <[email protected]>

* generalize sync status API

Signed-off-by: Jens Langhammer <[email protected]>

* rework sync chart

Signed-off-by: Jens Langhammer <[email protected]>

* add slugify to evaluator

Signed-off-by: Jens Langhammer <[email protected]>

* add test property mappings

Signed-off-by: Jens Langhammer <[email protected]>

* rename to google workspace

Signed-off-by: Jens Langhammer <[email protected]>

* handle existing objects

Signed-off-by: Jens Langhammer <[email protected]>

* fix credential render

Signed-off-by: Jens Langhammer <[email protected]>

* verify email has correct domain before syncing user

Signed-off-by: Jens Langhammer <[email protected]>

* fix missing docstring

Signed-off-by: Jens Langhammer <[email protected]>

* fix lock not being used

Signed-off-by: Jens Langhammer <[email protected]>

* abstract more common stuff away

Signed-off-by: Jens Langhammer <[email protected]>

* backport time limit fix

#9546
Signed-off-by: Jens Langhammer <[email protected]>

* start discovery

Signed-off-by: Jens Langhammer <[email protected]>

* implement discover for google

Signed-off-by: Jens Langhammer <[email protected]>

* prevent same issue as with #9557

Signed-off-by: Jens Langhammer <[email protected]>

* fix sync status

Signed-off-by: Jens Langhammer <[email protected]>

* make group name unique in API

Signed-off-by: Jens Langhammer <[email protected]>

* fix reference to old wrapper

Signed-off-by: Jens Langhammer <[email protected]>

* start adding tests

man this api client is awful

Signed-off-by: Jens Langhammer <[email protected]>

* add SkipObject

Signed-off-by: Jens Langhammer <[email protected]>

* dont use weak ref

Signed-off-by: Jens Langhammer <[email protected]>

* add group tests

Signed-off-by: Jens Langhammer <[email protected]>

* add user and group delete options

Signed-off-by: Jens Langhammer <[email protected]>

* set user agent

Signed-off-by: Jens Langhammer <[email protected]>

* if the api's testing tools are awful, let's just make our own

Signed-off-by: Jens Langhammer <[email protected]>

* add more tests and already fix some more bugs

Signed-off-by: Jens Langhammer <[email protected]>

* add discover

Signed-off-by: Jens Langhammer <[email protected]>

* add preview banner

Signed-off-by: Jens Langhammer <[email protected]>

* add group import test

Signed-off-by: Jens Langhammer <[email protected]>

* only import users/groups in the correct parent group

Signed-off-by: Jens Langhammer <[email protected]>

* fix conflicting args

Signed-off-by: Jens Langhammer <[email protected]>

* fix missing schedule

Signed-off-by: Jens Langhammer <[email protected]>

* fix web ui

Signed-off-by: Jens Langhammer <[email protected]>

* add default_group_email_domain

Signed-off-by: Jens Langhammer <[email protected]>

---------

Signed-off-by: Jens Langhammer <[email protected]>
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.

2 participants