Skip to content

Commit

Permalink
Fixes linter errors and complete payloads and request bodies
Browse files Browse the repository at this point in the history
Signed-off-by: Darshit Chanpura <[email protected]>
  • Loading branch information
DarshitChanpura committed Jul 23, 2024
1 parent f65a6cf commit a25b14f
Show file tree
Hide file tree
Showing 14 changed files with 171 additions and 141 deletions.
4 changes: 1 addition & 3 deletions spec/namespaces/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1062,9 +1062,7 @@ components:
content:
application/json:
schema:
type: array
items:
$ref: '../schemas/security._common.yaml#/components/schemas/MultiTenancyConfig'
$ref: '../schemas/security._common.yaml#/components/schemas/MultiTenancyConfig'
required: true
security.create_user:
content:
Expand Down
1 change: 0 additions & 1 deletion spec/schemas/security._common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,6 @@ components:
type: array
items:
type: string
description: Value in seconds.

OBOToken:
type: object
Expand Down
40 changes: 22 additions & 18 deletions tests/security/with-api-prefix/action_groups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ prologues:
action_group: test
request_body:
payload:
reserved:
hidden:
reserved: false
hidden: false
allowed_actions: []
type:
description:
static:
type: index
description: Test action group
static: false
status: 200
chapters:
- synopsis: Get action groups bulk.
Expand All @@ -26,10 +26,13 @@ chapters:
path: /_plugins/_security/api/actiongroups
method: PATCH
request_body:
payload:
op:
path:
value:
payload:
- op: add
path: /test
value:
allowed_actions: ['indices:admin/create', 'indices:admin/mapping/put']


response:
status: 200
- synopsis: Get action group.
Expand All @@ -46,12 +49,12 @@ chapters:
action_group: test2
request_body:
payload:
reserved:
hidden:
reserved: false
hidden: false
allowed_actions: []
type:
description:
static:
type: index
description: Test action group
static: false
response:
status: 200
- synopsis: Patch action group.
Expand All @@ -60,10 +63,11 @@ chapters:
parameters:
action_group: test2
request_body:
payload:
op:
path:
value:
payload:
- op: replace
path: /allowed_actions
value:
allowed_actions: ['indices:admin/create', 'indices:admin/mapping/put']
response:
status: 200
- synopsis: Delete action group.
Expand Down
13 changes: 7 additions & 6 deletions tests/security/with-api-prefix/allowlist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ chapters:
payload:
config:
enabled: true,
requests: {}
requests:
/_cat/nodes: [GET]
response:
status: 200
- synopsis: Get an allowlist.
Expand All @@ -22,9 +23,9 @@ chapters:
path: /_plugins/_security/api/allowlist
method: PATCH
request_body:
payload:
op:
path:
value:
status: 200
op: remove
path: /config/requests

response:
status: 200

52 changes: 30 additions & 22 deletions tests/security/with-api-prefix/audit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,37 @@ chapters:
method: PUT
request_body:
payload:
compliance:
enabled:
write_log_diffs:
enabled: true
audit:
ignore_users: []
ignore_requests: []
disabled_rest_categories:
- AUTHENTICATED
- GRANTED_PRIVILEGES

disabled_transport_categories:
- AUTHENTICATED
- GRANTED_PRIVILEGES

log_request_body: false
resolve_indices: false
resolve_bulk_requests: false
exclude_sensitive_headers: true
enable_transport: false
enable_rest: true

compliance:
enabled: true
write_log_diffs: false
read_watched_fields: {}
read_ignore_users: []
write_watched_indices: []
write_ignore_users: []
read_metadata_only:
write_metadata_only:
external_config:
internal_config:
enabled: true
audit:
ignore_users:
ignore_requests: []
disabled_rest_categories: []
disabled_transport_categories: []
log_request_body:
resolve_indices:
resolve_bulk_requests:
exclude_sensitive_headers:
enable_transport:
enable_rest:
read_metadata_only: true
write_metadata_only: true
external_config: false
internal_config: true

response:
status: 200
- synopsis: Get an audit config.
Expand All @@ -43,8 +51,8 @@ chapters:
method: PATCH
request_body:
payload:
op:
path:
value:
op: add
path: /config/enabled
value: 'true'
status: 200

17 changes: 9 additions & 8 deletions tests/security/with-api-prefix/internal_users.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@ chapters:
path: /_plugins/_security/api/internalusers
method: PATCH
request_body:
payload:
op:
path:
value:
payload:
- op: add
path: /test
value:
backend_roles: [admin]
response:
status: 200
- synopsis: Create internal user.
path: /_plugins/_security/api/internalusers/{username}
method: PUT
parameters:
username: test2
username: test
request_body:
payload:
password: myWeakPassword123!
Expand All @@ -45,9 +46,9 @@ chapters:
username: test
request_body:
payload:
op:
path:
value:
op: replace
path: /opendistro_security_roles
value: [ship_manager]
response:
status: 200
- synopsis: Delete internal user.
Expand Down
22 changes: 9 additions & 13 deletions tests/security/with-api-prefix/nodesdn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ chapters:
path: /_plugins/_security/api/nodesdn
method: PATCH
request_body:
payload:
op:
path:
value:
payload:
- op: replace
path: /cluster1/nodes_dn/0
value: ['']
response:
status: 200
- synopsis: Create distinguished name.
Expand All @@ -27,12 +27,8 @@ chapters:
cluster_name: test
request_body:
payload:
reserved:
hidden:
allowed_actions: []
type:
description:
static:
nodes_dn:
- CN=cluster3.example.com
response:
status: 200
- synopsis: Get distinguished name.
Expand All @@ -49,9 +45,9 @@ chapters:
cluster_name: test
request_body:
payload:
op:
path:
value:
op: replace
path: /test/nodes_dn/0
value: [CN=cluster2.example.com]
response:
status: 200
- synopsis: Delete distinguished name.
Expand Down
47 changes: 26 additions & 21 deletions tests/security/with-api-prefix/roles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ chapters:
path: /_plugins/_security/api/roles
method: PATCH
request_body:
payload:
op:
path:
value:
payload:
- op: replace
path: /test/index_permissions/0/fls
value: ['random*', ~random1]
- op: remove
path: /test/index_permissions/0/dls
response:
status: 200
- synopsis: Create role.
Expand All @@ -25,20 +27,22 @@ chapters:
role: test
request_body:
payload:
reserved:
hidden:
description:
cluster_permissions:
index_permissions:
index_patterns: []
dls:
fls: []
masked_fields: []
allowed_actions: []
tenant_permissions:
tenant_patterns: []
allowed_actions: []
static:
cluster_permissions:
- cluster_composite_ops
- indices_monitor
index_permissions:
- index_patterns:
- 'movies*'
dls: ''
fls: []
masked_fields: []
allowed_actions:
- read
tenant_permissions:
- tenant_patterns:
- human_resources
allowed_actions:
- kibana_all_read
response:
status: 200
- synopsis: Get role.
Expand All @@ -55,9 +59,10 @@ chapters:
role: test
request_body:
payload:
op:
path:
value:
op: replace
path: /index_permissions/0/fls
value: [random1, random2]

response:
status: 200
- synopsis: Delete role.
Expand Down
30 changes: 15 additions & 15 deletions tests/security/with-api-prefix/rolesmapping.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ chapters:
path: /_plugins/_security/api/rolesmapping
method: PATCH
request_body:
payload:
op:
path:
value:
payload:
- op: add
path: /all_access
value:
users: [test]
backend_roles: [admin]
response:
status: 200
- synopsis: Create rolesmapping.
Expand All @@ -25,13 +27,11 @@ chapters:
role: test
request_body:
payload:
hosts: []
users: []
reserved:
hidden:
backend_roles: []
and_backend_roles: []
description:
backend_roles: [captains]
hosts:
- '*.example.com'

users: [test]
response:
status: 200
- synopsis: Get rolesmapping.
Expand All @@ -47,10 +47,10 @@ chapters:
parameters:
role: test
request_body:
payload:
op:
path:
value:
payload:
- op: replace
path: /backend_roles
value: [admin]
response:
status: 200
- synopsis: Delete rolesmapping.
Expand Down
Loading

0 comments on commit a25b14f

Please sign in to comment.