Skip to content

Fix SCIM bridge PUT loop and excluded user names overwrite#1080

Merged
SachaProbo merged 1 commit intomainfrom
SachaProbo/fix-scim-exclude-loop
Apr 21, 2026
Merged

Fix SCIM bridge PUT loop and excluded user names overwrite#1080
SachaProbo merged 1 commit intomainfrom
SachaProbo/fix-scim-exclude-loop

Conversation

@SachaProbo
Copy link
Copy Markdown
Contributor

@SachaProbo SachaProbo commented Apr 21, 2026

Two issues:

  1. buildUserPayload conditionally omitted fields when empty (externalId, userType, preferredLanguage, all enterprise fields). When a field was cleared in Google, the PUT payload didn't include it, so the SCIM handler never cleared the stored value. The comparison kept detecting a mismatch, causing a PUT on every sync cycle. Always include all fields so cleared values propagate correctly.

  2. The bridge runner wrote all columns (including excluded_user_names) back on sync completion, overwriting changes made via the UI during the sync window. Add UpdateSyncState that only writes sync-related columns.


Summary by cubic

Fixes the SCIM bridge PUT loop on cleared fields, prevents excluded_user_names overwrites during sync, and makes SCIM pagination honor startIndex. Cleared values now persist, UI changes stick, and user listings page correctly.

  • Bug Fixes
    • In pkg/iam/scim/bridge/client, buildUserPayload now unconditionally sets core and enterprise fields (including empty) so cleared values propagate and stop repeated PUTs.
    • Added UpdateSyncState in pkg/coredata/scim_bridge and updated pkg/iam/scim/bridge_runner_state to write only sync-related columns, preventing excluded_user_names overwrites.
    • In pkg/iam/scim/service, ListUsers replaces cursor paging with SCIM startIndex/count and uses pkg/coredata/membership_profile.LoadAllByOrganizationID to build pages, fixing repeated first pages and missing users.

Written for commit a622c61. Summary will update on new commits.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 3 files

@SachaProbo SachaProbo force-pushed the SachaProbo/fix-scim-exclude-loop branch 3 times, most recently from a0af967 to 87029b1 Compare April 21, 2026 14:02
Two bugs caused SCIM sync failures:

1. buildUserPayload conditionally omitted empty fields. When a field was
   cleared in the identity provider, the PUT payload didn't include it,
   so the SCIM handler never cleared the stored value. The bridge kept
   detecting a mismatch every sync cycle, causing a perpetual PUT loop.
   Fix: always include all fields unconditionally.

2. ListUsers ignored the startIndex parameter — the cursor always started
   from nil, so every page returned the same first N users. Organizations
   with more than 100 SCIM-managed users never got a full listing; users
   beyond the first page appeared missing, causing CreateUser calls that
   failed with 409 (uniqueness conflict) and eventually disabled the
   bridge. Fix: replace cursor-based pagination with OFFSET/LIMIT to
   honor SCIM's 1-based startIndex.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
@SachaProbo SachaProbo force-pushed the SachaProbo/fix-scim-exclude-loop branch from 87029b1 to a622c61 Compare April 21, 2026 14:54
@SachaProbo SachaProbo merged commit a622c61 into main Apr 21, 2026
17 checks passed
@SachaProbo SachaProbo deleted the SachaProbo/fix-scim-exclude-loop branch April 21, 2026 15:07
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