Skip to content

Fix dry-run panic when syncing new users to existing groups - #313

Open
tbobm wants to merge 2 commits into
awslabs:masterfrom
tbobm:fix/dry-run-virtual-uuids
Open

Fix dry-run panic when syncing new users to existing groups#313
tbobm wants to merge 2 commits into
awslabs:masterfrom
tbobm:fix/dry-run-virtual-uuids

Conversation

@tbobm

@tbobm tbobm commented May 19, 2026

Copy link
Copy Markdown

Hi ! Thanks for this great project:)

I faced issues already reported while using dry run mode and wanted to experiment with a solution, let me know if this could work for you.

When DRY_RUN=true and a Google user does not yet exist in AWS Identity Store, SyncGroupsUsers crashes with:

ValidationException: Value '' at 'memberId.userId' failed to satisfy constraint: Member must satisfy regular expression pattern: ...

Two root causes in the dry-run shims:

  1. dryClient.CreateUser skips the real SCIM call, so the returned user always had an empty ID.
  2. DryIdentityStore.IsMemberInGroups was a straight pass-through to AWS, which then received the empty userId and rejected it.

Both changes are scoped to the dry-run shims, no production code paths are touched.

  • internal/aws/virtual_id.go (new): generates deterministic UUIDv5 IDs with a deadbeef00- prefix that satisfies the AWS regex and is detectable without shared state between the two shims.
  • internal/aws/client_dry.go: CreateUser and UpdateUser now populate u.ID with a virtual ID.
  • internal/aws/identitystore_dry.go: IsMemberInGroups, GetGroupMembershipId, and ListGroupMemberships short-circuit when any input ID is virtual, returning a safe synthetic response instead of forwarding to AWS.

tbobm added 2 commits May 13, 2026 16:08
)

Root cause: dryClient.CreateUser skips the real SCIM call, so the
returned user always had an empty ID. DryIdentityStore.IsMemberInGroups
was a straight pass-through to AWS, which rejected the empty userId
with a ValidationException.

Two changes, both scoped to the dry-run shims:
- Add virtual_id.go: deterministic UUIDv5 IDs with a deadbeef00- prefix
  that satisfies the AWS regex and is detectable without shared state.
  dryClient.CreateUser/UpdateUser now populate u.ID with these IDs.
- Short-circuit IsMemberInGroups, GetGroupMembershipId, and
  ListGroupMemberships in DryIdentityStore when any input ID is virtual,
  returning a safe synthetic response instead of calling AWS.
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.

Dryrun mode fails, to 'create' the user based on group membership.

1 participant