mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
feat: add validation for SAML Assertion length in response handling
This commit is contained in:
@@ -81,6 +81,12 @@ export default class SSOUtil {
|
||||
throw new BadRequestException("SAML Assertion not found");
|
||||
}
|
||||
|
||||
if (samlAssertion.length !== 1) {
|
||||
throw new BadRequestException(
|
||||
"Expected exactly one Assertion in SAML Response",
|
||||
);
|
||||
}
|
||||
|
||||
const samlSubject: JSONArray =
|
||||
((samlAssertion[0] as JSONObject)["saml2:Subject"] as JSONArray) ||
|
||||
((samlAssertion[0] as JSONObject)["saml:Subject"] as JSONArray) ||
|
||||
@@ -158,6 +164,10 @@ export default class SSOUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (samlAssertion.length !== 1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const samlAttributeStatement: JSONArray =
|
||||
((samlAssertion[0] as JSONObject)[
|
||||
"saml2:AttributeStatement"
|
||||
@@ -242,6 +252,12 @@ export default class SSOUtil {
|
||||
throw new BadRequestException("SAML Assertion not found");
|
||||
}
|
||||
|
||||
if (samlAssertion.length !== 1) {
|
||||
throw new BadRequestException(
|
||||
"Expected exactly one Assertion in SAML Response",
|
||||
);
|
||||
}
|
||||
|
||||
const samlSubject: JSONArray =
|
||||
((samlAssertion[0] as JSONObject)["saml2:Subject"] as JSONArray) ||
|
||||
((samlAssertion[0] as JSONObject)["saml:Subject"] as JSONArray) ||
|
||||
|
||||
Reference in New Issue
Block a user