-
Notifications
You must be signed in to change notification settings - Fork 334
Log SAML IdP changes #4935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log SAML IdP changes #4935
Conversation
b840dbc to
71300fa
Compare
Log all changes to SAML IdPs that are triggered via the IdP REST API in Spar.
I.e. "Wo did it?"
One is enough - The more general one.
Useful to tweak test data.
e78ad62 to
1ba5cbe
Compare
There was a problem hiding this 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 PR adds structured logging for all SAML IdP configuration changes (create, update, delete) made through the Spar REST API. The changes include adding a new helper module for certificate string representation, enhancing existing API functions to accept and log user information, and comprehensive unit tests.
Changes:
- Added logging for IdP create, update, and delete operations with detailed information including team, user, issuer, domain, and certificate details
- Introduced
Data.X509.Extendedmodule withcertToStringfunction to format certificate information for logs - Added
Maybe UserIdparameter to IdP API handlers to capture the user making changes
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| services/spar/src/Spar/API.hs | Added logging calls to idpCreate, idpDelete, and idpUpdate; changed logger type from String to (Msg -> Msg); added helper functions for logging |
| libs/wire-api/src/Wire/API/Routes/Public/Spar.hs | Added ZOptUser parameter to IdP creation routes to capture user information |
| libs/wire-api/src/Wire/API/User/IdentityProvider.hs | Converted IdPMetadataInfo from simple constructor to record with lenses for easier field access |
| libs/extended/src/Data/X509.Extended.hs | New module providing certificate-to-string formatting for logging |
| libs/extended/test/Test/Data/X509/ExtendedSpec.hs | Unit tests for certificate string formatting |
| services/spar/test/Test/Spar/Saml/IdPSpec.hs | Comprehensive unit tests verifying log output for IdP operations |
| services/spar/src/Spar/Sem/SAMLUserStore/Mem.hs | Implemented previously stubbed mock functions for paginated queries |
| services/spar/test/resources/okta-keyinfo-1.xml | Test data file for certificate parsing tests |
| libs/extended/test/data/*.pem | Test certificate files for extended library tests |
| services/spar/spar.cabal, services/spar/default.nix | Added filepath dependency and test module |
| libs/extended/extended.cabal, libs/extended/default.nix | Added dependencies for X509 and cryptography support |
| changelog.d/2-features/log-saml-idp-changes | Changelog entry describing the feature |
Comments suppressed due to low confidence (1)
services/spar/src/Spar/API.hs:870
- Corrected spelling of 'ommitted' to 'omitted'.
-- if this step is ommitted (due to a crash) resending the update request should fix the inconsistent state.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| deriving (Eq, Show, Generic) | ||
|
|
||
| makeLenses ''IdPMetadataInfo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the value of using lenses here? I thought, we planned to migrate away from them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing this out.
Yeah, I was probably under the influence of all the Lenses-code in Spar... 😅 I've removed this makeLenses call now.
c8f3bac to
8e974b0
Compare
Log all changes to SAML IdPs that are triggered via the IdP REST API in Spar.
This was extracted from #4926 to make it easier to digest (i.e. smaller) and to not be blocked on waiting for the email template.
Ticket: https://wearezeta.atlassian.net/browse/WPB-22124
Checklist
changelog.d