Skip to content

SAML Group Sync remove old memberships

Drew Blessing requested to merge dblessing_saml_group_sync_remove into master

What does this MR do?

Part of #267020 (closed)

Builds on the existing GroupSamlGroupSyncWorker and associated Groups::SyncService to not only add members to groups, but to remove old membership if the user should no longer be a member. This part was a little more complex because there are many things to consider whether we should remove a member.

There is no Changelog since this feature is behind a default disabled feature flag. Changelog and docs will be in !46700 (merged)

Logging/Stats

  1. When debug logging is enabled, an entry will be logged to application.log each time the membership is added, updated or removed.
  2. When sync is complete, a payload with the number of added, updated and removed entries is returned to the worker. The worker logs this as extra metadata to sidekiq.log.

Sidekiq extra metadata logging

{"severity":"INFO","time":"2020-11-10T15:55:57.557Z","class":"GroupSamlGroupSyncWorker","args":["1","52","[FILTERED]"],...,"extra.group_saml_group_sync_worker.stats":{"added":1,"updated":0,"removed":0}}

Application.log debug logging

{:message=>"Groups::SyncService User: jane (25), Action: added, Group: 2, Prior Access: , New Access: 30"}
{:message=>"Groups::SyncService User: jane (25), Action: updated, Group: 2, Prior Access: 20, New Access: 30"}
{:message=>"Groups::SyncService User: jane (25), Action: removed, Group: 2, Prior Access: 20, New Access: "}

Screenshots (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team
Edited by Drew Blessing

Merge request reports

Loading