Skip to content

Commit fb2eef1

Browse files
authored
updated Github Secret Scanning fingerprint with resolved_at (#3802)
* updated fingerprint with resolved_at * update readme * update version * update if conditions and readme * update readme
1 parent f1dede3 commit fb2eef1

File tree

7 files changed

+48
-33
lines changed

7 files changed

+48
-33
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ To use this integration, you must be an organization owner, and you must use an
2121

2222
The Code Scanning lets you retrieve all security vulnerabilities and coding errors from a repository setup using Github Advanced Security Code Scanning feature. See [About code scanning](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-code-scanning) for more details.
2323

24-
To use this integration, you must use an access token with the `security_events` scope for private repos or `public_repo` scope for public repos.
24+
To use this integration, GitHub Apps must have the `security_events` read permission.
25+
Or use a personal access token with the `security_events` scope for private repos or `public_repo` scope for public repos. See [List code scanning alerts](https://docs.github.com/en/enterprise-cloud@latest/rest/code-scanning#list-code-scanning-alerts-for-a-repository)
2526

2627
{{fields "code_scanning"}}
2728

@@ -32,7 +33,8 @@ To use this integration, you must use an access token with the `security_events`
3233

3334
The Github Secret Scanning lets you retrieve secret scanning for advanced security alerts from a repository setup using Github Advanced Security Secret Scanning feature. See [About Secret scanning](https://docs.github.com/en/enterprise-cloud@latest/code-security/secret-scanning/about-secret-scanning) for more details.
3435

35-
To use this integration, you must be an administrator for the repository or for the organization that owns the repository, and you must use a personal access token with the `repo` scope or `security_events` scope. For public repositories, you may instead use the public_repo scope.
36+
To use this integration, GitHub Apps must have the `secret_scanning_alerts` read permission.
37+
Or you must be an administrator for the repository or for the organization that owns the repository, and you must use a personal access token with the `repo` scope or `security_events` scope. For public repositories, you may instead use the `public_repo` scope. See [List secret scanning alerts](https://docs.github.com/en/enterprise-cloud@latest/rest/secret-scanning#list-secret-scanning-alerts-for-a-repository)
3638

3739
{{fields "secret_scanning"}}
3840

packages/github/changelog.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# newer versions go on top
2+
- version: "1.2.2"
3+
changes:
4+
- description: Update Github Secret Scanning fingerprint with resolved_at
5+
type: bugfix
6+
link: https://github.com/elastic/integrations/pull/3802
27
- version: "1.2.1"
38
changes:
49
- description: Update package name and description to align with standard wording

packages/github/data_stream/secret_scanning/_dev/test/pipeline/test-ghas-secret-scanning-json.log-expected.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"expected": [
33
{
4-
"@timestamp": "2020-11-06T18:48:51.000Z",
4+
"@timestamp": "2020-11-07T02:47:13.000Z",
55
"ecs": {
66
"version": "8.3.0"
77
},
88
"event": {
99
"action": "secret_scanning",
10-
"created": "2020-11-06T18:48:51.000Z",
10+
"created": "2020-11-06T18:48:51Z",
1111
"original": "{\"number\":2,\"created_at\":\"2020-11-06T18:48:51Z\",\"url\":\"https://api.github.com/repos/owner/private-repo/secret-scanning/alerts/2\",\"html_url\":\"https://github.com/owner/private-repo/security/secret-scanning/2\",\"locations_url\":\"https://api.github.com/repos/owner/private-repo/secret-scanning/alerts/2/locations\",\"state\":\"resolved\",\"resolution\":\"false_positive\",\"resolved_at\":\"2020-11-07T02:47:13Z\",\"resolved_by\":{\"login\":\"monalisa\",\"id\":2,\"node_id\":\"MDQ6VXNlcjI=\",\"avatar_url\":\"https://alambic.github.com/avatars/u/2?\",\"gravatar_id\":\"\",\"url\":\"https://api.github.com/users/monalisa\",\"html_url\":\"https://github.com/monalisa\",\"followers_url\":\"https://api.github.com/users/monalisa/followers\",\"following_url\":\"https://api.github.com/users/monalisa/following{/other_user}\",\"gists_url\":\"https://api.github.com/users/monalisa/gists{/gist_id}\",\"starred_url\":\"https://api.github.com/users/monalisa/starred{/owner}{/repo}\",\"subscriptions_url\":\"https://api.github.com/users/monalisa/subscriptions\",\"organizations_url\":\"https://api.github.com/users/monalisa/orgs\",\"repos_url\":\"https://api.github.com/users/monalisa/repos\",\"events_url\":\"https://api.github.com/users/monalisa/events{/privacy}\",\"received_events_url\":\"https://api.github.com/users/monalisa/received_events\",\"type\":\"User\",\"site_admin\":true},\"secret_type\":\"adafruit_io_key\",\"secret_type_display_name\":\"Adafruit IO Key\",\"secret\":\"aio_XXXXXXXXXXXXXXXXXXXXXXXXXXXX\",\"push_protection_bypassed_by\":{\"login\":\"monalisa\",\"id\":2,\"node_id\":\"MDQ6VXNlcjI=\",\"avatar_url\":\"https://alambic.github.com/avatars/u/2?\",\"gravatar_id\":\"\",\"url\":\"https://api.github.com/users/monalisa\",\"html_url\":\"https://github.com/monalisa\",\"followers_url\":\"https://api.github.com/users/monalisa/followers\",\"following_url\":\"https://api.github.com/users/monalisa/following{/other_user}\",\"gists_url\":\"https://api.github.com/users/monalisa/gists{/gist_id}\",\"starred_url\":\"https://api.github.com/users/monalisa/starred{/owner}{/repo}\",\"subscriptions_url\":\"https://api.github.com/users/monalisa/subscriptions\",\"organizations_url\":\"https://api.github.com/users/monalisa/orgs\",\"repos_url\":\"https://api.github.com/users/monalisa/repos\",\"events_url\":\"https://api.github.com/users/monalisa/events{/privacy}\",\"received_events_url\":\"https://api.github.com/users/monalisa/received_events\",\"type\":\"User\",\"site_admin\":true},\"push_protection_bypassed\":true,\"push_protection_bypassed_at\":\"2020-11-06T21:48:51Z\"}"
1212
},
1313
"github": {
@@ -56,7 +56,7 @@
5656
},
5757
"event": {
5858
"action": "secret_scanning",
59-
"created": "2020-11-06T18:18:30.000Z",
59+
"created": "2020-11-06T18:18:30Z",
6060
"original": "{\"number\":1,\"created_at\":\"2020-11-06T18:18:30Z\",\"url\":\"https://api.github.com/repos/owner/repo/secret-scanning/alerts/1\",\"html_url\":\"https://github.com/owner/repo/security/secret-scanning/1\",\"locations_url\":\"https://api.github.com/repos/owner/private-repo/secret-scanning/alerts/1/locations\",\"state\":\"open\",\"resolution\":null,\"resolved_at\":null,\"resolved_by\":null,\"secret_type\":\"mailchimp_api_key\",\"secret_type_display_name\":\"Mailchimp API Key\",\"secret\":\"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2\",\"push_protection_bypassed_by\":null,\"push_protection_bypassed\":false,\"push_protection_bypassed_at\":null }"
6161
},
6262
"github": {
@@ -84,7 +84,7 @@
8484
},
8585
"event": {
8686
"action": "secret_scanning",
87-
"created": "2022-07-07T12:56:24.000Z",
87+
"created": "2022-07-07T12:56:24Z",
8888
"original": "{\"number\":7,\"created_at\":\"2022-07-07T12:56:24Z\",\"updated_at\":\"2022-07-07T12:56:24Z\",\"url\":\"https://api.github.com/repos/kcreddy-org/dummy-pub-repo/secret-scanning/alerts/7\",\"html_url\":\"https://github.com/kcreddy-org/dummy-pub-repo/security/secret-scanning/7\",\"locations_url\":\"https://api.github.com/repos/kcreddy-org/dummy-pub-repo/secret-scanning/alerts/7/locations\",\"state\":\"open\",\"secret_type\":\"npm_access_token\",\"secret_type_display_name\":\"npm Access Token\",\"secret\":\"npm_A7WfAVLMKkzhcGGxyCH8kQiKgTJhtU1DsGCG\",\"resolution\":null,\"resolved_by\":null,\"resolved_at\":null,\"push_protection_bypassed\":true,\"push_protection_bypassed_by\":{\"login\":\"kcreddy\",\"id\":11301409,\"node_id\":\"MDQ6VXNlcjExMzAxNDA5\",\"avatar_url\":\"https://avatars.githubusercontent.com/u/11301409?v=4\",\"gravatar_id\":\"\",\"url\":\"https://api.github.com/users/kcreddy\",\"html_url\":\"https://github.com/kcreddy\",\"followers_url\":\"https://api.github.com/users/kcreddy/followers\",\"following_url\":\"https://api.github.com/users/kcreddy/following{/other_user}\",\"gists_url\":\"https://api.github.com/users/kcreddy/gists{/gist_id}\",\"starred_url\":\"https://api.github.com/users/kcreddy/starred{/owner}{/repo}\",\"subscriptions_url\":\"https://api.github.com/users/kcreddy/subscriptions\",\"organizations_url\":\"https://api.github.com/users/kcreddy/orgs\",\"repos_url\":\"https://api.github.com/users/kcreddy/repos\",\"events_url\":\"https://api.github.com/users/kcreddy/events{/privacy}\",\"received_events_url\":\"https://api.github.com/users/kcreddy/received_events\",\"type\":\"User\",\"site_admin\":false},\"push_protection_bypassed_at\":\"2022-07-07T12:55:53Z\" }"
8989
},
9090
"github": {
@@ -123,7 +123,7 @@
123123
},
124124
"event": {
125125
"action": "secret_scanning",
126-
"created": "2022-07-07T12:54:02.000Z",
126+
"created": "2022-07-07T12:54:02Z",
127127
"original": "{\"number\":6,\"created_at\":\"2022-07-07T12:54:02Z\",\"updated_at\":\"2022-07-07T12:54:02Z\",\"url\":\"https://api.github.com/repos/kcreddy-org/dummy-pub-repo/secret-scanning/alerts/6\",\"html_url\":\"https://github.com/kcreddy-org/dummy-pub-repo/security/secret-scanning/6\",\"locations_url\":\"https://api.github.com/repos/kcreddy-org/dummy-pub-repo/secret-scanning/alerts/6/locations\",\"state\":\"open\",\"secret_type\":\"atlassian_api_token\",\"secret_type_display_name\":\"Atlassian API Token\",\"secret\":\"DobuHe3ygkLnhf0efFG05A81\",\"resolution\":null,\"resolved_by\":null,\"resolved_at\":null,\"push_protection_bypassed\":false,\"push_protection_bypassed_by\":null,\"push_protection_bypassed_at\":null }"
128128
},
129129
"github": {
@@ -152,7 +152,7 @@
152152
},
153153
"event": {
154154
"action": "secret_scanning",
155-
"created": "2022-07-07T12:48:57.000Z",
155+
"created": "2022-07-07T12:48:57Z",
156156
"original": "{\"number\":5,\"created_at\":\"2022-07-07T12:48:57Z\",\"updated_at\":\"2022-07-07T12:48:57Z\",\"url\":\"https://api.github.com/repos/kcreddy-org/dummy-pub-repo/secret-scanning/alerts/5\",\"html_url\":\"https://github.com/kcreddy-org/dummy-pub-repo/security/secret-scanning/5\",\"locations_url\":\"https://api.github.com/repos/kcreddy-org/dummy-pub-repo/secret-scanning/alerts/5/locations\",\"state\":\"open\",\"secret_type\":\"atlassian_api_token\",\"secret_type_display_name\":\"Atlassian API Token\",\"secret\":\"SlHw1Z8v4PaQHIudLweh178G\",\"resolution\":null,\"resolved_by\":null,\"resolved_at\":null,\"push_protection_bypassed\":false,\"push_protection_bypassed_by\":null,\"push_protection_bypassed_at\":null }"
157157
},
158158
"github": {
@@ -181,7 +181,7 @@
181181
},
182182
"event": {
183183
"action": "secret_scanning",
184-
"created": "2022-07-07T10:52:40.000Z",
184+
"created": "2022-07-07T10:52:40Z",
185185
"original": "{\"number\":4,\"created_at\":\"2022-07-07T10:52:40Z\",\"updated_at\":\"2022-07-07T10:52:40Z\",\"url\":\"https://api.github.com/repos/kcreddy-org/dummy-pub-repo/secret-scanning/alerts/4\",\"html_url\":\"https://github.com/kcreddy-org/dummy-pub-repo/security/secret-scanning/4\",\"locations_url\":\"https://api.github.com/repos/kcreddy-org/dummy-pub-repo/secret-scanning/alerts/4/locations\",\"state\":\"open\",\"secret_type\":\"atlassian_api_token\",\"secret_type_display_name\":\"Atlassian API Token\",\"secret\":\"W7PwnhKGwHMzwc3nHukPDAG6\",\"resolution\":null,\"resolved_by\":null,\"resolved_at\":null,\"push_protection_bypassed\":false,\"push_protection_bypassed_by\":null,\"push_protection_bypassed_at\":null }"
186186
},
187187
"github": {
@@ -204,13 +204,13 @@
204204
]
205205
},
206206
{
207-
"@timestamp": "2022-07-07T10:52:40.000Z",
207+
"@timestamp": "2022-07-07T12:45:43.000Z",
208208
"ecs": {
209209
"version": "8.3.0"
210210
},
211211
"event": {
212212
"action": "secret_scanning",
213-
"created": "2022-07-07T10:52:40.000Z",
213+
"created": "2022-07-07T10:52:40Z",
214214
"original": "{\"number\":3,\"created_at\":\"2022-07-07T10:52:40Z\",\"updated_at\":\"2022-07-07T10:52:40Z\",\"url\":\"https://api.github.com/repos/kcreddy-org/dummy-pub-repo/secret-scanning/alerts/3\",\"html_url\":\"https://github.com/kcreddy-org/dummy-pub-repo/security/secret-scanning/3\",\"locations_url\":\"https://api.github.com/repos/kcreddy-org/dummy-pub-repo/secret-scanning/alerts/3/locations\",\"state\":\"resolved\",\"secret_type\":\"custom_pattern_2\",\"secret_type_display_name\":\"custom_pattern_2\",\"secret\":\"FAHf9g\",\"resolution\":\"wont_fix\",\"resolved_by\":{\"login\":\"kcreddy\",\"id\":11301409,\"node_id\":\"MDQ6VXNlcjExMzAxNDA5\",\"avatar_url\":\"https://avatars.githubusercontent.com/u/11301409?v=4\",\"gravatar_id\":\"\",\"url\":\"https://api.github.com/users/kcreddy\",\"html_url\":\"https://github.com/kcreddy\",\"followers_url\":\"https://api.github.com/users/kcreddy/followers\",\"following_url\":\"https://api.github.com/users/kcreddy/following{/other_user}\",\"gists_url\":\"https://api.github.com/users/kcreddy/gists{/gist_id}\",\"starred_url\":\"https://api.github.com/users/kcreddy/starred{/owner}{/repo}\",\"subscriptions_url\":\"https://api.github.com/users/kcreddy/subscriptions\",\"organizations_url\":\"https://api.github.com/users/kcreddy/orgs\",\"repos_url\":\"https://api.github.com/users/kcreddy/repos\",\"events_url\":\"https://api.github.com/users/kcreddy/events{/privacy}\",\"received_events_url\":\"https://api.github.com/users/kcreddy/received_events\",\"type\":\"User\",\"site_admin\":false},\"resolved_at\":\"2022-07-07T12:45:43Z\",\"push_protection_bypassed\":false,\"push_protection_bypassed_by\":null,\"push_protection_bypassed_at\":null }"
215215
},
216216
"github": {
@@ -250,7 +250,7 @@
250250
},
251251
"event": {
252252
"action": "secret_scanning",
253-
"created": "2022-07-07T09:47:47.000Z",
253+
"created": "2022-07-07T09:47:47Z",
254254
"original": "{\"number\":2,\"created_at\":\"2022-07-07T09:47:47Z\",\"updated_at\":\"2022-07-07T09:47:51Z\",\"url\":\"https://api.github.com/repos/kcreddy-org/dummy-pub-repo/secret-scanning/alerts/2\",\"html_url\":\"https://github.com/kcreddy-org/dummy-pub-repo/security/secret-scanning/2\",\"locations_url\":\"https://api.github.com/repos/kcreddy-org/dummy-pub-repo/secret-scanning/alerts/2/locations\",\"state\":\"open\",\"secret_type\":\"custom_pattern_1\",\"secret_type_display_name\":\"custom_pattern_1\",\"secret\":\"custom_54fH8\",\"resolution\":null,\"resolved_by\":null,\"resolved_at\":null,\"push_protection_bypassed\":false,\"push_protection_bypassed_by\":null,\"push_protection_bypassed_at\":null }"
255255
},
256256
"github": {
@@ -273,13 +273,13 @@
273273
]
274274
},
275275
{
276-
"@timestamp": "2022-07-07T09:23:23.000Z",
276+
"@timestamp": "2022-07-07T10:13:56.000Z",
277277
"ecs": {
278278
"version": "8.3.0"
279279
},
280280
"event": {
281281
"action": "secret_scanning",
282-
"created": "2022-07-07T09:23:23.000Z",
282+
"created": "2022-07-07T09:23:23Z",
283283
"original": "{\"number\":1,\"created_at\":\"2022-07-07T09:23:23Z\",\"updated_at\":\"2022-07-07T09:23:23Z\",\"url\":\"https://api.github.com/repos/kcreddy-org/dummy-pub-repo/secret-scanning/alerts/1\",\"html_url\":\"https://github.com/kcreddy-org/dummy-pub-repo/security/secret-scanning/1\",\"locations_url\":\"https://api.github.com/repos/kcreddy-org/dummy-pub-repo/secret-scanning/alerts/1/locations\",\"state\":\"resolved\",\"secret_type\":\"npm_access_token\",\"secret_type_display_name\":\"npm Access Token\",\"secret\":\"npm_2aZQ3QzGXlPbEgMMduZS1k0M1C0wNu3oqNbk\",\"resolution\":\"revoked\",\"resolved_by\":{\"login\":\"kcreddy\",\"id\":11301409,\"node_id\":\"MDQ6VXNlcjExMzAxNDA5\",\"avatar_url\":\"https://avatars.githubusercontent.com/u/11301409?v=4\",\"gravatar_id\":\"\",\"url\":\"https://api.github.com/users/kcreddy\",\"html_url\":\"https://github.com/kcreddy\",\"followers_url\":\"https://api.github.com/users/kcreddy/followers\",\"following_url\":\"https://api.github.com/users/kcreddy/following{/other_user}\",\"gists_url\":\"https://api.github.com/users/kcreddy/gists{/gist_id}\",\"starred_url\":\"https://api.github.com/users/kcreddy/starred{/owner}{/repo}\",\"subscriptions_url\":\"https://api.github.com/users/kcreddy/subscriptions\",\"organizations_url\":\"https://api.github.com/users/kcreddy/orgs\",\"repos_url\":\"https://api.github.com/users/kcreddy/repos\",\"events_url\":\"https://api.github.com/users/kcreddy/events{/privacy}\",\"received_events_url\":\"https://api.github.com/users/kcreddy/received_events\",\"type\":\"User\",\"site_admin\":false},\"resolved_at\":\"2022-07-07T10:13:56Z\",\"push_protection_bypassed\":false,\"push_protection_bypassed_by\":null,\"push_protection_bypassed_at\":null }"
284284
},
285285
"github": {

packages/github/data_stream/secret_scanning/elasticsearch/ingest_pipeline/default.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,35 @@ processors:
1818
fields:
1919
- github.secret_scanning.number
2020
- github.secret_scanning.updated_at
21+
- github.secret_scanning.resolved_at
2122
target_field: "_id"
2223
ignore_missing: true
24+
- set:
25+
copy_from: github.secret_scanning.created_at
26+
field: event.created
27+
if: ctx.github.secret_scanning?.created_at != null
2328
- date:
2429
field: github.secret_scanning.created_at
2530
formats:
2631
- ISO8601
2732
timezone: UTC
28-
target_field: "event.created"
29-
if: ctx.github.secret_scanning?.created_at != null
33+
target_field: "@timestamp"
34+
if: ctx.github.secret_scanning?.created_at != null && ctx.github.secret_scanning?.updated_at == null && ctx.github.secret_scanning?.resolved_at == null
3035
- date:
31-
field: github.secret_scanning.created_at
36+
field: github.secret_scanning.updated_at
3237
formats:
3338
- ISO8601
3439
timezone: UTC
3540
target_field: "@timestamp"
36-
if: ctx.github.secret_scanning?.created_at != null
41+
if: ctx.github.secret_scanning?.updated_at != null && ctx.github.secret_scanning?.resolved_at == null
3742
- date:
38-
field: github.secret_scanning.updated_at
43+
field: github.secret_scanning.resolved_at
3944
formats:
4045
- ISO8601
4146
timezone: UTC
4247
target_field: "@timestamp"
43-
if: ctx.github.secret_scanning?.updated_at != null
48+
if: ctx.github.secret_scanning?.resolved_at != null
49+
4450
- rename:
4551
target_field: _temp.resolved_by
4652
field: github.secret_scanning.resolved_by

packages/github/data_stream/secret_scanning/sample_event.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"@timestamp": "2022-06-30T18:07:27.000Z",
33
"agent": {
4-
"ephemeral_id": "183ffdee-46fb-4023-90ba-a5af85bf6db2",
5-
"id": "84b3a3da-c733-473b-8c02-cd9e4c7d1d8e",
4+
"ephemeral_id": "49c616b3-b36b-4732-98a7-fc09eadb244f",
5+
"id": "49202dc3-9434-459b-9a0c-a6ec637ef4e9",
66
"name": "docker-fleet-agent",
77
"type": "filebeat",
88
"version": "8.3.0"
@@ -16,16 +16,16 @@
1616
"version": "8.3.0"
1717
},
1818
"elastic_agent": {
19-
"id": "84b3a3da-c733-473b-8c02-cd9e4c7d1d8e",
19+
"id": "49202dc3-9434-459b-9a0c-a6ec637ef4e9",
2020
"snapshot": false,
2121
"version": "8.3.0"
2222
},
2323
"event": {
2424
"action": "secret_scanning",
2525
"agent_id_status": "verified",
26-
"created": "2022-06-30T18:07:27.000Z",
26+
"created": "2022-06-30T18:07:27Z",
2727
"dataset": "github.secret_scanning",
28-
"ingested": "2022-07-08T11:55:25Z",
28+
"ingested": "2022-07-22T17:01:02Z",
2929
"original": "{\"created_at\":\"2022-06-30T18:07:27Z\",\"html_url\":\"https://github.com/sample_owner/sample_repo/security/secret-scanning/3\",\"number\":3,\"push_protection_bypassed\":true,\"push_protection_bypassed_by\":{\"html_url\":\"https://github.com/sample_owner\",\"login\":\"sample_owner\",\"type\":\"User\",\"url\":\"https://api.github.com/users/sample_owner\"},\"resolution\":\"revoked\",\"resolved_by\":{\"login\":\"sample_owner\",\"type\":\"User\",\"url\":\"https://api.github.com/users/sample_owner\"},\"secret\":\"npm_2vYJ3QzGXoGbEgMYduYS1k2M4D0wDu2opJbl\",\"secret_type\":\"npm_access_token\",\"secret_type_display_name\":\"npm Access Token\",\"state\":\"open\",\"url\":\"https://api.github.com/repos/sample_owner/sample_repo/secret-scanning/alerts/3\"}"
3030
},
3131
"github": {

0 commit comments

Comments
 (0)