Skip to content

fix(scim): make group member add idempotent + build PR images#4

Merged
mxhash merged 3 commits into
mainfrom
fix/scim-group-idempotent-add
May 19, 2026
Merged

fix(scim): make group member add idempotent + build PR images#4
mxhash merged 3 commits into
mainfrom
fix/scim-group-idempotent-add

Conversation

@mxhash
Copy link
Copy Markdown
Member

@mxhash mxhash commented May 19, 2026

Summary

  • Fixes the SCIM 409 that aborted Authentik's outgoing sync when a group PATCH add members operation re-listed an already-present user. The user_groups insert now uses ON CONFLICT (user_id, group_id) DO NOTHING and dedupes its input, so re-adding existing members is a true no-op.
  • Adds a pull_request trigger to the image workflow. PRs get pushed to GHCR as ghcr.io/netways/struudel:pr-<number>, while latest stays restricted to the default branch — lets you pull and validate this PR's container on the staging host before merge.

Test plan

  • CI workflow runs on this PR and pushes ghcr.io/netways/struudel:pr-<this-pr-number>
  • On the server: docker compose pull with image swapped to the pr-* tag, then docker compose up -d app worker
  • Trigger an Authentik SCIM sync and confirm no user_groups_pkey IntegrityError and no SCIM 409 on PATCH /scim/v2/Groups/*
  • Confirm latest tag in GHCR is unchanged (still points at the last main build)

mxhash added 3 commits May 19, 2026 11:21
Authentik's outgoing SCIM sync occasionally PATCHes a group with an
`add members` operation listing a user that is already a member,
triggering a `user_groups_pkey` IntegrityError that bubbled up as a
SCIM 409 and aborted the whole sync. Switch the membership insert to
`ON CONFLICT (user_id, group_id) DO NOTHING` and dedupe the input set
so re-adding existing members is a no-op.
Adds a `pull_request` trigger that pushes the resulting image to GHCR
tagged `pr-<number>`, while `latest` stays restricted to the default
branch. Lets reviewers pull and validate a PR's container before merge.
Authentik's outgoing SCIM PATCHes a group's members with
`{op:"remove", path:"members", value:[{value:"<id>"}, ...]}` rather
than the RFC 7644 filter syntax `members[value eq "<id>"]`, which we
rejected with 400. Accept the value-list form too, and treat a remove
on `members` with no value as "clear all members". Also log the
request body on any SCIM 400 so future parser gaps are diagnosable
from the app log.
@mxhash mxhash merged commit fbcbe02 into main May 19, 2026
1 check passed
@mxhash mxhash deleted the fix/scim-group-idempotent-add branch May 19, 2026 09:34
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.

1 participant