[9.3] Update SAML logs and request ID retrieval (#249037)#250168
Merged
jeramysoucy merged 2 commits intoelastic:9.3from Jan 26, 2026
Merged
[9.3] Update SAML logs and request ID retrieval (#249037)#250168jeramysoucy merged 2 commits intoelastic:9.3from
jeramysoucy merged 2 commits intoelastic:9.3from
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
azasypkin
approved these changes
Jan 23, 2026
Contributor
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
Async chunks
Page load bundle
|
jeramysoucy
added a commit
that referenced
this pull request
Apr 9, 2026
# Backport This will backport the following commits from `main` to `9.2`: - [Update SAML logs and request ID retrieval (#249037)](#249037) <!--- Backport version: 11.0.1 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Jeramy Soucy","email":"jeramy.soucy@elastic.co"},"sourceCommit":{"committedDate":"2026-01-22T18:23:53Z","message":"Update SAML logs and request ID retrieval (#249037)\n\nCloses https://github.com/elastic/kibana/issues/246963\n\n## Summary\n\nAdds logging of new \"unsolicited InResponseTo\" error condition returned\nfrom Elasticsearch. This will allow us to identify and filter this\nspecific scenario in serverless logs. Additionally, the request ID is\nnow retrieved directly from the Elasticsearch response metadata rather\nthan parsed from the SAML response.\n\nThis PR also adds parsing of request ID in our mock SAML IDP plugin.\nThis allows us to use the mock IDP for both SP (service provider)\ninitiated and IDP (identity provider) initiated logins.\n\nLastly, this PR moves the `getSAMLRequestId` utility function to the\nmock IDP utils package to remove duplication.\n\n### Testing\n\n#### Mock IDP\n- Start ES & KB locally in serverless mode\n- Navigate to the Kibana URL\n- Verify the redirect to the mock IDP with a SAML request parameter\n(http://localhost:5601/mock_idp/login?SAMLRequest=<encoded_value>)\n- Select a role and click Login\n- Verify logs\n```\n[INFO ][plugins.mockIdpPlugin] Sending SAML response for request ID: ` _SOME_ID`\n[INFO ][plugins.security.authentication] Performing login attempt with \"saml\" provider.\n[INFO ][plugins.security.saml.cloud-saml-kibana] Removing requestId _SAME_ID from the state.\n```\n- Log out\n- Navigate directly to the mock IDP\n(http://localhost:5601/mock_idp/login)\n- Select a role and click Login\n- Verify logs\n```\n[INFO ][plugins.security.authentication] Performing login attempt with \"saml\" provider.\n[INFO ][plugins.security.saml.cloud-saml-kibana] No requestId found in SAML response or state does not contain requestId.\n...\n[INFO ][plugins.security.authentication] Login attempt with \"saml\" provider succeeded (requires redirect: true).\n```\n\n#### Unsolicited InResponseTo\n- Start ES & KB locally in serverless mode\n- Navigate to the Kibana URL\n- Open the browser dev tools and delete the \"sid\" cookie\n- Click Login\n- Verify logs\n```\n[INFO ][plugins.mockIdpPlugin] Sending SAML response for request ID: _SOME_ID\n[INFO ][plugins.security.authentication] Performing login attempt with \"saml\" provider.\n[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: {...}\n[ERROR][plugins.security.authentication] Login attempt with \"saml\" provider cannot be handled.\n```\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"f87355ace3f903f609fd7974e32db2474b795725","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Security","Feature:Security/Authentication","release_note:skip","backport:all-open","v9.3.0","v9.4.0"],"title":"Update SAML logs and request ID retrieval","number":249037,"url":"https://github.com/elastic/kibana/pull/249037","mergeCommit":{"message":"Update SAML logs and request ID retrieval (#249037)\n\nCloses https://github.com/elastic/kibana/issues/246963\n\n## Summary\n\nAdds logging of new \"unsolicited InResponseTo\" error condition returned\nfrom Elasticsearch. This will allow us to identify and filter this\nspecific scenario in serverless logs. Additionally, the request ID is\nnow retrieved directly from the Elasticsearch response metadata rather\nthan parsed from the SAML response.\n\nThis PR also adds parsing of request ID in our mock SAML IDP plugin.\nThis allows us to use the mock IDP for both SP (service provider)\ninitiated and IDP (identity provider) initiated logins.\n\nLastly, this PR moves the `getSAMLRequestId` utility function to the\nmock IDP utils package to remove duplication.\n\n### Testing\n\n#### Mock IDP\n- Start ES & KB locally in serverless mode\n- Navigate to the Kibana URL\n- Verify the redirect to the mock IDP with a SAML request parameter\n(http://localhost:5601/mock_idp/login?SAMLRequest=<encoded_value>)\n- Select a role and click Login\n- Verify logs\n```\n[INFO ][plugins.mockIdpPlugin] Sending SAML response for request ID: ` _SOME_ID`\n[INFO ][plugins.security.authentication] Performing login attempt with \"saml\" provider.\n[INFO ][plugins.security.saml.cloud-saml-kibana] Removing requestId _SAME_ID from the state.\n```\n- Log out\n- Navigate directly to the mock IDP\n(http://localhost:5601/mock_idp/login)\n- Select a role and click Login\n- Verify logs\n```\n[INFO ][plugins.security.authentication] Performing login attempt with \"saml\" provider.\n[INFO ][plugins.security.saml.cloud-saml-kibana] No requestId found in SAML response or state does not contain requestId.\n...\n[INFO ][plugins.security.authentication] Login attempt with \"saml\" provider succeeded (requires redirect: true).\n```\n\n#### Unsolicited InResponseTo\n- Start ES & KB locally in serverless mode\n- Navigate to the Kibana URL\n- Open the browser dev tools and delete the \"sid\" cookie\n- Click Login\n- Verify logs\n```\n[INFO ][plugins.mockIdpPlugin] Sending SAML response for request ID: _SOME_ID\n[INFO ][plugins.security.authentication] Performing login attempt with \"saml\" provider.\n[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: {...}\n[ERROR][plugins.security.authentication] Login attempt with \"saml\" provider cannot be handled.\n```\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"f87355ace3f903f609fd7974e32db2474b795725"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"9.3","label":"v9.3.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/250168","number":250168,"state":"MERGED","mergeCommit":{"sha":"d03aa163b11d4729f20c19dd1bcefc87314ee927","message":"[9.3] Update SAML logs and request ID retrieval (#249037) (#250168)\n\n# Backport\n\nThis will backport the following commits from `main` to `9.3`:\n- [Update SAML logs and request ID retrieval\n(#249037)](https://github.com/elastic/kibana/pull/249037)\n\n\n\n### Questions ?\nPlease refer to the [Backport tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n"}},{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/249037","number":249037,"mergeCommit":{"message":"Update SAML logs and request ID retrieval (#249037)\n\nCloses https://github.com/elastic/kibana/issues/246963\n\n## Summary\n\nAdds logging of new \"unsolicited InResponseTo\" error condition returned\nfrom Elasticsearch. This will allow us to identify and filter this\nspecific scenario in serverless logs. Additionally, the request ID is\nnow retrieved directly from the Elasticsearch response metadata rather\nthan parsed from the SAML response.\n\nThis PR also adds parsing of request ID in our mock SAML IDP plugin.\nThis allows us to use the mock IDP for both SP (service provider)\ninitiated and IDP (identity provider) initiated logins.\n\nLastly, this PR moves the `getSAMLRequestId` utility function to the\nmock IDP utils package to remove duplication.\n\n### Testing\n\n#### Mock IDP\n- Start ES & KB locally in serverless mode\n- Navigate to the Kibana URL\n- Verify the redirect to the mock IDP with a SAML request parameter\n(http://localhost:5601/mock_idp/login?SAMLRequest=<encoded_value>)\n- Select a role and click Login\n- Verify logs\n```\n[INFO ][plugins.mockIdpPlugin] Sending SAML response for request ID: ` _SOME_ID`\n[INFO ][plugins.security.authentication] Performing login attempt with \"saml\" provider.\n[INFO ][plugins.security.saml.cloud-saml-kibana] Removing requestId _SAME_ID from the state.\n```\n- Log out\n- Navigate directly to the mock IDP\n(http://localhost:5601/mock_idp/login)\n- Select a role and click Login\n- Verify logs\n```\n[INFO ][plugins.security.authentication] Performing login attempt with \"saml\" provider.\n[INFO ][plugins.security.saml.cloud-saml-kibana] No requestId found in SAML response or state does not contain requestId.\n...\n[INFO ][plugins.security.authentication] Login attempt with \"saml\" provider succeeded (requires redirect: true).\n```\n\n#### Unsolicited InResponseTo\n- Start ES & KB locally in serverless mode\n- Navigate to the Kibana URL\n- Open the browser dev tools and delete the \"sid\" cookie\n- Click Login\n- Verify logs\n```\n[INFO ][plugins.mockIdpPlugin] Sending SAML response for request ID: _SOME_ID\n[INFO ][plugins.security.authentication] Performing login attempt with \"saml\" provider.\n[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: {...}\n[ERROR][plugins.security.authentication] Login attempt with \"saml\" provider cannot be handled.\n```\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"f87355ace3f903f609fd7974e32db2474b795725"}}]}] BACKPORT--> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
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
mainto9.3:Questions ?
Please refer to the Backport tool documentation