Skip to content

Commit

Permalink
feat(.github/workflows): stricter GitHub token default permission com…
Browse files Browse the repository at this point in the history
…pliance (#2849)
  • Loading branch information
darccio authored Sep 26, 2024
1 parent bed7121 commit 043dcd1
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/appsec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ concurrency:
# Automatically cancel previous runs if a new one is triggered to conserve resources.
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}

permissions:
contents: read

jobs:
# Prepare the cache of Go modules to share it will the other jobs.
# This maximizes cache hits and minimizes the time spent downloading Go modules.
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/datadog-static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ on: [push]

name: Datadog Static Analysis

permissions:
contents: read
pull-requests: write

jobs:
static-analysis:
runs-on: ubuntu-latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
- reopened
- opened
- edited
permissions:
contents: read
issues: write
jobs:
label_issues:
if: contains(github.event.issue.title, 'contrib')
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ecosystems-label-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
- opened
- reopened
- edited
permissions:
contents: read
pull-requests: write
jobs:
label_issues:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/govulncheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ on:
- cron: '00 00 * * *'
workflow_dispatch:

permissions:
contents: read

jobs:
govulncheck-tests:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/multios-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ on:
env:
DD_APPSEC_WAF_TIMEOUT: 1m # Increase time WAF time budget to reduce CI flakiness

permissions:
contents: read

jobs:
test-multi-os:
runs-on: "${{ inputs.runs-on }}"
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/parametric-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ on:
schedule:
- cron: '00 04 * * 2-6'

permissions:
contents: read

jobs:
parametric-tests:
if: github.event_name != 'pull_request' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'DataDog/dd-trace-go')
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ on:
env:
TEST_RESULTS: /tmp/test-results # path to where test results will be saved

permissions:
contents: read

jobs:
go-get-u:
# Run go get -u to upgrade dd-trace-go dependencies to their
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
schedule:
- cron: '30 1 * * *'

permissions:
contents: read
issues: write

jobs:
stale:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/system-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ on:
schedule:
- cron: '00 04 * * 2-6'

permissions:
contents: read

jobs:
system-tests:
if: github.event_name != 'pull_request' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'DataDog/dd-trace-go')
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test-apps.cue
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ env: {
DD_TAGS: "github_run_id:${{ github.run_id }} github_run_number:${{ github.run_number }} ${{ inputs['arg: tags'] }}",
}

permissions: {
contents: "read",
}

jobs: {
for i, scenario in #scenarios {
for j, env in #envs {
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test-apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ name: Test Apps
env:
DD_ENV: github
DD_TAGS: 'github_run_id:${{ github.run_id }} github_run_number:${{ github.run_number }} ${{ inputs[''arg: tags''] }}'
permissions:
contents: read
jobs:
job-0-0:
name: unit-of-work/v1 (prod)
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/unit-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ env:
# without having to download a newer one.
GOTOOLCHAIN: local

permissions:
contents: read

jobs:
copyright:
runs-on: ubuntu-latest
Expand Down

0 comments on commit 043dcd1

Please sign in to comment.