Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.17](backport #38047) security: add permissions block to workflows #38649

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/check-audtibeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
env:
BEAT_MODULE: 'auditbeat'

permissions:
contents: read

jobs:
check:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/check-dev-tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
env:
BEAT_MODULE: 'dev-tools'

permissions:
contents: read

jobs:
check:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/check-filebeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
env:
BEAT_MODULE: 'filebeat'

permissions:
contents: read

jobs:
check:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/check-heartbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
env:
BEAT_MODULE: 'heartbeat'

permissions:
contents: read

jobs:
check:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/check-libbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
env:
BEAT_MODULE: 'libbeat'

permissions:
contents: read

jobs:
check:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/check-metricbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
env:
BEAT_MODULE: 'metricbeat'

permissions:
contents: read

jobs:
check:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/check-packetbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
env:
BEAT_MODULE: 'packetbeat'

permissions:
contents: read

jobs:
check:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/check-winlogbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
env:
BEAT_MODULE: 'winlogbeat'

permissions:
contents: read

jobs:
check:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/check-xpack-auditbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
env:
BEAT_MODULE: 'x-pack/auditbeat'

permissions:
contents: read

jobs:
check:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/check-xpack-dockerlogbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
env:
BEAT_MODULE: 'x-pack/dockerlogbeat'

permissions:
contents: read

jobs:
check:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/check-xpack-filebeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
env:
BEAT_MODULE: 'x-pack/filebeat'

permissions:
contents: read

jobs:
check:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/check-xpack-functionbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
env:
BEAT_MODULE: 'x-pack/functionbeat'

permissions:
contents: read

jobs:
check:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/check-xpack-heartbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
env:
BEAT_MODULE: 'x-pack/heartbeat'

permissions:
contents: read

jobs:
check:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/check-xpack-libbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
env:
BEAT_MODULE: 'x-pack/libbeat'

permissions:
contents: read

jobs:
check:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/check-xpack-metricbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
env:
BEAT_MODULE: 'x-pack/metricbeat'

permissions:
contents: read

jobs:
check:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/check-xpack-osquerybeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
env:
BEAT_MODULE: 'x-pack/osquerybeat'

permissions:
contents: read

jobs:
check:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/check-xpack-packetbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
env:
BEAT_MODULE: 'x-pack/packetbeat'

permissions:
contents: read

jobs:
check:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/check-xpack-winlogbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
env:
BEAT_MODULE: 'x-pack/winlogbeat'

permissions:
contents: read

jobs:
check:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/macos-auditbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ on:
env:
BEAT_MODULE: 'auditbeat'

permissions:
contents: read

jobs:
macos:
runs-on: macos-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/macos-filebeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ on:
env:
BEAT_MODULE: 'filebeat'

permissions:
contents: read

jobs:
macos:
runs-on: macos-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/macos-heartbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ on:
env:
BEAT_MODULE: 'heartbeat'

permissions:
contents: read

jobs:
macos:
runs-on: macos-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/macos-metricbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ on:
env:
BEAT_MODULE: 'metricbeat'

permissions:
contents: read

jobs:
macos:
runs-on: macos-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/macos-packetbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ on:
env:
BEAT_MODULE: 'packetbeat'

permissions:
contents: read

jobs:
macos:
runs-on: macos-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/macos-xpack-auditbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ on:
env:
BEAT_MODULE: 'x-pack/auditbeat'

permissions:
contents: read

jobs:
macos:
runs-on: macos-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/macos-xpack-filebeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ on:
env:
BEAT_MODULE: 'x-pack/filebeat'

permissions:
contents: read

jobs:
macos:
runs-on: macos-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/macos-xpack-functionbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ on:
env:
BEAT_MODULE: 'x-pack/functionbeat'

permissions:
contents: read

jobs:
macos:
runs-on: macos-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/macos-xpack-heartbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ on:
env:
BEAT_MODULE: 'x-pack/heartbeat'

permissions:
contents: read

jobs:
macos:
runs-on: macos-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/macos-xpack-metricbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ on:
env:
BEAT_MODULE: 'x-pack/metricbeat'

permissions:
contents: read

jobs:
macos:
runs-on: macos-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/macos-xpack-osquerybeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ on:
env:
BEAT_MODULE: 'x-pack/osquerybeat'

permissions:
contents: read

jobs:
macos:
runs-on: macos-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/macos-xpack-packetbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ on:
env:
BEAT_MODULE: 'x-pack/packetbeat'

permissions:
contents: read

jobs:
macos:
runs-on: macos-latest
Expand Down
59 changes: 59 additions & 0 deletions .github/workflows/platform-ingest-project-board.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Add issue to Ingest project

on:
issues:
types:
- labeled
env:
INGEST_PROJECT_ID: 'PVT_kwDOAGc3Zs4AEzn4'

# GitHub labels for each team/area
DATA_PLANE_LABEL: 'Team:Elastic-Agent-Data-Plane'
CONTROL_PLANE_LABEL: 'Team:Elastic-Agent-Control-Plane'
ELASTIC_AGENT_LABEL: 'Team:Elastic-Agent'

# ID values for the Area property + its options
AREA_FIELD_ID: 'PVTSSF_lADOAGc3Zs4AEzn4zgEgZSo'
ELASTIC_AGENT_OPTION_ID: 'c1e1a30a'

permissions:
contents: read

jobs:
add_to_ingest_project:
runs-on: ubuntu-latest
steps:
- uses: octokit/[email protected]
id: add_to_project
if: ${{ github.event.label.name == env.DATA_PLANE_LABEL || github.event.label.name == env.CONTROL_PLANE_LABEL || github.event.label.name == env.ECOSYSTEM_LABEL || github.event.label.name == env.FLEET_LABEL }}
with:
query: |
# Variables have to be snake cased because of https://github.com/octokit/graphql-action/issues/164
mutation AddToIngestProject($project_id: ID!, $content_id: ID!) {
addProjectV2ItemById(input: { projectId: $project_id, contentId: $content_id }) {
item {
id
}
}
}
project_id: ${{ env.INGEST_PROJECT_ID }}
content_id: ${{ github.event.issue.node_id }}
env:
GITHUB_TOKEN: ${{ secrets.PROJECT_ASSIGNER_TOKEN }}
- uses: octokit/[email protected]
id: set_elastic_agent_area
if: github.event.label.name == env.DATA_PLANE_LABEL || github.event.label.name == env.CONTROL_PLANE_LABEL || github.event.label.name == env.ELASTIC_AGENT_LABEL
with:
query: |
mutation updateIngestArea($item_id: ID!, $project_id: ID!, $area_field_id: ID!, $area_id: String) {
updateProjectV2ItemFieldValue(
input: { itemId: $item_id, projectId: $project_id, fieldId: $area_field_id, value: { singleSelectOptionId: $area_id } }) {
clientMutationId
}
}
item_id: ${{ fromJSON(steps.add_to_project.outputs.data).addProjectV2ItemById.item.id }}
project_id: ${{ env.INGEST_PROJECT_ID }}
area_field_id: ${{ env.AREA_FIELD_ID }}
area_id: ${{ env.ELASTIC_AGENT_OPTION_ID }}
env:
GITHUB_TOKEN: ${{ secrets.PROJECT_ASSIGNER_TOKEN }}
Loading
Loading