Skip to content

Conversation

@supersven
Copy link
Contributor

@supersven supersven commented Jan 28, 2026

Ticket: https://wearezeta.atlassian.net/browse/WPB-22124

Checklist

  • Add a new entry in an appropriate subdirectory of changelog.d
  • Read and follow the PR guidelines

@supersven supersven force-pushed the sventennie/idp-change-notification-emails branch from 70ab96d to 6fc7af7 Compare January 28, 2026 16:35
@supersven supersven requested a review from Copilot January 28, 2026 17:54
@zebot zebot added the ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist label Jan 28, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request implements IdP change notification emails for team admins and owners when SAML Identity Providers are created, updated, or deleted via the API. The feature is currently only enabled for multi-ingress setups as a safety precaution.

Changes:

  • Added a new SAMLEmailSubsystem subsystem to handle IdP change notifications
  • Implemented email templates in English and German with certificate details
  • Modified IdP CRUD operations in Spar to send notifications when multi-ingress is configured
  • Refactored template loading code from Brig to wire-subsystems for better reusability
  • Added comprehensive test coverage for the email notification functionality

Reviewed changes

Copilot reviewed 64 out of 64 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
libs/wire-subsystems/src/Wire/SAMLEmailSubsystem.hs New subsystem effect for SAML email notifications
libs/wire-subsystems/src/Wire/SAMLEmailSubsystem/Interpreter.hs Implementation that sends emails to team admins/owners with certificate changes
libs/wire-subsystems/src/Wire/EmailSubsystem.hs Added SendSAMLIdPChanged effect and IdPDetails data type
libs/wire-subsystems/src/Wire/EmailSubsystem/Interpreter.hs Email rendering logic for IdP change notifications
services/spar/src/Spar/API.hs Modified idpCreate, idpDelete, idpUpdate to send notifications
libs/wire-subsystems/test/unit/Wire/SAMLEmailSubsystem/InterpreterSpec.hs Comprehensive tests for email notifications with multiple locales
services/spar/test/Test/Spar/Saml/IdPSpec.hs Tests verifying notification sending behavior
libs/wire-subsystems/templates//team/email/ Email templates for IdP configuration changes
libs/wire-subsystems/src/Wire/EmailSubsystem/Template.hs Moved template loading utilities from Brig for reusability
libs/wire-api/src/Wire/API/Routes/Internal/Brig.hs Added IdpChangedNotification type and SAMLIdPAPI endpoint
libs/saml2-web-sso/src/SAML2/WebSSO/* Added schema instances for SAML types (Issuer, IdPMetadata, IdPId, IdPConfig)
libs/extended/src/Data/X509/Extended.hs Enhanced to provide structured certificate descriptions
changelog.d/2-features/send-email-on-idp-change Documented the new feature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

SetStatus _userId _status -> undefined
GetDefaultUserLocale -> undefined
CheckAdminGetTeamId _userId -> undefined
SendSAMLIdPChangedEmail notif -> modify (notif :)
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

The notifications list is accumulated in reverse order (using notif : at line 557 prepends to the list). This means when multiple operations occur (like create followed by delete), the notifications will be in reverse chronological order. The test at line 448 expects [IdPDeleted ..., IdPCreated ...], which confirms this behavior. However, this might be counterintuitive since the natural expectation would be chronological order (oldest first). Consider either reversing the list before returning it, or documenting this behavior clearly.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Copilot AI commented Jan 28, 2026

@supersven I've opened a new pull request, #4989, to work on those changes. Once the pull request is ready, I'll request review from you.

@supersven supersven force-pushed the sventennie/idp-change-notification-emails branch from 9b0666b to f47d6bc Compare January 28, 2026 18:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 65 out of 65 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +64 to +66
IdPCreated nofifUid _idp -> nofifUid
IdPDeleted nofifUid _idp -> Just nofifUid
IdPUpdated nofifUid _old _new -> Just nofifUid
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

Typo in variable name: "nofifUid" should be "notifUid" (missing 't')

Suggested change
IdPCreated nofifUid _idp -> nofifUid
IdPDeleted nofifUid _idp -> Just nofifUid
IdPUpdated nofifUid _old _new -> Just nofifUid
IdPCreated notifUid _idp -> notifUid
IdPDeleted notifUid _idp -> Just notifUid
IdPUpdated notifUid _old _new -> Just notifUid

Copilot uses AI. Check for mistakes.
Comment on lines +64 to +66
IdPCreated nofifUid _idp -> nofifUid
IdPDeleted nofifUid _idp -> Just nofifUid
IdPUpdated nofifUid _old _new -> Just nofifUid
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

Typo in variable name: "nofifUid" should be "notifUid" (missing 't')

Suggested change
IdPCreated nofifUid _idp -> nofifUid
IdPDeleted nofifUid _idp -> Just nofifUid
IdPUpdated nofifUid _old _new -> Just nofifUid
IdPCreated notifUid _idp -> notifUid
IdPDeleted notifUid _idp -> Just notifUid
IdPUpdated notifUid _old _new -> Just notifUid

Copilot uses AI. Check for mistakes.
Comment on lines +64 to +66
IdPCreated nofifUid _idp -> nofifUid
IdPDeleted nofifUid _idp -> Just nofifUid
IdPUpdated nofifUid _old _new -> Just nofifUid
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

Typo in variable name: "nofifUid" should be "notifUid" (missing 't')

Suggested change
IdPCreated nofifUid _idp -> nofifUid
IdPDeleted nofifUid _idp -> Just nofifUid
IdPUpdated nofifUid _old _new -> Just nofifUid
IdPCreated notifUid _idp -> notifUid
IdPDeleted notifUid _idp -> Just notifUid
IdPUpdated notifUid _old _new -> Just notifUid

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants