diff --git a/spec/namespaces/security.yaml b/spec/namespaces/security.yaml index 234ab6fc7..0b706146f 100644 --- a/spec/namespaces/security.yaml +++ b/spec/namespaces/security.yaml @@ -60,8 +60,6 @@ paths: x-operation-group: security.post_dashboards_info x-version-added: '1.0' description: Updates the current security-dashboards plugin configuration. - requestBody: - $ref: '#/components/requestBodies/security.post_dashboards_info' responses: '200': $ref: '#/components/responses/security.post_dashboards_info@200' @@ -1203,12 +1201,6 @@ components: items: $ref: '../schemas/security._common.yaml#/components/schemas/PatchOperation' required: true - security.post_dashboards_info: - content: - application/json: - schema: - $ref: '../schemas/security._common.yaml#/components/schemas/DashboardsInfo' - required: false security.update_audit_configuration: content: application/json: diff --git a/tests/security/with-api-prefix/account.yaml b/tests/security/with-api-prefix/account.yaml new file mode 100644 index 000000000..c4a685192 --- /dev/null +++ b/tests/security/with-api-prefix/account.yaml @@ -0,0 +1,50 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test account endpoint. + +prologues: + - path: _plugins/_security/api/internalusers/{username} + method: PUT + parameters: + username: test + request_body: + payload: + password: "myWeakPassword123!" + opendistro_security_roles: [] + backend_roles: [] + attributes: {} + response: + status: 200 +chapters: + - synopsis: Get account details. + path: /_plugins/_security/api/account + method: GET + parameters: + format: json + response: + status: 200 +# TODO: following test can be changed to interact with test user once https://github.com/opensearch-project/opensearch-api-specification/issues/438 is implemented +# NOTE: this test assumes that admin password is set to `myStrongPassword123!`, please update this test to correct password. One more reason to have the above feature implemented to avoid this. + - synopsis: Change password. + path: /_plugins/_security/api/account + method: PUT + request_body: + payload: + current_password: "myStrongPassword123!" + password: "myWeakPassword123!" + response: + status: 200 +epilogues: + - path: /_plugins/_security/api/account + method: PUT + request_body: + payload: + current_password: "myWeakPassword123!" + password: "myStrongPassword123!" + response: + status: 200 + - path: /_plugins/_security/api/internalusers/{username} + method: DELETE + parameters: + username: test + status: [200, 404] \ No newline at end of file diff --git a/tests/security/with-api-prefix/action_groups.yaml b/tests/security/with-api-prefix/action_groups.yaml new file mode 100644 index 000000000..c552db5e9 --- /dev/null +++ b/tests/security/with-api-prefix/action_groups.yaml @@ -0,0 +1,6 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test action_groups endpoints. +prologues: +chapters: +epilogues: diff --git a/tests/security/with-api-prefix/allowlist.yaml b/tests/security/with-api-prefix/allowlist.yaml new file mode 100644 index 000000000..3856a4103 --- /dev/null +++ b/tests/security/with-api-prefix/allowlist.yaml @@ -0,0 +1,6 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test allowlist endpoints. +prologues: +chapters: +epilogues: diff --git a/tests/security/with-api-prefix/audit.yaml b/tests/security/with-api-prefix/audit.yaml new file mode 100644 index 000000000..0325d6467 --- /dev/null +++ b/tests/security/with-api-prefix/audit.yaml @@ -0,0 +1,6 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test audit endpoints. +prologues: +chapters: +epilogues: diff --git a/tests/security/with-api-prefix/authtoken.yaml b/tests/security/with-api-prefix/authtoken.yaml new file mode 100644 index 000000000..08558d587 --- /dev/null +++ b/tests/security/with-api-prefix/authtoken.yaml @@ -0,0 +1,6 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test authtoken endpoints. +prologues: +chapters: +epilogues: diff --git a/tests/security/with-api-prefix/cache.yaml b/tests/security/with-api-prefix/cache.yaml new file mode 100644 index 000000000..3600ab466 --- /dev/null +++ b/tests/security/with-api-prefix/cache.yaml @@ -0,0 +1,6 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test cache endpoint. +prologues: +chapters: +epilogues: diff --git a/tests/security/with-api-prefix/internal_users.yaml b/tests/security/with-api-prefix/internal_users.yaml new file mode 100644 index 000000000..bccbb9b76 --- /dev/null +++ b/tests/security/with-api-prefix/internal_users.yaml @@ -0,0 +1,6 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test internal users endpoints. +prologues: +chapters: +epilogues: diff --git a/tests/security/with-api-prefix/migrate.yaml b/tests/security/with-api-prefix/migrate.yaml new file mode 100644 index 000000000..4310e3982 --- /dev/null +++ b/tests/security/with-api-prefix/migrate.yaml @@ -0,0 +1,6 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test migrate endpoint. +prologues: +chapters: +epilogues: diff --git a/tests/security/with-api-prefix/nodesdn.yaml b/tests/security/with-api-prefix/nodesdn.yaml new file mode 100644 index 000000000..037497709 --- /dev/null +++ b/tests/security/with-api-prefix/nodesdn.yaml @@ -0,0 +1,6 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test nodesdn endpoints. +prologues: +chapters: +epilogues: diff --git a/tests/security/with-api-prefix/permissionsinfo.yaml b/tests/security/with-api-prefix/permissionsinfo.yaml new file mode 100644 index 000000000..c21e48d5e --- /dev/null +++ b/tests/security/with-api-prefix/permissionsinfo.yaml @@ -0,0 +1,6 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test permissionsinfo endpoint. +prologues: +chapters: +epilogues: diff --git a/tests/security/with-api-prefix/roles.yaml b/tests/security/with-api-prefix/roles.yaml new file mode 100644 index 000000000..3cd6e26c6 --- /dev/null +++ b/tests/security/with-api-prefix/roles.yaml @@ -0,0 +1,6 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test roles endpoints. +prologues: +chapters: +epilogues: diff --git a/tests/security/with-api-prefix/rolesmapping.yaml b/tests/security/with-api-prefix/rolesmapping.yaml new file mode 100644 index 000000000..857a1061c --- /dev/null +++ b/tests/security/with-api-prefix/rolesmapping.yaml @@ -0,0 +1,6 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test rolesmapping endpoint. +prologues: +chapters: +epilogues: diff --git a/tests/security/with-api-prefix/securityconfig.yaml b/tests/security/with-api-prefix/securityconfig.yaml new file mode 100644 index 000000000..6fb9e86ee --- /dev/null +++ b/tests/security/with-api-prefix/securityconfig.yaml @@ -0,0 +1,6 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test securityconfig endpoints. +prologues: +chapters: +epilogues: diff --git a/tests/security/with-api-prefix/ssl.yaml b/tests/security/with-api-prefix/ssl.yaml new file mode 100644 index 000000000..eea66942f --- /dev/null +++ b/tests/security/with-api-prefix/ssl.yaml @@ -0,0 +1,6 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test ssl endpoints. +prologues: +chapters: +epilogues: diff --git a/tests/security/with-api-prefix/tenancy.yaml b/tests/security/with-api-prefix/tenancy.yaml new file mode 100644 index 000000000..573421e81 --- /dev/null +++ b/tests/security/with-api-prefix/tenancy.yaml @@ -0,0 +1,6 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test tenancy endpoint. +prologues: +chapters: +epilogues: diff --git a/tests/security/with-api-prefix/tenants.yaml b/tests/security/with-api-prefix/tenants.yaml new file mode 100644 index 000000000..f883291ea --- /dev/null +++ b/tests/security/with-api-prefix/tenants.yaml @@ -0,0 +1,6 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test tenants endpoints. +prologues: +chapters: +epilogues: diff --git a/tests/security/with-api-prefix/validate.yaml b/tests/security/with-api-prefix/validate.yaml new file mode 100644 index 000000000..4a2134ad3 --- /dev/null +++ b/tests/security/with-api-prefix/validate.yaml @@ -0,0 +1,6 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test validate endpoint. +prologues: +chapters: +epilogues: diff --git a/tests/security/without-api-prefix/authinfo.yaml b/tests/security/without-api-prefix/authinfo.yaml new file mode 100644 index 000000000..4b9ad67a7 --- /dev/null +++ b/tests/security/without-api-prefix/authinfo.yaml @@ -0,0 +1,20 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test authinfo endpoint. +chapters: + - synopsis: Get auth info. + path: /_plugins/_security/authinfo + method: GET + parameters: + auth_type: basic + verbose: false + response: + status: [200, 500] + - synopsis: Get auth info via POST. + path: /_plugins/_security/authinfo + method: POST + parameters: + auth_type: basic + verbose: false + response: + status: [200, 500] diff --git a/tests/security/without-api-prefix/dashboardsinfo.yaml b/tests/security/without-api-prefix/dashboardsinfo.yaml new file mode 100644 index 000000000..4fde724ad --- /dev/null +++ b/tests/security/without-api-prefix/dashboardsinfo.yaml @@ -0,0 +1,14 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test dashboardsinfo endpoint. +chapters: + - synopsis: Get dashboards info. + path: /_plugins/_security/dashboardsinfo + method: GET + response: + status: [200, 500] + - synopsis: Get dashboards info via POST. + path: /_plugins/_security/dashboardsinfo + method: POST + response: + status: [200, 500] diff --git a/tests/security/without-api-prefix/health.yaml b/tests/security/without-api-prefix/health.yaml new file mode 100644 index 000000000..8178981fa --- /dev/null +++ b/tests/security/without-api-prefix/health.yaml @@ -0,0 +1,18 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test health endpoint. +chapters: + - synopsis: Get security health info. + path: /_plugins/_security/health + method: GET + parameters: + mode: strict + response: + status: 200 + - synopsis: Get security health info via POST. + path: /_plugins/_security/health + method: POST + parameters: + mode: strict + response: + status: 200 \ No newline at end of file diff --git a/tests/security/without-api-prefix/sslinfo.yaml b/tests/security/without-api-prefix/sslinfo.yaml new file mode 100644 index 000000000..ab5e51b0d --- /dev/null +++ b/tests/security/without-api-prefix/sslinfo.yaml @@ -0,0 +1,11 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test sslinfo endpoint. +chapters: + - synopsis: Get ssl info. + path: /_opendistro/_security/sslinfo + method: GET + parameters: + show_dn: false + response: + status: [200, 500] diff --git a/tests/security/without-api-prefix/tenantinfo.yaml b/tests/security/without-api-prefix/tenantinfo.yaml new file mode 100644 index 000000000..a10350fb0 --- /dev/null +++ b/tests/security/without-api-prefix/tenantinfo.yaml @@ -0,0 +1,15 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test tenantinfo endpoint. +chapters: + - synopsis: Get tenant info. + path: /_plugins/_security/tenantinfo + method: GET + response: + status: [200, 500] + - synopsis: Get tenant info via POST. + path: /_plugins/_security/tenantinfo + method: POST + response: + status: [200, 500] + \ No newline at end of file diff --git a/tests/security/without-api-prefix/upgrade.yaml b/tests/security/without-api-prefix/upgrade.yaml new file mode 100644 index 000000000..485ab217c --- /dev/null +++ b/tests/security/without-api-prefix/upgrade.yaml @@ -0,0 +1,19 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test upgrade eligibility endpoints. +chapters: + - synopsis: Check whether an upgrade can be performed. + version: '>= 2.14' + path: /_plugins/_security/_upgrade_check + method: GET + response: + status: 200 + - synopsis: Perform the upgrade. + version: '>= 2.14' + path: /_plugins/_security/_upgrade_perform + method: POST + request_body: + payload: + config: ["roles"] + response: + status: 200 \ No newline at end of file diff --git a/tests/security/without-api-prefix/whoami.yaml b/tests/security/without-api-prefix/whoami.yaml new file mode 100644 index 000000000..70b81ce82 --- /dev/null +++ b/tests/security/without-api-prefix/whoami.yaml @@ -0,0 +1,20 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test whoami endpoints. +chapters: + - synopsis: Get current user info. + path: /_plugins/_security/whoami + method: GET + response: + status: [200, 500] + - synopsis: Get current user info via POST. + path: /_plugins/_security/whoami + method: POST + response: + status: [200, 500] + - synopsis: Get current user info from protected endpoint. + version: '>= 2.11' + path: /_plugins/_security/whoamiprotected + method: GET + response: + status: [200, 500]