Skip to content

Commit c1f8d2e

Browse files
sentinel_one: Add configuration option to filter results by Site IDs, fix error handling for CEL, improve UI layout, and readme document
Add a configuration option to filter results by Site IDs for the application data stream. Fix error handling for CEL code in the application risk data stream. Update the configuration parameter descriptions and the README document.
1 parent 34df8c0 commit c1f8d2e

File tree

13 files changed

+104
-33
lines changed

13 files changed

+104
-33
lines changed

packages/sentinel_one/_dev/build/docs/README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,28 @@ To collect data from SentinelOne APIs, you must have an API token. To create an
2525
![SentinelOne generate MFA Code ](../img/sentinel-one-mfa-code.png)
2626
6. You will see the API token on the screen.
2727

28-
## Note
28+
**Permissions Required for the Role Attached to the User**
29+
30+
| **Data Stream** | **Permission** |
31+
|-------------------|---------------------------------|
32+
| Activity | Activity -> view |
33+
| Agent | Endpoints -> view |
34+
| Alert | STAR Rule Alerts -> view |
35+
| Application | Applications -> view |
36+
| Application Risk | Applications -> viewRisks |
37+
| Group | Groups -> view |
38+
| Threat | Threats -> view |
2939

30-
The API token generated by the user is time-limited. To rotate a new token, log in with the dedicated admin account.
40+
## Note
3141

3242
The **alert** data stream depends on STAR Custom Rules. STAR Custom Rules are supported in Cloud environments, but are not supported in on-premises environments. Because of this, the **alert** data stream is not supported in on-premises environments.
3343

44+
## Troubleshooting
45+
46+
- The API token generated by the user is time-limited. The user must reconfigure a new API token before it expires.
47+
- For console users, the default expiration time limit is 30 days.
48+
- For service users, the expiration time limit is the same as the duration specified while generating the API token.
49+
3450
## Alert severity mapping
3551

3652
The values used in `event.severity` are consistent with Elastic Detection Rules.

packages/sentinel_one/changelog.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
# newer versions go on top
2+
- version: "1.41.0"
3+
changes:
4+
- description: Add configuration option to filter results by Site IDs in the application data stream, improve UI layout, and readme document.
5+
type: enhancement
6+
link: https://github.com/elastic/integrations/pull/15446
7+
- description: 'Enhanced error handling in the CEL program for API calls to prevent "no such key: batch_size" errors in the application risk data stream.'
8+
type: bugfix
9+
link: https://github.com/elastic/integrations/pull/15446
210
- version: "1.40.0"
311
changes:
412
- description: Update deprecated visualization charts and implemented best practices in the existing dashboards.

packages/sentinel_one/data_stream/application/_dev/test/policy/test-all.expected

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ inputs:
3232
state.url.trim_right("/") + "/web/api/v2.1/application-management/inventory?" + {
3333
"skipCount": ["true"],
3434
"limit": [string(state.batch_size)],
35+
?"siteIds": state.?site_ids.optMap(v, [string(v)]),
3536
?"cursor": state.?next_page.token.optMap(v, [v]),
3637
}.format_query()
3738
).with(
@@ -56,7 +57,7 @@ inputs:
5657
"error": {
5758
"code": string(resp.StatusCode),
5859
"id": string(resp.Status),
59-
"message": "GET " + state.url.trim_right("/") + "/web/api/v2.1/application-management/inventory" + (
60+
"message": "GET " + state.url.trim_right("/") + "/web/api/v2.1/application-management/inventory: " + (
6061
(size(resp.Body) != 0) ?
6162
string(resp.Body)
6263
:
@@ -81,6 +82,7 @@ inputs:
8182
"applicationName": [string(state.worklist.data[0].applicationName)],
8283
"applicationVendor": [string(state.worklist.data[0].applicationVendor)],
8384
"limit": [string(state.batch_size)],
85+
?"siteIds": state.?site_ids.optMap(v, [string(v)]),
8486
?"cursor": state.?next_chain.token.optMap(v, [v]),
8587
}.format_query()
8688
).with(
@@ -115,7 +117,7 @@ inputs:
115117
"error": {
116118
"code": string(resp.StatusCode),
117119
"id": string(resp.Status),
118-
"message": "GET " + state.url.trim_right("/") + "/web/api/v2.1/application-management/inventory/endpoints" + (
120+
"message": "GET " + state.url.trim_right("/") + "/web/api/v2.1/application-management/inventory/endpoints: " + (
119121
(size(resp.Body) != 0) ?
120122
string(resp.Body)
121123
:
@@ -226,6 +228,7 @@ inputs:
226228
state:
227229
api_token: ${SECRET_0}
228230
batch_size: 100
231+
site_ids: "123"
229232
tags:
230233
- preserve_original_event
231234
- preserve_duplicate_custom_fields

packages/sentinel_one/data_stream/application/_dev/test/policy/test-all.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ data_stream:
8585
vars:
8686
interval: 30s
8787
batch_size: 100
88+
site_ids: 123
8889
tags:
8990
- forwarded
9091
- sentinel_one-application

packages/sentinel_one/data_stream/application/_dev/test/policy/test-default.expected

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ inputs:
2121
state.url.trim_right("/") + "/web/api/v2.1/application-management/inventory?" + {
2222
"skipCount": ["true"],
2323
"limit": [string(state.batch_size)],
24+
?"siteIds": state.?site_ids.optMap(v, [string(v)]),
2425
?"cursor": state.?next_page.token.optMap(v, [v]),
2526
}.format_query()
2627
).with(
@@ -45,7 +46,7 @@ inputs:
4546
"error": {
4647
"code": string(resp.StatusCode),
4748
"id": string(resp.Status),
48-
"message": "GET " + state.url.trim_right("/") + "/web/api/v2.1/application-management/inventory" + (
49+
"message": "GET " + state.url.trim_right("/") + "/web/api/v2.1/application-management/inventory: " + (
4950
(size(resp.Body) != 0) ?
5051
string(resp.Body)
5152
:
@@ -70,6 +71,7 @@ inputs:
7071
"applicationName": [string(state.worklist.data[0].applicationName)],
7172
"applicationVendor": [string(state.worklist.data[0].applicationVendor)],
7273
"limit": [string(state.batch_size)],
74+
?"siteIds": state.?site_ids.optMap(v, [string(v)]),
7375
?"cursor": state.?next_chain.token.optMap(v, [v]),
7476
}.format_query()
7577
).with(
@@ -104,7 +106,7 @@ inputs:
104106
"error": {
105107
"code": string(resp.StatusCode),
106108
"id": string(resp.Status),
107-
"message": "GET " + state.url.trim_right("/") + "/web/api/v2.1/application-management/inventory/endpoints" + (
109+
"message": "GET " + state.url.trim_right("/") + "/web/api/v2.1/application-management/inventory/endpoints: " + (
108110
(size(resp.Body) != 0) ?
109111
string(resp.Body)
110112
:

packages/sentinel_one/data_stream/application/agent/stream/cel.yml.hbs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ resource.url: {{url}}
1717
state:
1818
api_token: {{api_token}}
1919
batch_size: {{batch_size}}
20+
{{#if site_ids }}
21+
site_ids: !!str {{site_ids}}
22+
{{/if}}
2023
redact:
2124
fields:
2225
- api_token
@@ -31,6 +34,7 @@ program: |-
3134
state.url.trim_right("/") + "/web/api/v2.1/application-management/inventory?" + {
3235
"skipCount": ["true"],
3336
"limit": [string(state.batch_size)],
37+
?"siteIds": state.?site_ids.optMap(v, [string(v)]),
3438
?"cursor": state.?next_page.token.optMap(v, [v]),
3539
}.format_query()
3640
).with(
@@ -55,7 +59,7 @@ program: |-
5559
"error": {
5660
"code": string(resp.StatusCode),
5761
"id": string(resp.Status),
58-
"message": "GET " + state.url.trim_right("/") + "/web/api/v2.1/application-management/inventory" + (
62+
"message": "GET " + state.url.trim_right("/") + "/web/api/v2.1/application-management/inventory: " + (
5963
(size(resp.Body) != 0) ?
6064
string(resp.Body)
6165
:
@@ -80,6 +84,7 @@ program: |-
8084
"applicationName": [string(state.worklist.data[0].applicationName)],
8185
"applicationVendor": [string(state.worklist.data[0].applicationVendor)],
8286
"limit": [string(state.batch_size)],
87+
?"siteIds": state.?site_ids.optMap(v, [string(v)]),
8388
?"cursor": state.?next_chain.token.optMap(v, [v]),
8489
}.format_query()
8590
).with(
@@ -114,7 +119,7 @@ program: |-
114119
"error": {
115120
"code": string(resp.StatusCode),
116121
"id": string(resp.Status),
117-
"message": "GET " + state.url.trim_right("/") + "/web/api/v2.1/application-management/inventory/endpoints" + (
122+
"message": "GET " + state.url.trim_right("/") + "/web/api/v2.1/application-management/inventory/endpoints: " + (
118123
(size(resp.Body) != 0) ?
119124
string(resp.Body)
120125
:

packages/sentinel_one/data_stream/application/manifest.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,21 @@ streams:
2323
multi: false
2424
required: true
2525
show_user: false
26+
- name: site_ids
27+
type: text
28+
title: Site IDs
29+
multi: false
30+
required: false
31+
show_user: false
32+
description: Comma separated list of Site IDs to filter by. Example - "225494730938493804,225494730938493915".
33+
- name: http_client_timeout
34+
type: text
35+
title: HTTP Client Timeout
36+
description: Duration before declaring that the HTTP client connection has timed out. Supported time units are ns, us, ms, s, m, h.
37+
multi: false
38+
required: true
39+
show_user: false
40+
default: 30s
2641
- name: enable_request_tracer
2742
type: bool
2843
title: Enable request tracing
@@ -55,14 +70,6 @@ streams:
5570
description: Preserve sentinel_one.application fields that were copied to Elastic Common Schema (ECS) fields.
5671
type: bool
5772
multi: false
58-
- name: http_client_timeout
59-
type: text
60-
title: HTTP Client Timeout
61-
description: Duration before declaring that the HTTP client connection has timed out. Supported time units are ns, us, ms, s, m, h.
62-
multi: false
63-
required: true
64-
show_user: false
65-
default: 30s
6673
- name: processors
6774
type: yaml
6875
title: Processors

packages/sentinel_one/data_stream/application_risk/_dev/test/policy/test-all.expected

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ inputs:
2525
request("GET",
2626
state.url.trim_right("/") + "/web/api/v2.1/application-management/risks?" + {
2727
?"cursor": state.?next.page.optMap(v, [v]),
28-
?"siteids": state.?site_ids.orValue(null) != null ? optional.of([string(state.site_ids)]) : optional.none(),
28+
?"siteIds": state.?site_ids.optMap(v, [string(v)]),
2929
"limit": [string(state.batch_size)],
3030
}.format_query()
3131
).with({
@@ -39,7 +39,7 @@ inputs:
3939
}),
4040
"api_token": state.api_token,
4141
"batch_size": state.batch_size,
42-
?"site_ids": state.?site_ids.orValue(null) != null ? optional.of(state.site_ids) : optional.none(),
42+
?"site_ids": state.?site_ids,
4343
"next": {
4444
?"page": body.?pagination.?nextCursor.orValue(null) != null ? optional.of(body.pagination.nextCursor) : optional.none(),
4545
},
@@ -60,6 +60,9 @@ inputs:
6060
},
6161
},
6262
"want_more": false,
63+
"api_token": state.api_token,
64+
"batch_size": state.batch_size,
65+
?"site_ids": state.?site_ids,
6366
}
6467
)
6568
publisher_pipeline.disable_host: true
@@ -155,7 +158,7 @@ inputs:
155158
state:
156159
api_token: ${SECRET_0}
157160
batch_size: 100
158-
site_ids: null
161+
site_ids: "123"
159162
tags:
160163
- preserve_original_event
161164
- preserve_duplicate_custom_fields

packages/sentinel_one/data_stream/application_risk/_dev/test/policy/test-all.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ data_stream:
8585
vars:
8686
interval: 30s
8787
batch_size: 100
88+
site_ids: 123
8889
tags:
8990
- forwarded
9091
- sentinel_one-application_risk

packages/sentinel_one/data_stream/application_risk/_dev/test/policy/test-default.expected

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ inputs:
1414
request("GET",
1515
state.url.trim_right("/") + "/web/api/v2.1/application-management/risks?" + {
1616
?"cursor": state.?next.page.optMap(v, [v]),
17-
?"siteids": state.?site_ids.orValue(null) != null ? optional.of([string(state.site_ids)]) : optional.none(),
17+
?"siteIds": state.?site_ids.optMap(v, [string(v)]),
1818
"limit": [string(state.batch_size)],
1919
}.format_query()
2020
).with({
@@ -28,7 +28,7 @@ inputs:
2828
}),
2929
"api_token": state.api_token,
3030
"batch_size": state.batch_size,
31-
?"site_ids": state.?site_ids.orValue(null) != null ? optional.of(state.site_ids) : optional.none(),
31+
?"site_ids": state.?site_ids,
3232
"next": {
3333
?"page": body.?pagination.?nextCursor.orValue(null) != null ? optional.of(body.pagination.nextCursor) : optional.none(),
3434
},
@@ -49,6 +49,9 @@ inputs:
4949
},
5050
},
5151
"want_more": false,
52+
"api_token": state.api_token,
53+
"batch_size": state.batch_size,
54+
?"site_ids": state.?site_ids,
5255
}
5356
)
5457
publisher_pipeline.disable_host: true
@@ -65,7 +68,6 @@ inputs:
6568
state:
6669
api_token: ${SECRET_0}
6770
batch_size: 1000
68-
site_ids: null
6971
tags:
7072
- forwarded
7173
- sentinel_one-application_risk

0 commit comments

Comments
 (0)