udap_security_test_kit 0.11.5 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/lib/udap_security_test_kit/authorization_code_received_test.rb +8 -0
  3. data/lib/udap_security_test_kit/authorization_code_redirect_test.rb +3 -0
  4. data/lib/udap_security_test_kit/authorization_code_token_exchange_test.rb +2 -0
  5. data/lib/udap_security_test_kit/authorization_endpoint_field_test.rb +5 -1
  6. data/lib/udap_security_test_kit/client_suite/access_ac_group.rb +2 -0
  7. data/lib/udap_security_test_kit/client_suite/authorization_request_verification_test.rb +5 -0
  8. data/lib/udap_security_test_kit/client_suite/registration_ac_verification_test.rb +34 -0
  9. data/lib/udap_security_test_kit/client_suite/registration_cc_verification_test.rb +30 -0
  10. data/lib/udap_security_test_kit/client_suite/token_request_ac_verification_test.rb +47 -0
  11. data/lib/udap_security_test_kit/client_suite/token_request_cc_verification_test.rb +25 -0
  12. data/lib/udap_security_test_kit/client_suite.rb +11 -0
  13. data/lib/udap_security_test_kit/discovery_group.rb +2 -0
  14. data/lib/udap_security_test_kit/dynamic_client_registration_group.rb +3 -0
  15. data/lib/udap_security_test_kit/endpoints/mock_udap_server.rb +2 -2
  16. data/lib/udap_security_test_kit/grant_types_supported_field_test.rb +3 -0
  17. data/lib/udap_security_test_kit/reg_endpoint_jwt_signing_alg_values_supported_field_test.rb +6 -0
  18. data/lib/udap_security_test_kit/registration_endpoint_field_test.rb +3 -0
  19. data/lib/udap_security_test_kit/registration_failure_invalid_contents_test.rb +4 -1
  20. data/lib/udap_security_test_kit/registration_failure_invalid_jwt_signature_test.rb +2 -0
  21. data/lib/udap_security_test_kit/registration_success_contents_test.rb +3 -0
  22. data/lib/udap_security_test_kit/registration_success_test.rb +3 -0
  23. data/lib/udap_security_test_kit/requirements/generated/udap-security-test-kit_requirements_coverage.csv +317 -0
  24. data/lib/udap_security_test_kit/requirements/generated/udap_security_client_requirements_coverage.csv +146 -0
  25. data/lib/udap_security_test_kit/requirements/generated/udap_security_requirements_coverage.csv +164 -0
  26. data/lib/udap_security_test_kit/requirements/hl7.fhir.us.udap-security_1.0.0_reqs.xlsx +0 -0
  27. data/lib/udap_security_test_kit/requirements/udap_security_test_kit_requirements.csv +308 -0
  28. data/lib/udap_security_test_kit/signed_metadata_contents_test.rb +17 -0
  29. data/lib/udap_security_test_kit/signed_metadata_field_test.rb +4 -1
  30. data/lib/udap_security_test_kit/token_endpoint_auth_methods_supported_field_test.rb +2 -0
  31. data/lib/udap_security_test_kit/token_endpoint_auth_signing_alg_values_supported_field_test.rb +5 -0
  32. data/lib/udap_security_test_kit/token_endpoint_field_test.rb +3 -0
  33. data/lib/udap_security_test_kit/udap_auth_extensions_required_field_test.rb +3 -0
  34. data/lib/udap_security_test_kit/udap_auth_extensions_supported_field_test.rb +3 -0
  35. data/lib/udap_security_test_kit/udap_certifications_required_field_test.rb +3 -0
  36. data/lib/udap_security_test_kit/udap_certifications_supported_field_test.rb +2 -0
  37. data/lib/udap_security_test_kit/udap_profiles_supported_field_test.rb +5 -0
  38. data/lib/udap_security_test_kit/udap_versions_supported_field_test.rb +2 -0
  39. data/lib/udap_security_test_kit/version.rb +2 -2
  40. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/b2b_authorization_extension_object_test.rb +77 -0
  41. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/client_authorization_code_usage_test.rb +47 -0
  42. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/client_security_csrf_protection_test.rb +50 -0
  43. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/cryptographic_algorithms_test.rb +44 -0
  44. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/data_holder_auth_request_scope_test.rb +42 -0
  45. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/idp_authentication_compliance_test.rb +44 -0
  46. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/idp_supports_required_scopes_test.rb +42 -0
  47. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/jti_reuse_prevention_test.rb +44 -0
  48. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/metadata_interpretation_test.rb +47 -0
  49. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/oauth2_protocol_compliance_test.rb +50 -0
  50. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/preferred_identity_provider_test.rb +45 -0
  51. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/private_key_authentication_test.rb +47 -0
  52. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/resource_holder_authentication_test.rb +45 -0
  53. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/software_statement_registration_test.rb +49 -0
  54. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/token_request_authentication_test.rb +51 -0
  55. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/trust_community_query_parameters_test.rb +43 -0
  56. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/validation_confidentiality_test.rb +49 -0
  57. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client_attestation_group.rb +48 -0
  58. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/authentication_requests_group/authentication_request_construction_test.rb +56 -0
  59. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/authentication_requests_group/authentication_request_validation_test.rb +60 -0
  60. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/authentication_requests_group.rb +13 -0
  61. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/authorization_code_token_requests_group/access_token_lifetime_test.rb +42 -0
  62. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/authorization_code_token_requests_group/access_token_request_validation_test.rb +51 -0
  63. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/authorization_code_token_requests_group/authorization_code_usage_test.rb +45 -0
  64. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/authorization_code_token_requests_group/resource_holder_authorization_flow_test.rb +37 -0
  65. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/authorization_code_token_requests_group.rb +17 -0
  66. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/client_authentication_group/client_certificate_storage_test.rb +36 -0
  67. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/client_authentication_group/no_client_credentials_native_apps_test.rb +38 -0
  68. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/client_authentication_group.rb +13 -0
  69. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/dynamic_client_registration_group/certification_handling_test.rb +45 -0
  70. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/dynamic_client_registration_group/client_id_modification_test.rb +42 -0
  71. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/dynamic_client_registration_group/dynamic_client_registration_validation_test.rb +48 -0
  72. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/dynamic_client_registration_group.rb +15 -0
  73. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/error_handling_group/deny_token_request_test.rb +42 -0
  74. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/error_handling_group/general_error_response_test.rb +39 -0
  75. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/error_handling_group/invalid_id_token_test.rb +43 -0
  76. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/error_handling_group/invalid_idp_test.rb +39 -0
  77. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/error_handling_group/invalid_redirection_uri_test.rb +43 -0
  78. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/error_handling_group/prompt_none_test.rb +39 -0
  79. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/error_handling_group/state_mismatch_test.rb +43 -0
  80. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/error_handling_group/unauthenticated_user_test.rb +42 -0
  81. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/error_handling_group/valid_state_error_response_test.rb +43 -0
  82. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/error_handling_group.rb +27 -0
  83. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/id_token_access_token_validation_group/access_token_validation_test.rb +47 -0
  84. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/id_token_access_token_validation_group/id_token_validation_test.rb +45 -0
  85. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/id_token_access_token_validation_group/token_response_validation_test.rb +47 -0
  86. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/id_token_access_token_validation_group.rb +15 -0
  87. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/identity_provider_interaction_group/idp_authentication_request_test.rb +45 -0
  88. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/identity_provider_interaction_group/idp_dynamic_registration_test.rb +45 -0
  89. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/identity_provider_interaction_group/idp_metadata_validation_test.rb +44 -0
  90. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/identity_provider_interaction_group/idp_token_exchange_test.rb +46 -0
  91. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/identity_provider_interaction_group.rb +17 -0
  92. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/jwt_security_group/jwt_certificate_chain_validation_test.rb +36 -0
  93. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/jwt_security_group/jwt_grant_parameter_validation_test.rb +36 -0
  94. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/jwt_security_group/jwt_jti_reuse_test.rb +35 -0
  95. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/jwt_security_group/jwt_signature_validation_test.rb +36 -0
  96. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/jwt_security_group/jwt_token_request_validation_test.rb +43 -0
  97. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/jwt_security_group.rb +19 -0
  98. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/metadata_server_capabilities_group/udap_authorization_extensions_required_test.rb +43 -0
  99. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/metadata_server_capabilities_group/udap_community_parameter_support_test.rb +44 -0
  100. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/metadata_server_capabilities_group/udap_metadata_endpoint_error_handling_test.rb +43 -0
  101. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/metadata_server_capabilities_group/udap_metadata_representation_test.rb +42 -0
  102. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/metadata_server_capabilities_group/udap_profiles_supported_test.rb +43 -0
  103. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/metadata_server_capabilities_group.rb +19 -0
  104. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/security_measures_group/csrf_protection_test.rb +49 -0
  105. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/security_measures_group/obtain_authorization_scopes_test.rb +44 -0
  106. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/security_measures_group/state_parameter_test.rb +48 -0
  107. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/security_measures_group/unauthenticated_client_security_test.rb +47 -0
  108. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/security_measures_group.rb +17 -0
  109. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server_attestation_group.rb +33 -0
  110. data/lib/udap_security_test_kit/well_known_endpoint_test.rb +4 -0
  111. data/lib/udap_security_test_kit.rb +10 -0
  112. metadata +85 -4
@@ -0,0 +1,45 @@
1
+ module UDAPSecurityTestKit
2
+ class IDTokenValidationAttestationTest < Inferno::Test
3
+ title 'Validates ID Token correctly'
4
+ id :udap_security_id_token_validation
5
+ description %(
6
+ Data Holder validates the ID Token as per OIDC Core specifications, including:
7
+ - Verifying the token's signature.
8
+ - Checking claims such as `iss`, `aud`, and `exp`.
9
+ )
10
+ verifies_requirements 'hl7.fhir.us.udap-security_1.0.0@282',
11
+ 'hl7.fhir.us.udap-security_1.0.0@289'
12
+
13
+ input :id_token_validation_correct,
14
+ title: 'ID Token and Access Token Validation: ID Token is validated correctly',
15
+ description: %(
16
+ I attest that the Data Holder validates the ID Token as per OIDC Core specifications, including:
17
+ - Verifying the token's signature.
18
+ - Checking claims such as `iss`, `aud`, and `exp`.
19
+ ),
20
+ type: 'radio',
21
+ default: 'false',
22
+ options: {
23
+ list_options: [
24
+ {
25
+ label: 'Yes',
26
+ value: 'true'
27
+ },
28
+ {
29
+ label: 'No',
30
+ value: 'false'
31
+ }
32
+ ]
33
+ }
34
+ input :id_token_validation_note,
35
+ title: 'Notes, if applicable:',
36
+ type: 'textarea',
37
+ optional: true
38
+
39
+ run do
40
+ assert id_token_validation_correct == 'true',
41
+ 'ID Token validation is not implemented correctly as per OIDC Core specifications.'
42
+ pass id_token_validation_note if id_token_validation_note.present?
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,47 @@
1
+ module UDAPSecurityTestKit
2
+ class TokenResponseValidationAttestationTest < Inferno::Test
3
+ title 'Validates token response correctly'
4
+ id :udap_security_token_response_validation
5
+ description %(
6
+ Client validates the Token Response as per RFC 6749 and OIDC Core specifications, including:
7
+ - Ensuring the presence of `access_token` and `token_type` parameters.
8
+ - Validating the response structure and data integrity.
9
+ )
10
+ verifies_requirements 'hl7.fhir.us.udap-security_1.0.0@283',
11
+ 'hl7.fhir.us.udap-security_1.0.0@284',
12
+ 'hl7.fhir.us.udap-security_1.0.0@285'
13
+
14
+ input :token_response_validation_correct,
15
+ title: 'ID Token and Access Token Validation: Validates token response correctly',
16
+ description: %(
17
+ I attest that the Client validates the Token Response as per RFC 6749 and OIDC Core specifications,
18
+ including:
19
+ - Ensuring the presence of `access_token` and `token_type` parameters.
20
+ - Validating the response structure and data integrity.
21
+ ),
22
+ type: 'radio',
23
+ default: 'false',
24
+ options: {
25
+ list_options: [
26
+ {
27
+ label: 'Yes',
28
+ value: 'true'
29
+ },
30
+ {
31
+ label: 'No',
32
+ value: 'false'
33
+ }
34
+ ]
35
+ }
36
+ input :token_response_validation_note,
37
+ title: 'Notes, if applicable:',
38
+ type: 'textarea',
39
+ optional: true
40
+
41
+ run do
42
+ assert token_response_validation_correct == 'true',
43
+ 'Token Response validation is not implemented correctly as per RFC 6749 and OIDC Core specifications.'
44
+ pass token_response_validation_note if token_response_validation_note.present?
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,15 @@
1
+ require_relative 'id_token_access_token_validation_group/id_token_validation_test'
2
+ require_relative 'id_token_access_token_validation_group/access_token_validation_test'
3
+ require_relative 'id_token_access_token_validation_group/token_response_validation_test'
4
+
5
+ module UDAPSecurityTestKit
6
+ class IDTokenAccessTokenValidationAttestationGroup < Inferno::TestGroup
7
+ id :udap_server_v100_id_token_access_token_validation_group
8
+ title 'ID Token and Access Token Validation'
9
+
10
+ run_as_group
11
+ test from: :udap_security_id_token_validation
12
+ test from: :udap_security_access_token_validation
13
+ test from: :udap_security_token_response_validation
14
+ end
15
+ end
@@ -0,0 +1,45 @@
1
+ module UDAPSecurityTestKit
2
+ class IdPAuthenticationRequestAttestationTest < Inferno::Test
3
+ title 'Performs Authentication request to the IdP’s authorization endpoint'
4
+ id :udap_security_idp_authentication_request
5
+ description %(
6
+ Data Holder makes an authentication request to the IdP’s authorization endpoint when the IdP is trusted.
7
+ )
8
+ verifies_requirements 'hl7.fhir.us.udap-security_1.0.0@245'
9
+
10
+ input :idp_authentication_request_correct,
11
+ title: %(
12
+ Interaction with Identity Providers (IdPs): Performs Authentication request to the IdP’s authorization
13
+ endpoint
14
+ ),
15
+ description: %(
16
+ I attest that the Data Holder makes an authentication request to the IdP’s authorization endpoint when the
17
+ IdP is trusted.
18
+ ),
19
+ type: 'radio',
20
+ default: 'false',
21
+ options: {
22
+ list_options: [
23
+ {
24
+ label: 'Yes',
25
+ value: 'true'
26
+ },
27
+ {
28
+ label: 'No',
29
+ value: 'false'
30
+ }
31
+ ]
32
+ }
33
+ input :idp_authentication_request_note,
34
+ title: 'Notes, if applicable:',
35
+ type: 'textarea',
36
+ optional: true
37
+
38
+ run do
39
+ assert idp_authentication_request_correct == 'true',
40
+ 'Data Holder does not make an authentication request to the IdP’s authorization endpoint when the IdP
41
+ is trusted.'
42
+ pass idp_authentication_request_note if idp_authentication_request_note.present?
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,45 @@
1
+ module UDAPSecurityTestKit
2
+ class IdPDynamicRegistrationAttestationTest < Inferno::Test
3
+ title 'Performs IdP dynamic registration if supported'
4
+ id :udap_security_idp_dynamic_registration
5
+ description %(
6
+ Data Holder registers as a client with the IdP if:
7
+ - The IdP is trusted.
8
+ - The IdP supports UDAP Dynamic Registration.
9
+ )
10
+ verifies_requirements 'hl7.fhir.us.udap-security_1.0.0@239'
11
+
12
+ input :idp_dynamic_registration_correct,
13
+ title: 'Interaction with Identity Providers (IdPs): Performs IdP dynamic registration if supported',
14
+ description: %(
15
+ I attest that the Data Holder registers as a client with the IdP if:
16
+ - The IdP is trusted.
17
+ - The IdP supports UDAP Dynamic Registration.
18
+ ),
19
+ type: 'radio',
20
+ default: 'false',
21
+ options: {
22
+ list_options: [
23
+ {
24
+ label: 'Yes',
25
+ value: 'true'
26
+ },
27
+ {
28
+ label: 'No',
29
+ value: 'false'
30
+ }
31
+ ]
32
+ }
33
+ input :idp_dynamic_registration_note,
34
+ title: 'Notes, if applicable:',
35
+ type: 'textarea',
36
+ optional: true
37
+
38
+ run do
39
+ assert idp_dynamic_registration_correct == 'true',
40
+ 'Data Holder does not register as a client with the IdP when it is trusted and supports
41
+ UDAP Dynamic Registration.'
42
+ pass idp_dynamic_registration_note if idp_dynamic_registration_note.present?
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,44 @@
1
+ module UDAPSecurityTestKit
2
+ class IdPMetadataValidationAttestationTest < Inferno::Test
3
+ title 'Validates IdP metadata to determine trust'
4
+ id :udap_security_idp_metadata_validation
5
+ description %(
6
+ Data Holder validates the IdP’s UDAP metadata to determine trustworthiness, including:
7
+ - Verifying the authenticity of the metadata.
8
+ - Ensuring the metadata meets UDAP specifications.
9
+ )
10
+ verifies_requirements 'hl7.fhir.us.udap-security_1.0.0@238'
11
+
12
+ input :idp_metadata_validation_correct,
13
+ title: 'Interaction with Identity Providers (IdPs): Validates IdP metadata to determine trust',
14
+ description: %(
15
+ I attest that the Data Holder validates the IdP’s UDAP metadata to determine trustworthiness, including:
16
+ - Verifying the authenticity of the metadata.
17
+ - Ensuring the metadata meets UDAP specifications.
18
+ ),
19
+ type: 'radio',
20
+ default: 'false',
21
+ options: {
22
+ list_options: [
23
+ {
24
+ label: 'Yes',
25
+ value: 'true'
26
+ },
27
+ {
28
+ label: 'No',
29
+ value: 'false'
30
+ }
31
+ ]
32
+ }
33
+ input :idp_metadata_validation_note,
34
+ title: 'Notes, if applicable:',
35
+ type: 'textarea',
36
+ optional: true
37
+
38
+ run do
39
+ assert idp_metadata_validation_correct == 'true',
40
+ 'Data Holder does not validate the IdP’s UDAP metadata to determine trustworthiness.'
41
+ pass idp_metadata_validation_note if idp_metadata_validation_note.present?
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,46 @@
1
+ module UDAPSecurityTestKit
2
+ class IdPTokenExchangeAttestationTest < Inferno::Test
3
+ title 'Exchanges code for tokens after successful authentication response'
4
+ id :udap_security_idp_token_exchange
5
+ description %(
6
+ Data Holder exchanges the authorization code for tokens after receiving a successful
7
+ authentication response from the IdP.
8
+ )
9
+ verifies_requirements 'hl7.fhir.us.udap-security_1.0.0@279'
10
+
11
+ input :idp_token_exchange_correct,
12
+ title: %(
13
+ 'Interaction with Identity Providers (IdPs): Exchanges code for tokens after successful
14
+ authentication response'
15
+ ),
16
+ description: %(
17
+ I attest that the Data Holder exchanges the authorization code for tokens after receiving a
18
+ successful authentication response from the IdP.
19
+ ),
20
+ type: 'radio',
21
+ default: 'false',
22
+ options: {
23
+ list_options: [
24
+ {
25
+ label: 'Yes',
26
+ value: 'true'
27
+ },
28
+ {
29
+ label: 'No',
30
+ value: 'false'
31
+ }
32
+ ]
33
+ }
34
+ input :idp_token_exchange_note,
35
+ title: 'Notes, if applicable:',
36
+ type: 'textarea',
37
+ optional: true
38
+
39
+ run do
40
+ assert idp_token_exchange_correct == 'true',
41
+ 'Data Holder does not exchange the authorization code for tokens after receiving a successful
42
+ authentication response from the IdP.'
43
+ pass idp_token_exchange_note if idp_token_exchange_note.present?
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,17 @@
1
+ require_relative 'identity_provider_interaction_group/idp_authentication_request_test'
2
+ require_relative 'identity_provider_interaction_group/idp_dynamic_registration_test'
3
+ require_relative 'identity_provider_interaction_group/idp_metadata_validation_test'
4
+ require_relative 'identity_provider_interaction_group/idp_token_exchange_test'
5
+
6
+ module UDAPSecurityTestKit
7
+ class IdentityProviderInteractionAttestationGroup < Inferno::TestGroup
8
+ id :udap_server_v100_identity_provider_interaction_group
9
+ title 'Interaction with Identity Providers (IdPs)'
10
+
11
+ run_as_group
12
+ test from: :udap_security_idp_metadata_validation
13
+ test from: :udap_security_idp_dynamic_registration
14
+ test from: :udap_security_idp_authentication_request
15
+ test from: :udap_security_idp_token_exchange
16
+ end
17
+ end
@@ -0,0 +1,36 @@
1
+ module UDAPSecurityTestKit
2
+ class JwtCertificateChainValidationAttestationTest < Inferno::Test
3
+ title 'Builds and validates trusted certificate chain for x5c'
4
+ id :udap_security_jwt_certificate_chain_validation
5
+ description %(
6
+ The Authorization Server builds and validates a trusted certificate chain for the certificates in
7
+ the x5c parameter of the JOSE header on Authentication Tokens in token requests.
8
+ )
9
+ verifies_requirements 'hl7.fhir.us.udap-security_1.0.0@176'
10
+
11
+ input :jwt_certificate_chain_validation_correct,
12
+ title: 'JWT/Token Validation and Security: Builds and validates trusted certificate chain for x5c',
13
+ description: %(
14
+ I attest that the Authorization Server builds and validates a trusted certificate chain for the
15
+ certificates in the x5c parameter of the JOSE header on Authentication Tokens in token requests.
16
+ ),
17
+ type: 'radio',
18
+ default: 'false',
19
+ options: {
20
+ list_options: [
21
+ { label: 'Yes', value: 'true' },
22
+ { label: 'No', value: 'false' }
23
+ ]
24
+ }
25
+ input :jwt_certificate_chain_validation_note,
26
+ title: 'Notes, if applicable:',
27
+ type: 'textarea',
28
+ optional: true
29
+
30
+ run do
31
+ assert jwt_certificate_chain_validation_correct == 'true',
32
+ 'The Authorization Server does not build and validate a trusted certificate chain for x5c certificates.'
33
+ pass jwt_certificate_chain_validation_note if jwt_certificate_chain_validation_note.present?
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,36 @@
1
+ module UDAPSecurityTestKit
2
+ class JwtGrantParameterValidationAttestationTest < Inferno::Test
3
+ title 'Authorization Server validates parameters per grant mechanism'
4
+ id :udap_security_jwt_grant_parameter_validation
5
+ description %(
6
+ The Authorization Server validates all other parameters in the token request as per the
7
+ requirements of the grant mechanism identified by the grant_type value.
8
+ )
9
+ verifies_requirements 'hl7.fhir.us.udap-security_1.0.0@182'
10
+
11
+ input :jwt_grant_parameter_validation_correct,
12
+ title: 'JWT/Token Validation and Security: Parameter validation per grant mechanism',
13
+ description: %(
14
+ I attest that the Authorization Server validates all other parameters in the token request
15
+ as per the requirements of the grant mechanism identified by the grant_type value.
16
+ ),
17
+ type: 'radio',
18
+ default: 'false',
19
+ options: {
20
+ list_options: [
21
+ { label: 'Yes', value: 'true' },
22
+ { label: 'No', value: 'false' }
23
+ ]
24
+ }
25
+ input :jwt_grant_parameter_validation_note,
26
+ title: 'Notes, if applicable:',
27
+ type: 'textarea',
28
+ optional: true
29
+
30
+ run do
31
+ assert jwt_grant_parameter_validation_correct == 'true',
32
+ 'The Authorization Server does not validate parameters as required by the grant mechanism.'
33
+ pass jwt_grant_parameter_validation_note if jwt_grant_parameter_validation_note.present?
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,35 @@
1
+ module UDAPSecurityTestKit
2
+ class JwtJtiReuseAttestationTest < Inferno::Test
3
+ title 'Does not reuse JWT `jti` value before expiry'
4
+ id :udap_security_jwt_jti_reuse
5
+ description %(
6
+ The server does not reuse a `jti` value in another JWT before the time specified in the `exp` claim has passed.
7
+ )
8
+ verifies_requirements 'hl7.fhir.us.udap-security_1.0.0@56'
9
+
10
+ input :jwt_jti_reuse_correct,
11
+ title: 'JWT/Token Validation and Security: Does not reuse JWT `jti` value before expiry',
12
+ description: %(
13
+ I attest that the server does not reuse a `jti` value in another JWT before the time specified in the `exp`
14
+ claim has passed.
15
+ ),
16
+ type: 'radio',
17
+ default: 'false',
18
+ options: {
19
+ list_options: [
20
+ { label: 'Yes', value: 'true' },
21
+ { label: 'No', value: 'false' }
22
+ ]
23
+ }
24
+ input :jwt_jti_reuse_note,
25
+ title: 'Notes, if applicable:',
26
+ type: 'textarea',
27
+ optional: true
28
+
29
+ run do
30
+ assert jwt_jti_reuse_correct == 'true',
31
+ 'The server reuses a `jti` value in another JWT before the `exp` time has passed.'
32
+ pass jwt_jti_reuse_note if jwt_jti_reuse_note.present?
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,36 @@
1
+ module UDAPSecurityTestKit
2
+ class JwtSignatureValidationAttestationTest < Inferno::Test
3
+ title 'Validates JWT signature using public key from x5c parameter'
4
+ id :udap_security_jwt_signature_validation
5
+ description %(
6
+ The Authorization Server validates the digital signature on the Authentication Token using the public key
7
+ extracted from the first certificate in the x5c parameter of the JOSE header.
8
+ )
9
+ verifies_requirements 'hl7.fhir.us.udap-security_1.0.0@173'
10
+
11
+ input :jwt_signature_validation_correct,
12
+ title: 'JWT/Token Validation and Security: Validates JWT signature using public key from x5c parameter',
13
+ description: %(
14
+ I attest that the Authorization Server validates the digital signature on the Authentication Token
15
+ using the public key extracted from the first certificate in the x5c parameter of the JOSE header.
16
+ ),
17
+ type: 'radio',
18
+ default: 'false',
19
+ options: {
20
+ list_options: [
21
+ { label: 'Yes', value: 'true' },
22
+ { label: 'No', value: 'false' }
23
+ ]
24
+ }
25
+ input :jwt_signature_validation_note,
26
+ title: 'Notes, if applicable:',
27
+ type: 'textarea',
28
+ optional: true
29
+
30
+ run do
31
+ assert jwt_signature_validation_correct == 'true',
32
+ 'The Authorization Server does not validate the JWT signature using the x5c public key.'
33
+ pass jwt_signature_validation_note if jwt_signature_validation_note.present?
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,43 @@
1
+ module UDAPSecurityTestKit
2
+ class JwtTokenRequestValidationAttestationTest < Inferno::Test
3
+ title 'Validates and responds to token requests per UDAP JWT-Based Client Authentication'
4
+ id :udap_security_jwt_token_request_validation
5
+ description %(
6
+ The Authorization Server validates and responds to token requests containing Authentication Tokens
7
+ as per [Sections 6 and 7 of UDAP JWT-Based Client Authentication](https://www.udap.org/udap-jwt-client-auth.html).
8
+ )
9
+ verifies_requirements(
10
+ 'hl7.fhir.us.udap-security_1.0.0@172',
11
+ 'hl7.fhir.us.udap-security_1.0.0@229'
12
+ )
13
+
14
+ input :jwt_token_request_validation_correct,
15
+ title: %(
16
+ JWT/Token Validation and Security: Validates and responds to token requests per UDAP JWT-Based
17
+ Client Authentication
18
+ ),
19
+ description: %(
20
+ I attest that the Authorization Server validates and responds to token requests containing
21
+ Authentication Tokens as per [Sections 6 and 7 of UDAP JWT-Based Client Authentication](https://www.udap.org/udap-jwt-client-auth.html).
22
+ ),
23
+ type: 'radio',
24
+ default: 'false',
25
+ options: {
26
+ list_options: [
27
+ { label: 'Yes', value: 'true' },
28
+ { label: 'No', value: 'false' }
29
+ ]
30
+ }
31
+ input :jwt_token_request_validation_note,
32
+ title: 'Notes, if applicable:',
33
+ type: 'textarea',
34
+ optional: true
35
+
36
+ run do
37
+ assert jwt_token_request_validation_correct == 'true',
38
+ 'The Authorization Server does not validate and respond to token requests as per UDAP JWT-Based
39
+ Client Authentication.'
40
+ pass jwt_token_request_validation_note if jwt_token_request_validation_note.present?
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,19 @@
1
+ require_relative 'jwt_security_group/jwt_certificate_chain_validation_test'
2
+ require_relative 'jwt_security_group/jwt_grant_parameter_validation_test'
3
+ require_relative 'jwt_security_group/jwt_jti_reuse_test'
4
+ require_relative 'jwt_security_group/jwt_signature_validation_test'
5
+ require_relative 'jwt_security_group/jwt_token_request_validation_test'
6
+
7
+ module UDAPSecurityTestKit
8
+ class JWTSecurityGroup < Inferno::TestGroup
9
+ id :udap_server_v100_jwt_security_group
10
+ title 'JWT/Token Validation and Security'
11
+
12
+ run_as_group
13
+ test from: :udap_security_jwt_token_request_validation
14
+ test from: :udap_security_jwt_signature_validation
15
+ test from: :udap_security_jwt_jti_reuse
16
+ test from: :udap_security_jwt_grant_parameter_validation
17
+ test from: :udap_security_jwt_certificate_chain_validation
18
+ end
19
+ end
@@ -0,0 +1,43 @@
1
+ module UDAPSecurityTestKit
2
+ class UDAPAuthorizationExtensionsRequiredAttestationTest < Inferno::Test
3
+ title 'Includes required authorization extensions'
4
+ id :udap_security_authorization_extensions_required
5
+ description %(
6
+ Server's UDAP metadata includes the `udap_authorization_extensions_required` list with `["hl7-b2b"]`
7
+ if the Authorization Server requires the B2B Authorization Extension Object.
8
+ )
9
+ verifies_requirements 'hl7.fhir.us.udap-security_1.0.0@32'
10
+
11
+ input :udap_authorization_extensions_required_correct,
12
+ title: 'UDAP Metadata and Server Capabilities: Includes required authorization extensions',
13
+ description: %(
14
+ I attest that the server's UDAP metadata includes the `udap_authorization_extensions_required` list
15
+ with `["hl7-b2b"]` if the Authorization Server requires the B2B Authorization Extension Object.
16
+ ),
17
+ type: 'radio',
18
+ default: 'false',
19
+ options: {
20
+ list_options: [
21
+ {
22
+ label: 'Yes',
23
+ value: 'true'
24
+ },
25
+ {
26
+ label: 'No',
27
+ value: 'false'
28
+ }
29
+ ]
30
+ }
31
+ input :udap_authorization_extensions_required_note,
32
+ title: 'Notes, if applicable:',
33
+ type: 'textarea',
34
+ optional: true
35
+
36
+ run do
37
+ assert udap_authorization_extensions_required_correct == 'true',
38
+ 'Server metadata does not include the `udap_authorization_extensions_required` list with `["hl7-b2b"]`
39
+ when required.'
40
+ pass udap_authorization_extensions_required_note if udap_authorization_extensions_required_note.present?
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,44 @@
1
+ module UDAPSecurityTestKit
2
+ class CommunityParameterSupportAttestationTest < Inferno::Test
3
+ title 'Supports community parameter correctly'
4
+ id :udap_security_community_parameter_support
5
+ description %(
6
+ Server supports the `community` parameter correctly by selecting a certificate intended for use within the
7
+ identified trust community when generating the signed JWT for the `signed_metadata` element.
8
+ )
9
+ verifies_requirements 'hl7.fhir.us.udap-security_1.0.0@62'
10
+
11
+ input :community_parameter_support_correct,
12
+ title: 'UDAP Metadata and Server Capabilities: Supports community parameter correctly',
13
+ description: %(
14
+ I attest that the server supports the `community` parameter correctly by selecting a certificate intended
15
+ for use within the identified trust community when generating the signed JWT for the `signed_metadata`
16
+ element.
17
+ ),
18
+ type: 'radio',
19
+ default: 'false',
20
+ options: {
21
+ list_options: [
22
+ {
23
+ label: 'Yes',
24
+ value: 'true'
25
+ },
26
+ {
27
+ label: 'No',
28
+ value: 'false'
29
+ }
30
+ ]
31
+ }
32
+ input :community_parameter_support_note,
33
+ title: 'Notes, if applicable:',
34
+ type: 'textarea',
35
+ optional: true
36
+
37
+ run do
38
+ assert community_parameter_support_correct == 'true',
39
+ 'Server does not correctly support the `community` parameter when generating the signed JWT for the
40
+ `signed_metadata` element.'
41
+ pass community_parameter_support_note if community_parameter_support_note.present?
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,43 @@
1
+ module UDAPSecurityTestKit
2
+ class UDAPMetadataEndpointErrorHandlingAttestationTest < Inferno::Test
3
+ title 'Handles unsupported workflows correctly'
4
+ id :udap_security_metadata_error_handling
5
+ description %(
6
+ Server's UDAP metadata endpoint correctly handles unsupported workflows by returning a `404 Not Found` response
7
+ when no UDAP workflows are supported.
8
+ )
9
+ verifies_requirements 'hl7.fhir.us.udap-security_1.0.0@19'
10
+
11
+ input :udap_metadata_error_handling_correct,
12
+ title: 'UDAP Metadata and Server Capabilities: Handles unsupported workflows correctly',
13
+ description: %(
14
+ I attest that the server's UDAP metadata endpoint correctly handles unsupported workflows by returning a
15
+ `404 Not Found` response when no UDAP workflows are supported.
16
+ ),
17
+ type: 'radio',
18
+ default: 'false',
19
+ options: {
20
+ list_options: [
21
+ {
22
+ label: 'Yes',
23
+ value: 'true'
24
+ },
25
+ {
26
+ label: 'No',
27
+ value: 'false'
28
+ }
29
+ ]
30
+ }
31
+ input :udap_metadata_error_handling_note,
32
+ title: 'Notes, if applicable:',
33
+ type: 'textarea',
34
+ optional: true
35
+
36
+ run do
37
+ assert udap_metadata_error_handling_correct == 'true',
38
+ 'Server metadata endpoint did not correctly handle unsupported workflows by returning a
39
+ `404 Not Found` response.'
40
+ pass udap_metadata_error_handling_note if udap_metadata_error_handling_note.present?
41
+ end
42
+ end
43
+ end