From d8521ddcbadb1277a64cd9578339f2590ca5e247 Mon Sep 17 00:00:00 2001 From: Jonathan Hooper Date: Thu, 23 May 2024 10:35:36 -0400 Subject: [PATCH 1/2] Remove `#is_a?` call from VTR in SAML request validator When I was working on the code to parse a VTR in the SAML request validator I copied the code from the OIDC form object. This included a check that the `vtr` is an array. In OIDC that is necessarily because we are directly parsing the result of calling `JSON.parse` on the param. In SAML that is not the case; the vtr is parsed out of the authn request and will be an array or nil. For this reason we can use `#blank?` in the SAML implementation. [skip changelog] --- app/services/saml_request_validator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/saml_request_validator.rb b/app/services/saml_request_validator.rb index 2b21aadc0bc..09bf01a90cd 100644 --- a/app/services/saml_request_validator.rb +++ b/app/services/saml_request_validator.rb @@ -43,7 +43,7 @@ def parsed_vectors_of_trust return @parsed_vectors_of_trust if defined?(@parsed_vectors_of_trust) @parsed_vectors_of_trust = begin - if vtr.is_a?(Array) && !vtr.empty? + if vtr.blank? vtr.map { |vot| Vot::Parser.new(vector_of_trust: vot).parse } end rescue Vot::Parser::ParseException From 45f06fd7c60c090d9f77262d739db4674840c40f Mon Sep 17 00:00:00 2001 From: Jonathan Hooper Date: Thu, 23 May 2024 12:22:40 -0400 Subject: [PATCH 2/2] whoops --- app/services/saml_request_validator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/saml_request_validator.rb b/app/services/saml_request_validator.rb index 09bf01a90cd..4eee8790492 100644 --- a/app/services/saml_request_validator.rb +++ b/app/services/saml_request_validator.rb @@ -43,7 +43,7 @@ def parsed_vectors_of_trust return @parsed_vectors_of_trust if defined?(@parsed_vectors_of_trust) @parsed_vectors_of_trust = begin - if vtr.blank? + if vtr.present? vtr.map { |vot| Vot::Parser.new(vector_of_trust: vot).parse } end rescue Vot::Parser::ParseException