udap_security_test_kit 0.11.6 → 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 (79) hide show
  1. checksums.yaml +4 -4
  2. data/lib/udap_security_test_kit/client_suite.rb +3 -0
  3. data/lib/udap_security_test_kit/registration_failure_invalid_contents_test.rb +1 -1
  4. data/lib/udap_security_test_kit/requirements/generated/udap-security-test-kit_requirements_coverage.csv +317 -0
  5. data/lib/udap_security_test_kit/requirements/generated/udap_security_client_requirements_coverage.csv +38 -38
  6. data/lib/udap_security_test_kit/requirements/generated/udap_security_requirements_coverage.csv +70 -70
  7. data/lib/udap_security_test_kit/version.rb +2 -2
  8. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/b2b_authorization_extension_object_test.rb +77 -0
  9. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/client_authorization_code_usage_test.rb +47 -0
  10. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/client_security_csrf_protection_test.rb +50 -0
  11. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/cryptographic_algorithms_test.rb +44 -0
  12. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/data_holder_auth_request_scope_test.rb +42 -0
  13. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/idp_authentication_compliance_test.rb +44 -0
  14. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/idp_supports_required_scopes_test.rb +42 -0
  15. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/jti_reuse_prevention_test.rb +44 -0
  16. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/metadata_interpretation_test.rb +47 -0
  17. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/oauth2_protocol_compliance_test.rb +50 -0
  18. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/preferred_identity_provider_test.rb +45 -0
  19. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/private_key_authentication_test.rb +47 -0
  20. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/resource_holder_authentication_test.rb +45 -0
  21. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/software_statement_registration_test.rb +49 -0
  22. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/token_request_authentication_test.rb +51 -0
  23. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/trust_community_query_parameters_test.rb +43 -0
  24. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client/validation_confidentiality_test.rb +49 -0
  25. data/lib/udap_security_test_kit/visual_inspection_and_attestation/client_attestation_group.rb +48 -0
  26. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/authentication_requests_group/authentication_request_construction_test.rb +56 -0
  27. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/authentication_requests_group/authentication_request_validation_test.rb +60 -0
  28. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/authentication_requests_group.rb +13 -0
  29. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/authorization_code_token_requests_group/access_token_lifetime_test.rb +42 -0
  30. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/authorization_code_token_requests_group/access_token_request_validation_test.rb +51 -0
  31. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/authorization_code_token_requests_group/authorization_code_usage_test.rb +45 -0
  32. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/authorization_code_token_requests_group/resource_holder_authorization_flow_test.rb +37 -0
  33. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/authorization_code_token_requests_group.rb +17 -0
  34. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/client_authentication_group/client_certificate_storage_test.rb +36 -0
  35. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/client_authentication_group/no_client_credentials_native_apps_test.rb +38 -0
  36. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/client_authentication_group.rb +13 -0
  37. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/dynamic_client_registration_group/certification_handling_test.rb +45 -0
  38. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/dynamic_client_registration_group/client_id_modification_test.rb +42 -0
  39. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/dynamic_client_registration_group/dynamic_client_registration_validation_test.rb +48 -0
  40. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/dynamic_client_registration_group.rb +15 -0
  41. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/error_handling_group/deny_token_request_test.rb +42 -0
  42. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/error_handling_group/general_error_response_test.rb +39 -0
  43. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/error_handling_group/invalid_id_token_test.rb +43 -0
  44. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/error_handling_group/invalid_idp_test.rb +39 -0
  45. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/error_handling_group/invalid_redirection_uri_test.rb +43 -0
  46. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/error_handling_group/prompt_none_test.rb +39 -0
  47. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/error_handling_group/state_mismatch_test.rb +43 -0
  48. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/error_handling_group/unauthenticated_user_test.rb +42 -0
  49. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/error_handling_group/valid_state_error_response_test.rb +43 -0
  50. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/error_handling_group.rb +27 -0
  51. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/id_token_access_token_validation_group/access_token_validation_test.rb +47 -0
  52. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/id_token_access_token_validation_group/id_token_validation_test.rb +45 -0
  53. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/id_token_access_token_validation_group/token_response_validation_test.rb +47 -0
  54. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/id_token_access_token_validation_group.rb +15 -0
  55. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/identity_provider_interaction_group/idp_authentication_request_test.rb +45 -0
  56. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/identity_provider_interaction_group/idp_dynamic_registration_test.rb +45 -0
  57. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/identity_provider_interaction_group/idp_metadata_validation_test.rb +44 -0
  58. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/identity_provider_interaction_group/idp_token_exchange_test.rb +46 -0
  59. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/identity_provider_interaction_group.rb +17 -0
  60. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/jwt_security_group/jwt_certificate_chain_validation_test.rb +36 -0
  61. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/jwt_security_group/jwt_grant_parameter_validation_test.rb +36 -0
  62. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/jwt_security_group/jwt_jti_reuse_test.rb +35 -0
  63. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/jwt_security_group/jwt_signature_validation_test.rb +36 -0
  64. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/jwt_security_group/jwt_token_request_validation_test.rb +43 -0
  65. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/jwt_security_group.rb +19 -0
  66. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/metadata_server_capabilities_group/udap_authorization_extensions_required_test.rb +43 -0
  67. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/metadata_server_capabilities_group/udap_community_parameter_support_test.rb +44 -0
  68. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/metadata_server_capabilities_group/udap_metadata_endpoint_error_handling_test.rb +43 -0
  69. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/metadata_server_capabilities_group/udap_metadata_representation_test.rb +42 -0
  70. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/metadata_server_capabilities_group/udap_profiles_supported_test.rb +43 -0
  71. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/metadata_server_capabilities_group.rb +19 -0
  72. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/security_measures_group/csrf_protection_test.rb +49 -0
  73. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/security_measures_group/obtain_authorization_scopes_test.rb +44 -0
  74. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/security_measures_group/state_parameter_test.rb +48 -0
  75. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/security_measures_group/unauthenticated_client_security_test.rb +47 -0
  76. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server/security_measures_group.rb +17 -0
  77. data/lib/udap_security_test_kit/visual_inspection_and_attestation/server_attestation_group.rb +33 -0
  78. data/lib/udap_security_test_kit.rb +2 -0
  79. metadata +81 -4
@@ -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
@@ -0,0 +1,42 @@
1
+ module UDAPSecurityTestKit
2
+ class UDAPMetadataRepresentationAttestationTest < Inferno::Test
3
+ title 'Represents server capabilities correctly'
4
+ id :udap_security_metadata_representation
5
+ description %(
6
+ Server's UDAP metadata endpoint correctly represents the server’s capabilities with respect to the UDAP
7
+ workflows described in the guide.
8
+ )
9
+ verifies_requirements 'hl7.fhir.us.udap-security_1.0.0@18'
10
+
11
+ input :udap_metadata_representation_correct,
12
+ title: 'UDAP Metadata and Server Capabilities: Represents server capabilities correctly',
13
+ description: %(
14
+ I attest that the server's UDAP metadata endpoint correctly represents the server’s capabilities with
15
+ respect to the UDAP workflows described in the guide.
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_representation_note,
32
+ title: 'Notes, if applicable:',
33
+ type: 'textarea',
34
+ optional: true
35
+
36
+ run do
37
+ assert udap_metadata_representation_correct == 'true',
38
+ 'Server metadata does not correctly represent the server’s capabilities with respect to UDAP workflows.'
39
+ pass udap_metadata_representation_note if udap_metadata_representation_note.present?
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,43 @@
1
+ module UDAPSecurityTestKit
2
+ class UDAPProfilesSupportedAttestationTest < Inferno::Test
3
+ title 'Includes supported profiles'
4
+ id :udap_security_profiles_supported
5
+ description %(
6
+ Server's UDAP metadata includes the `udap_profiles_supported` element with `udap_to` if the
7
+ server supports the user authentication workflow described in Section 6.
8
+ )
9
+ verifies_requirements 'hl7.fhir.us.udap-security_1.0.0@27'
10
+
11
+ input :udap_profiles_supported_correct,
12
+ title: 'UDAP Metadata and Server Capabilities: Includes supported profiles',
13
+ description: %(
14
+ I attest that the server's UDAP metadata includes the `udap_profiles_supported` element with `udap_to`
15
+ if the server supports the user authentication workflow described in Section 6.
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_profiles_supported_note,
32
+ title: 'Notes, if applicable:',
33
+ type: 'textarea',
34
+ optional: true
35
+
36
+ run do
37
+ assert udap_profiles_supported_correct == 'true',
38
+ 'Server metadata does not include the `udap_profiles_supported` element with `udap_to` for UDAP
39
+ Tiered OAuth for User Authentication.'
40
+ pass udap_profiles_supported_note if udap_profiles_supported_note.present?
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,19 @@
1
+ require_relative 'metadata_server_capabilities_group/udap_authorization_extensions_required_test'
2
+ require_relative 'metadata_server_capabilities_group/udap_community_parameter_support_test'
3
+ require_relative 'metadata_server_capabilities_group/udap_metadata_endpoint_error_handling_test'
4
+ require_relative 'metadata_server_capabilities_group/udap_metadata_representation_test'
5
+ require_relative 'metadata_server_capabilities_group/udap_profiles_supported_test'
6
+
7
+ module UDAPSecurityTestKit
8
+ class MetadataServerCapabilitiesAttestationGroup < Inferno::TestGroup
9
+ id :udap_server_v100_metadata_server_capabilities_group
10
+ title 'UDAP Metadata and Server Capabilities'
11
+
12
+ run_as_group
13
+ test from: :udap_security_authorization_extensions_required
14
+ test from: :udap_security_community_parameter_support
15
+ test from: :udap_security_metadata_error_handling
16
+ test from: :udap_security_metadata_representation
17
+ test from: :udap_security_profiles_supported
18
+ end
19
+ end
@@ -0,0 +1,49 @@
1
+ module UDAPSecurityTestKit
2
+ class CSRFProtectionAttestationTest < Inferno::Test
3
+ title 'Implements CSRF and Clickjacking protection'
4
+ id :udap_security_csrf_protection
5
+ description %(
6
+ Authorization Server implements CSRF and Clickjacking protection as
7
+ described in [RFC6749](https://openid.net/specs/openid-connect-core-1_0.html#RFC6749),
8
+ including:
9
+ - Use of anti-CSRF tokens.
10
+ - Validation of `state` parameter to prevent cross-site request forgery.
11
+ )
12
+ verifies_requirements 'hl7.fhir.us.udap-security_1.0.0@278',
13
+ 'hl7.fhir.us.udap-security_1.0.0@269'
14
+
15
+ input :csrf_protection_implemented,
16
+ title: 'Security Measures: Implements CSRF and Clickjacking protection',
17
+ description: %(
18
+ I attest that the Authorization Server implements CSRF and Clickjacking protection as
19
+ described in [RFC6749](https://openid.net/specs/openid-connect-core-1_0.html#RFC6749),
20
+ including:
21
+ - Use of anti-CSRF tokens.
22
+ - Validation of `state` parameter to prevent cross-site request forgery.
23
+ ),
24
+ type: 'radio',
25
+ default: 'false',
26
+ options: {
27
+ list_options: [
28
+ {
29
+ label: 'Yes',
30
+ value: 'true'
31
+ },
32
+ {
33
+ label: 'No',
34
+ value: 'false'
35
+ }
36
+ ]
37
+ }
38
+ input :csrf_protection_note,
39
+ title: 'Notes, if applicable:',
40
+ type: 'textarea',
41
+ optional: true
42
+
43
+ run do
44
+ assert csrf_protection_implemented == 'true',
45
+ 'Authorization Server does not implement CSRF protection as described in RFC6749.'
46
+ pass csrf_protection_note if csrf_protection_note.present?
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,44 @@
1
+ module UDAPSecurityTestKit
2
+ class ObtainAuthorizationScopesAttestationTest < Inferno::Test
3
+ title 'Obtains user authorization for requested scopes'
4
+ id :udap_security_user_authorization
5
+ description %(
6
+ Resource Holder, after mapping the authenticated user, obtains authorization from the user for the scopes
7
+ requested by the client app, if such authorization is required, as per Section [4.5 of UDAP Tiered OAuth](https://www.udap.org/udap-user-auth-stu1.html),
8
+ returning to the workflow defined in [Section 4.1](https://hl7.org/fhir/us/udap-security/STU1/consumer.html#obtaining-an-authorization-code)
9
+ or [Section 5.1](https://hl7.org/fhir/us/udap-security/STU1/b2b.html#obtaining-an-authorization-code) of this
10
+ guide, for consumer-facing or B2B apps, respectively.
11
+ )
12
+ verifies_requirements 'hl7.fhir.us.udap-security_1.0.0@297'
13
+
14
+ input :user_authorization_correct,
15
+ title: 'Security Measures: Obtains user authorization for requested scopes',
16
+ description: %(
17
+ I attest that the Resource Holder, after mapping the authenticated user, obtains authorization from the
18
+ user for the scopes requested by the client app, if such authorization is required, as per Section
19
+ [4.5 of UDAP Tiered OAuth](https://www.udap.org/udap-user-auth-stu1.html), returning to the workflow
20
+ defined in [Section 4.1](https://hl7.org/fhir/us/udap-security/STU1/consumer.html#obtaining-an-authorization-code)
21
+ or [Section 5.1](https://hl7.org/fhir/us/udap-security/STU1/b2b.html#obtaining-an-authorization-code) of
22
+ this guide, for consumer-facing or B2B apps, respectively.
23
+ ),
24
+ type: 'radio',
25
+ default: 'false',
26
+ options: {
27
+ list_options: [
28
+ { label: 'Yes', value: 'true' },
29
+ { label: 'No', value: 'false' }
30
+ ]
31
+ }
32
+ input :user_authorization_note,
33
+ title: 'Notes, if applicable:',
34
+ type: 'textarea',
35
+ optional: true
36
+
37
+ run do
38
+ assert user_authorization_correct == 'true',
39
+ 'Resource Holder does not obtain user authorization for the requested scopes after mapping the
40
+ authenticated user.'
41
+ pass user_authorization_note if user_authorization_note.present?
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,48 @@
1
+ module UDAPSecurityTestKit
2
+ class StateParameterAttestationTest < Inferno::Test
3
+ title 'Manages state parameter securely'
4
+ id :udap_security_state_parameter_management
5
+ description %(
6
+ The Resource Holder:
7
+ - Generates its own random value for the state parameter (does not reuse the value provided by the Client App).
8
+ - Validates that the value of the state parameter in the query string matches the value it generated when the
9
+ user is redirected back from the IdP.
10
+ - Validates the value of the state parameter when receiving an error response from the IdP.
11
+ )
12
+ verifies_requirements(
13
+ 'hl7.fhir.us.udap-security_1.0.0@254',
14
+ 'hl7.fhir.us.udap-security_1.0.0@255',
15
+ 'hl7.fhir.us.udap-security_1.0.0@270',
16
+ 'hl7.fhir.us.udap-security_1.0.0@272'
17
+ )
18
+
19
+ input :state_parameter_management_correct,
20
+ title: 'Security Measures: Manages state parameter securely',
21
+ description: %(
22
+ I attest that the Resource Holder:
23
+ - Generates its own random value for the state parameter and does not reuse the value provided by the
24
+ Client App.
25
+ - Validates that the value of the state parameter in the query string matches the value it generated
26
+ when the user is redirected back from the IdP.
27
+ - Validates the value of the state parameter when receiving an error response from the IdP.
28
+ ),
29
+ type: 'radio',
30
+ default: 'false',
31
+ options: {
32
+ list_options: [
33
+ { label: 'Yes', value: 'true' },
34
+ { label: 'No', value: 'false' }
35
+ ]
36
+ }
37
+ input :state_parameter_management_note,
38
+ title: 'Notes, if applicable:',
39
+ type: 'textarea',
40
+ optional: true
41
+
42
+ run do
43
+ assert state_parameter_management_correct == 'true',
44
+ 'Resource Holder does not properly generate or validate the state parameter as required.'
45
+ pass state_parameter_management_note if state_parameter_management_note.present?
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,47 @@
1
+ module UDAPSecurityTestKit
2
+ class UnauthenticatedClientSecurityAttestationTest < Inferno::Test
3
+ title 'Considers security measures for unauthenticated clients'
4
+ id :udap_security_unauthenticated_clients
5
+ description %(
6
+ I attest that the Authorization Server considers security implications when interacting with unauthenticated
7
+ clients, including:
8
+ - Restricting access to sensitive endpoints.
9
+ - Implementing rate limiting or other protective measures.
10
+ )
11
+ verifies_requirements 'hl7.fhir.us.udap-security_1.0.0@288'
12
+
13
+ input :unauthenticated_client_security_measures,
14
+ title: 'Security Measures: Considers security measures for unauthenticated clients',
15
+ description: %(
16
+ I attest that the Authorization Server considers security implications when interacting with unauthenticated
17
+ clients, including:
18
+ - Restricting access to sensitive endpoints.
19
+ - Implementing rate limiting or other protective measures.
20
+ ),
21
+ type: 'radio',
22
+ default: 'false',
23
+ options: {
24
+ list_options: [
25
+ {
26
+ label: 'Yes',
27
+ value: 'true'
28
+ },
29
+ {
30
+ label: 'No',
31
+ value: 'false'
32
+ }
33
+ ]
34
+ }
35
+ input :unauthenticated_client_security_note,
36
+ title: 'Notes, if applicable:',
37
+ type: 'textarea',
38
+ optional: true
39
+
40
+ run do
41
+ assert unauthenticated_client_security_measures == 'true',
42
+ 'Authorization Server does not consider security implications when interacting with unauthenticated
43
+ clients.'
44
+ pass unauthenticated_client_security_note if unauthenticated_client_security_note.present?
45
+ end
46
+ end
47
+ end