Skip to content

[9.3] Update SAML logs and request ID retrieval (#249037)#250168

Merged
jeramysoucy merged 2 commits intoelastic:9.3from
jeramysoucy:backport/9.3/pr-249037
Jan 26, 2026
Merged

[9.3] Update SAML logs and request ID retrieval (#249037)#250168
jeramysoucy merged 2 commits intoelastic:9.3from
jeramysoucy:backport/9.3/pr-249037

Conversation

@jeramysoucy
Copy link
Copy Markdown
Contributor

Backport

This will backport the following commits from main to 9.3:

Questions ?

Please refer to the Backport tool documentation

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
@jeramysoucy jeramysoucy added the backport This PR is a backport of another PR label Jan 23, 2026
@jeramysoucy jeramysoucy enabled auto-merge (squash) January 23, 2026 09:35
@jeramysoucy jeramysoucy requested review from a team and azasypkin January 23, 2026 09:36
@jeramysoucy jeramysoucy merged commit d03aa16 into elastic:9.3 Jan 26, 2026
13 checks passed
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/mock-idp-utils 27 29 +2

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
mockIdpPlugin 36.7KB 36.7KB +25.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
mockIdpPlugin 6.7KB 6.7KB +25.0B
Unknown metric groups

API count

id before after diff
@kbn/mock-idp-utils 33 35 +2

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants