Skip to content

Commit a1856fe

Browse files
authored
Add remaining security API examples (#3546)
1 parent 75944b5 commit a1856fe

File tree

94 files changed

+1634
-495
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+1634
-495
lines changed

output/openapi/elasticsearch-openapi.json

Lines changed: 177 additions & 96 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/openapi/elasticsearch-serverless-openapi.json

Lines changed: 55 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/schema/schema.json

Lines changed: 318 additions & 241 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

specification/_doc_ids/table.csv

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,7 @@ reroute-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branc
490490
render-search-template-api,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/render-search-template-api.html
491491
reset-transform,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/reset-transform.html
492492
restore-snapshot,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/snapshots-restore-snapshot.html
493-
sql-delete-async-api,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/delete-async-sql-search-api.html
494-
sql-clear-cursor-api,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/clear-sql-cursor-api.html
493+
role-restriction,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/role-restriction.html
495494
rollup-agg-limitations,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/rollup-agg-limitations.html
496495
rollup-delete-job,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/rollup-delete-job.html
497496
rollup-get-job,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/rollup-get-job.html
@@ -676,9 +675,14 @@ security-api-cross-cluster-key-update,https://www.elastic.co/guide/en/elasticsea
676675
security-api-update-key,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/security-api-update-api-key.html
677676
security-api-update-user-data,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/security-api-update-user-profile-data.html
678677
security-api-update-settings,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/security-api-update-settings.html
678+
security-application-privileges,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/security-privileges.html#application-privileges
679+
security-encrypt-http,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/security-basic-setup-https.html#encrypt-http-communication
679680
security-encrypt-internode,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/security-basic-setup.html#encrypt-internode-communication
680681
security-privileges,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/security-privileges.html
681682
security-saml-guide,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/saml-guide-stack.html
683+
security-settings-api-keys,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/security-settings.html#api-key-service-settings
684+
security-settings-hashing,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/security-settings.html#hashing-settings
685+
security-user-cache,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/controlling-user-cache.html
682686
service-accounts,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/service-accounts.html
683687
set-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/set-processor.html
684688
shape,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/shape.html
@@ -716,6 +720,8 @@ query-dsl-sparse-vector-query,https://www.elastic.co/guide/en/elasticsearch/refe
716720
split-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/split-processor.html
717721
sql-async-search-api,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/get-async-sql-search-api.html
718722
sql-async-status-api,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/get-async-sql-search-status-api.html
723+
sql-clear-cursor-api,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/clear-sql-cursor-api.html
724+
sql-delete-async-api,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/delete-async-sql-search-api.html
719725
sql-rest-columnar,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/sql-rest-columnar.html
720726
sql-rest-filtering,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/sql-rest-filtering.html
721727
sql-rest-format,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/sql-rest-format.html

specification/security/_types/Privileges.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ export enum RemoteClusterPrivilege {
216216
export class IndicesPrivileges {
217217
/**
218218
* The document fields that the owners of the role have read access to.
219-
* @doc_id field-and-document-access-control
219+
* @ext_doc_id field-and-document-access-control
220220
*/
221221
field_security?: FieldSecurity
222222
// We're using IndexName | IndexName[] instead of Indices in this file on purpose:
@@ -252,7 +252,7 @@ export class RemoteIndicesPrivileges {
252252
clusters: Names
253253
/**
254254
* The document fields that the owners of the role have read access to.
255-
* @doc_id field-and-document-access-control
255+
* @ext_doc_id field-and-document-access-control
256256
*/
257257
field_security?: FieldSecurity
258258
/**
@@ -292,7 +292,7 @@ export class RemoteClusterPrivileges {
292292
export class UserIndicesPrivileges {
293293
/**
294294
* The document fields that the owners of the role have read access to.
295-
* @doc_id field-and-document-access-control
295+
* @ext_doc_id field-and-document-access-control
296296
*/
297297
field_security?: FieldSecurity[]
298298
/**
@@ -429,7 +429,7 @@ export class ReplicationAccess {
429429
export class SearchAccess {
430430
/**
431431
* The document fields that the owners of the role have read access to.
432-
* @doc_id field-and-document-access-control
432+
* @ext_doc_id field-and-document-access-control
433433
*/
434434
field_security?: FieldSecurity
435435
/**

specification/security/_types/RoleDescriptor.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ export class RoleDescriptor {
4646
*/
4747
remote_indices?: RemoteIndicesPrivileges[]
4848
/**
49-
* A list of cluster permissions for remote clusters. Note - this is limited a subset of the cluster permissions.
49+
* A list of cluster permissions for remote clusters.
50+
* NOTE: This is limited a subset of the cluster permissions.
5051
* @availability stack since=8.15.0
5152
*/
5253
remote_cluster?: RemoteClusterPrivileges[]
@@ -64,8 +65,10 @@ export class RoleDescriptor {
6465
*/
6566
metadata?: Metadata
6667
/**
67-
* A list of users that the API keys can impersonate. *Note*: in Serverless, the run-as feature is disabled. For API compatibility, you can still specify an empty `run_as` field, but a non-empty list will be rejected.
68-
* @doc_id run-as-privilege
68+
* A list of users that the API keys can impersonate.
69+
* NOTE: In Elastic Cloud Serverless, the run-as feature is disabled.
70+
* For API compatibility, you can still specify an empty `run_as` field, but a non-empty list will be rejected.
71+
* @ext_doc_id run-as-privilege
6972
*/
7073
run_as?: string[]
7174
/**
@@ -95,7 +98,8 @@ export class RoleDescriptorRead implements OverloadOf<RoleDescriptor> {
9598
*/
9699
remote_indices?: RemoteIndicesPrivileges[]
97100
/**
98-
* A list of cluster permissions for remote clusters. Note - this is limited a subset of the cluster permissions.
101+
* A list of cluster permissions for remote clusters.
102+
* NOTE: This is limited a subset of the cluster permissions.
99103
* @availability stack since=8.15.0
100104
*/
101105
remote_cluster?: RemoteClusterPrivileges[]
@@ -113,21 +117,26 @@ export class RoleDescriptorRead implements OverloadOf<RoleDescriptor> {
113117
metadata?: Metadata
114118
/**
115119
* A list of users that the API keys can impersonate.
116-
* @doc_id run-as-privilege
120+
* @ext_doc_id run-as-privilege
117121
*/
118122
run_as?: string[]
119123
/**
120-
* Optional description of the role descriptor
124+
* An optional description of the role descriptor.
121125
*/
122126
description?: string
123127
/**
124-
* Restriction for when the role descriptor is allowed to be effective.
128+
* A restriction for when the role descriptor is allowed to be effective.
129+
* @ext_doc_id role-restriction
125130
*/
126131
restriction?: Restriction
127132
transient_metadata?: Dictionary<string, UserDefinedValue>
128133
}
129134

130135
export class Restriction {
136+
/**
137+
* A list of workflows to which the API key is restricted.
138+
* NOTE: In order to use a role restriction, an API key must be created with a single role descriptor.
139+
*/
131140
workflows: RestrictionWorkflow[]
132141
}
133142

specification/security/clear_cached_privileges/SecurityClearCachedPrivilegesRequest.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ export interface Request extends RequestBase {
3939
}
4040
]
4141
path_parts: {
42+
/**
43+
* A comma-separated list of applications.
44+
* To clear all applications, use an asterism (`*`).
45+
* It does not support other wildcard patterns.
46+
*/
4247
application: Name
4348
}
4449
}

specification/security/clear_cached_realms/SecurityClearCachedRealmsRequest.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,17 @@ import { Names } from '@_types/common'
2323
/**
2424
* Clear the user cache.
2525
*
26-
* Evict users from the user cache. You can completely clear the cache or evict specific users.
26+
* Evict users from the user cache.
27+
* You can completely clear the cache or evict specific users.
28+
*
29+
* User credentials are cached in memory on each node to avoid connecting to a remote authentication service or hitting the disk for every incoming request.
30+
* There are realm settings that you can use to configure the user cache.
31+
* For more information, refer to the documentation about controlling the user cache.
2732
* @rest_spec_name security.clear_cached_realms
2833
* @availability stack stability=stable
2934
* @availability serverless stability=stable visibility=private
3035
* @doc_id security-api-clear-cache
36+
* @ext_doc_id security-user-cache
3137
*/
3238
export interface Request extends RequestBase {
3339
urls: [
@@ -37,9 +43,18 @@ export interface Request extends RequestBase {
3743
}
3844
]
3945
path_parts: {
46+
/**
47+
* A comma-separated list of realms.
48+
* To clear all realms, use an asterisk (`*`).
49+
* It does not support other wildcard patterns.
50+
*/
4051
realms: Names
4152
}
4253
query_parameters: {
54+
/**
55+
* A comma-separated list of the users to clear from the cache.
56+
* If you do not specify this parameter, the API evicts all users from the user cache.
57+
*/
4358
usernames?: string[]
4459
}
4560
}

specification/security/clear_cached_roles/ClearCachedRolesRequest.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ export interface Request extends RequestBase {
3838
}
3939
]
4040
path_parts: {
41+
/**
42+
* A comma-separated list of roles to evict from the role cache.
43+
* To evict all roles, use an asterisk (`*`).
44+
* It does not support other wildcard patterns.
45+
*/
4146
name: Names
4247
}
4348
}

specification/security/clear_cached_service_tokens/ClearCachedServiceTokensRequest.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ import { Names, Namespace, Service } from '@_types/common'
2424
* Clear service account token caches.
2525
*
2626
* Evict a subset of all entries from the service account token caches.
27+
* Two separate caches exist for service account tokens: one cache for tokens backed by the `service_tokens` file, and another for tokens backed by the `.security` index.
28+
* This API clears matching entries from both caches.
29+
*
30+
* The cache for service account tokens backed by the `.security` index is cleared automatically on state changes of the security index.
31+
* The cache for tokens backed by the `service_tokens` file is cleared automatically on file changes.
2732
* @rest_spec_name security.clear_cached_service_tokens
2833
* @availability stack stability=stable
2934
* @availability serverless stability=stable visibility=private
@@ -39,8 +44,15 @@ export interface Request extends RequestBase {
3944
}
4045
]
4146
path_parts: {
47+
/** The namespace, which is a top-level grouping of service accounts. */
4248
namespace: Namespace
49+
/** The name of the service, which must be unique within its namespace. */
4350
service: Service
51+
/**
52+
* A comma-separated list of token names to evict from the service account token caches.
53+
* Use a wildcard (`*`) to evict all tokens that belong to a service account.
54+
* It does not support other wildcard patterns.
55+
*/
4456
name: Names
4557
}
4658
}

specification/security/create_api_key/SecurityCreateApiKeyRequest.ts

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,23 @@ import { Duration } from '@_types/Time'
2727
* Create an API key.
2828
*
2929
* Create an API key for access without requiring basic authentication.
30+
*
31+
* IMPORTANT: If the credential that is used to authenticate this request is an API key, the derived API key cannot have any privileges.
32+
* If you specify privileges, the API returns an error.
33+
*
3034
* A successful request returns a JSON structure that contains the API key, its unique id, and its name.
3135
* If applicable, it also returns expiration information for the API key in milliseconds.
36+
*
3237
* NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys.
3338
*
39+
* The API keys are created by the Elasticsearch API key service, which is automatically enabled.
40+
* To configure or turn off the API key service, refer to API key service setting documentation.
3441
* @rest_spec_name security.create_api_key
3542
* @availability stack since=6.7.0 stability=stable
3643
* @availability serverless stability=stable visibility=public
3744
* @cluster_privileges manage_own_api_key
3845
* @doc_id security-api-create-api-key
46+
* @ext_doc_id security-settings-api-keys
3947
*/
4048
export interface Request extends RequestBase {
4149
urls: [
@@ -48,13 +56,24 @@ export interface Request extends RequestBase {
4856
refresh?: Refresh
4957
}
5058
body: {
51-
/** Expiration time for the API key. By default, API keys never expire. */
59+
/**
60+
* The expiration time for the API key.
61+
* By default, API keys never expire.
62+
*/
5263
expiration?: Duration
53-
/** Specifies the name for this API key. */
64+
/** A name for the API key. */
5465
name?: Name
5566
/**
56-
* An array of role descriptors for this API key. This parameter is optional. When it is not specified or is an empty array, then the API key will have a point in time snapshot of permissions of the authenticated user. If you supply role descriptors then the resultant permissions would be an intersection of API keys permissions and authenticated user’s permissions thereby limiting the access scope for API keys. The structure of role descriptor is the same as the request for create role API. For more details, see create or update roles API.
57-
* @doc_id security-api-put-role
67+
* An array of role descriptors for this API key.
68+
* When it is not specified or it is an empty array, the API key will have a point in time snapshot of permissions of the authenticated user.
69+
* If you supply role descriptors, the resultant permissions are an intersection of API keys permissions and the authenticated user's permissions thereby limiting the access scope for API keys.
70+
* The structure of role descriptor is the same as the request for the create role API.
71+
* For more details, refer to the create or update roles API.
72+
*
73+
* NOTE: Due to the way in which this permission intersection is calculated, it is not possible to create an API key that is a child of another API key, unless the derived key is created without any privileges.
74+
* In this case, you must explicitly specify a role descriptor with no privileges.
75+
* The derived API key can be used for authentication; it will not have authority to call Elasticsearch APIs.
76+
* @ext_doc_id security-api-put-role
5877
*/
5978
role_descriptors?: Dictionary<string, RoleDescriptor>
6079
/**

specification/security/create_service_token/CreateServiceTokenRequest.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ import { Name, Namespace, Refresh, Service } from '@_types/common'
2424
* Create a service account token.
2525
*
2626
* Create a service accounts token for access without requiring basic authentication.
27+
*
28+
* NOTE: Service account tokens never expire.
29+
* You must actively delete them if they are no longer needed.
2730
* @rest_spec_name security.create_service_token
2831
* @availability stack stability=stable
2932
* @availability serverless stability=stable visibility=private
@@ -43,8 +46,24 @@ export interface Request extends RequestBase {
4346
}
4447
]
4548
path_parts: {
49+
/**
50+
* The name of the namespace, which is a top-level grouping of service accounts.
51+
*/
4652
namespace: Namespace
53+
/**
54+
* The name of the service.
55+
*/
4756
service: Service
57+
/**
58+
* The name for the service account token.
59+
* If omitted, a random name will be generated.
60+
*
61+
* Token names must be at least one and no more than 256 characters.
62+
* They can contain alphanumeric characters (a-z, A-Z, 0-9), dashes (`-`), and underscores (`_`), but cannot begin with an underscore.
63+
*
64+
* NOTE: Token names must be unique in the context of the associated service account.
65+
* They must also be globally unique with their fully qualified names, which are comprised of the service account principal and token name, such as `<namespace>/<service>/<token-name>`.
66+
*/
4867
name?: Name
4968
}
5069
query_parameters: {

specification/security/create_service_token/CreateServiceTokenResponse.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
import { Token } from './types'
2121

2222
export class Response {
23+
/**
24+
* A successful create service account token API call returns a JSON structure that contains the service account token, its name, and its secret value.
25+
*/
2326
body: {
2427
created: boolean
2528
token: Token
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
# summary:
22
description: >
3-
A successful response from `POST /_security/user/jacknich`.
4-
When an existing user is updated, `created` is set to `false`.
3+
A successful response from `POST /_security/service/elastic/fleet-server/credential/token/token1`.
4+
The response includes the service account token, its name, and its secret value as a bearer token.
55
# type: response
66
# response_code:
77
value: |-
88
{
9-
"created": true
9+
"created": true,
10+
"token": {
11+
"name": "token1",
12+
"value": "AAEAAWVsYXN0aWM...vZmxlZXQtc2VydmVyL3Rva2VuMTo3TFdaSDZ"
13+
}
1014
}

specification/security/delegate_pki/SecurityDelegatePkiRequest.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { RequestBase } from '@_types/Base'
2121

2222
/**
2323
* Delegate PKI authentication.
24+
*
2425
* This API implements the exchange of an X509Certificate chain for an Elasticsearch access token.
2526
* The certificate chain is validated, according to RFC 5280, by sequentially considering the trust configuration of every installed PKI realm that has `delegation.enabled` set to `true`.
2627
* A successfully trusted client certificate is also subject to the validation of the subject distinguished name according to thw `username_pattern` of the respective realm.

specification/security/delete_privileges/SecurityDeletePrivilegesRequest.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,15 @@ import { Name, Names, Refresh } from '@_types/common'
2222

2323
/**
2424
* Delete application privileges.
25+
*
26+
* To use this API, you must have one of the following privileges:
27+
*
28+
* * The `manage_security` cluster privilege (or a greater privilege such as `all`).
29+
* * The "Manage Application Privileges" global privilege for the application being referenced in the request.
2530
* @rest_spec_name security.delete_privileges
2631
* @availability stack since=6.4.0 stability=stable
2732
* @availability serverless stability=stable visibility=private
33+
* @cluster_privileges manage_security
2834
* @doc_id security-api-delete-privilege
2935
* @ext_doc_id security-privileges
3036
*/
@@ -36,7 +42,14 @@ export interface Request extends RequestBase {
3642
}
3743
]
3844
path_parts: {
45+
/**
46+
* The name of the application.
47+
* Application privileges are always associated with exactly one application.
48+
*/
3949
application: Name
50+
/**
51+
* The name of the privilege.
52+
*/
4053
name: Names
4154
}
4255
query_parameters: {

specification/security/delete_privileges/examples/response/SecurityDeletePrivilegesResponseExample1.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# summary:
22
description: >
33
A successful response from `DELETE /_security/privilege/myapp/read`.
4+
If the privilege is successfully deleted, `found` is set to `true`.
45
# type: response
56
# response_code:
67
value: |-

0 commit comments

Comments
 (0)