[8.19] Update SAML logs and request ID retrieval (#249037)#262023
Open
jeramysoucy wants to merge 7 commits intoelastic:8.19from
Open
[8.19] Update SAML logs and request ID retrieval (#249037)#262023jeramysoucy wants to merge 7 commits intoelastic:8.19from
jeramysoucy wants to merge 7 commits intoelastic:8.19from
Conversation
Closes elastic#246963 ## Summary Adds logging of new "unsolicited InResponseTo" error condition returned from Elasticsearch. This will allow us to identify and filter this specific scenario in serverless logs. Additionally, the request ID is now retrieved directly from the Elasticsearch response metadata rather than parsed from the SAML response. This PR also adds parsing of request ID in our mock SAML IDP plugin. This allows us to use the mock IDP for both SP (service provider) initiated and IDP (identity provider) initiated logins. Lastly, this PR moves the `getSAMLRequestId` utility function to the mock IDP utils package to remove duplication. ### Testing #### Mock IDP - Start ES & KB locally in serverless mode - Navigate to the Kibana URL - Verify the redirect to the mock IDP with a SAML request parameter (http://localhost:5601/mock_idp/login?SAMLRequest=<encoded_value>) - Select a role and click Login - Verify logs ``` [INFO ][plugins.mockIdpPlugin] Sending SAML response for request ID: ` _SOME_ID` [INFO ][plugins.security.authentication] Performing login attempt with "saml" provider. [INFO ][plugins.security.saml.cloud-saml-kibana] Removing requestId _SAME_ID from the state. ``` - Log out - Navigate directly to the mock IDP (http://localhost:5601/mock_idp/login) - Select a role and click Login - Verify logs ``` [INFO ][plugins.security.authentication] Performing login attempt with "saml" provider. [INFO ][plugins.security.saml.cloud-saml-kibana] No requestId found in SAML response or state does not contain requestId. ... [INFO ][plugins.security.authentication] Login attempt with "saml" provider succeeded (requires redirect: true). ``` #### Unsolicited InResponseTo - Start ES & KB locally in serverless mode - Navigate to the Kibana URL - Open the browser dev tools and delete the "sid" cookie - Click Login - Verify logs ``` [INFO ][plugins.mockIdpPlugin] Sending SAML response for request ID: _SOME_ID [INFO ][plugins.security.authentication] Performing login attempt with "saml" provider. [ERROR][plugins.security.saml.cloud-saml-kibana] Failed to log in with SAML response, SP-initiated, unsolicited InResponseTo: _SAME_ID, no state - possible delayed login, current requestIds: , error: {...} [ERROR][plugins.security.authentication] Login attempt with "saml" provider cannot be handled. ``` --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit f87355a) # Conflicts: # packages/kbn-mock-idp-plugin/server/plugin.ts # src/platform/packages/private/kbn-mock-idp-utils/src/index.ts # src/platform/packages/private/kbn-mock-idp-utils/src/utils.test.ts # src/platform/packages/private/kbn-mock-idp-utils/src/utils.ts # x-pack/platform/plugins/shared/security/server/authentication/providers/saml.test.ts
Contributor
💔 Build Failed
Failed CI StepsMetrics [docs]Async chunks
Page load bundle
History
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport
This will backport the following commits from
mainto8.19:Questions ?
Please refer to the Backport tool documentation