Skip to content

Commit 1349d62

Browse files
authored
Merge pull request #32294 from github/repo-sync
Repo sync
2 parents 120cf2d + 68f4a7c commit 1349d62

File tree

8 files changed

+37
-27
lines changed

8 files changed

+37
-27
lines changed

src/audit-logs/data/ghec/enterprise.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
},
147147
{
148148
"action": "api.request",
149-
"description": "An API request was made to a security-significant endpoint for the enterprise. This event is only included if API Request Events is enabled in the enterprise's audit log settings. This event is not available in the web interface, only via the REST API, audit log streaming, or JSON/CSV exports.",
149+
"description": "An API request was made to a security-significant endpoint for the enterprise. This event is only included if API Request Events is enabled in the enterprise's audit log settings. This event is only available via audit log streaming.",
150150
"docs_reference_links": "/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/streaming-the-audit-log-for-your-enterprise#enabling-audit-log-streaming-of-api-requests",
151151
"fields": [
152152
"user_agent",

src/audit-logs/data/ghes-3.10/enterprise.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,7 @@
10931093
},
10941094
{
10951095
"action": "api.request",
1096-
"description": "An API request was made to a security-significant endpoint for the enterprise. This event is only included if API Request Events is enabled in the enterprise's audit log settings. This event is not available in the web interface, only via the REST API, audit log streaming, or JSON/CSV exports.",
1096+
"description": "An API request was made to a security-significant endpoint for the enterprise. This event is only included if API Request Events is enabled in the enterprise's audit log settings. This event is only available via audit log streaming.",
10971097
"docs_reference_links": "/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/streaming-the-audit-log-for-your-enterprise#enabling-audit-log-streaming-of-api-requests",
10981098
"fields": [
10991099
"@timestamp",

src/audit-logs/data/ghes-3.11/enterprise.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,7 @@
10991099
},
11001100
{
11011101
"action": "api.request",
1102-
"description": "An API request was made to a security-significant endpoint for the enterprise. This event is only included if API Request Events is enabled in the enterprise's audit log settings. This event is not available in the web interface, only via the REST API, audit log streaming, or JSON/CSV exports.",
1102+
"description": "An API request was made to a security-significant endpoint for the enterprise. This event is only included if API Request Events is enabled in the enterprise's audit log settings. This event is only available via audit log streaming.",
11031103
"docs_reference_links": "/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/streaming-the-audit-log-for-your-enterprise#enabling-audit-log-streaming-of-api-requests",
11041104
"fields": [
11051105
"@timestamp",

src/audit-logs/data/ghes-3.12/enterprise.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,7 @@
10991099
},
11001100
{
11011101
"action": "api.request",
1102-
"description": "An API request was made to a security-significant endpoint for the enterprise. This event is only included if API Request Events is enabled in the enterprise's audit log settings. This event is not available in the web interface, only via the REST API, audit log streaming, or JSON/CSV exports.",
1102+
"description": "An API request was made to a security-significant endpoint for the enterprise. This event is only included if API Request Events is enabled in the enterprise's audit log settings. This event is only available via audit log streaming.",
11031103
"docs_reference_links": "/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/streaming-the-audit-log-for-your-enterprise#enabling-audit-log-streaming-of-api-requests",
11041104
"fields": [
11051105
"@timestamp",

src/audit-logs/data/ghes-3.13/enterprise.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,7 @@
11051105
},
11061106
{
11071107
"action": "api.request",
1108-
"description": "An API request was made to a security-significant endpoint for the enterprise. This event is only included if API Request Events is enabled in the enterprise's audit log settings. This event is not available in the web interface, only via the REST API, audit log streaming, or JSON/CSV exports.",
1108+
"description": "An API request was made to a security-significant endpoint for the enterprise. This event is only included if API Request Events is enabled in the enterprise's audit log settings. This event is only available via audit log streaming.",
11091109
"docs_reference_links": "/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/streaming-the-audit-log-for-your-enterprise#enabling-audit-log-streaming-of-api-requests",
11101110
"fields": [
11111111
"@timestamp",

src/audit-logs/data/ghes-3.9/enterprise.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,7 @@
10271027
},
10281028
{
10291029
"action": "api.request",
1030-
"description": "An API request was made to a security-significant endpoint for the enterprise. This event is only included if API Request Events is enabled in the enterprise's audit log settings. This event is not available in the web interface, only via the REST API, audit log streaming, or JSON/CSV exports.",
1030+
"description": "An API request was made to a security-significant endpoint for the enterprise. This event is only included if API Request Events is enabled in the enterprise's audit log settings. This event is only available via audit log streaming.",
10311031
"docs_reference_links": "/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/streaming-the-audit-log-for-your-enterprise#enabling-audit-log-streaming-of-api-requests",
10321032
"fields": [
10331033
"@timestamp",

src/audit-logs/lib/config.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2-
"apiOnlyEventsAdditionalDescription": "This event is not available in the web interface, only via the REST API, audit log streaming, or JSON/CSV exports.",
2+
"appendedDescriptions": {
3+
"apiOnlyEvents": "This event is not available in the web interface, only via the REST API, audit log streaming, or JSON/CSV exports.",
4+
"apiRequestEvent": "This event is only available via audit log streaming."
5+
},
36
"sha": "86e8c1638b4820a64a1e66501abd9e824b449b3e"
47
}

src/audit-logs/lib/index.js

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -101,18 +101,11 @@ export function filterByAllowlistValues(
101101

102102
const minimal = {
103103
action: event.action,
104-
description: event.description,
104+
description: processAndGetEventDescription(event, eventAllowlists, pipelineConfig),
105105
docs_reference_links: event.docs_reference_links,
106106
fields: event.fields,
107107
}
108108

109-
if (
110-
eventAllowlists.includes('org_api_only') ||
111-
eventAllowlists.includes('business_api_only')
112-
) {
113-
minimal.description += ` ${pipelineConfig.apiOnlyEventsAdditionalDescription}`
114-
}
115-
116109
minimalEvents.push(minimal)
117110
}
118111
}
@@ -167,19 +160,12 @@ export function filterAndUpdateGhesDataByAllowlistValues(
167160
if (ghesVersionAllowlists === null) continue
168161
if (seenByGhesVersion.get(fullGhesVersion)?.has(event.action)) continue
169162

170-
const minimal = {
171-
action: event.action,
172-
description: event.description,
173-
docs_reference_links: event.docs_reference_links,
174-
fields: event.ghes[ghesVersion].fields,
175-
}
176-
177163
if (ghesVersionAllowlists.includes(allowListValue)) {
178-
if (
179-
ghesVersionAllowlists.includes('org_api_only') ||
180-
ghesVersionAllowlists.includes('business_api_only')
181-
) {
182-
minimal.description += ` ${pipelineConfig.apiOnlyEventsAdditionalDescription}`
164+
const minimal = {
165+
action: event.action,
166+
description: processAndGetEventDescription(event, ghesVersionAllowlists, pipelineConfig),
167+
docs_reference_links: event.docs_reference_links,
168+
fields: event.ghes[ghesVersion].fields,
183169
}
184170

185171
// we need to initialize as we go to build up the `minimalEvents`
@@ -208,3 +194,24 @@ export function filterAndUpdateGhesDataByAllowlistValues(
208194
}
209195
}
210196
}
197+
198+
function processAndGetEventDescription(event, allowlists, pipelineConfig) {
199+
let description = event.description
200+
201+
// api.request is a unique event because it's an api_only event but is the only
202+
// one of these events where the description we append isn't correct so we
203+
// have to account for it separately. There's not yet anything in the schema
204+
// we can hook onto to treat it differently.
205+
if (
206+
(allowlists.includes('org_api_only') || allowlists.includes('business_api_only')) &&
207+
event.action !== 'api.request'
208+
) {
209+
description += ` ${pipelineConfig.appendedDescriptions.apiOnlyEvents}`
210+
}
211+
212+
if (event.action === 'api.request') {
213+
description += ` ${pipelineConfig.appendedDescriptions.apiRequestEvent}`
214+
}
215+
216+
return description
217+
}

0 commit comments

Comments
 (0)