Skip to content

Commit f006868

Browse files
authored
chore: set explicit workflow permissions and pin down actions (#39)
Signed-off-by: tdruez <tdruez@aboutcode.org>
1 parent 8adbf88 commit f006868

9 files changed

+102
-27
lines changed

.github/workflows/analyze-docker-image.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
1-
on: [push]
1+
on:
2+
workflow_dispatch:
3+
pull_request:
4+
push:
5+
branches:
6+
- main
27

38
jobs:
49
scan-codebase:
510
runs-on: ubuntu-24.04
11+
permissions:
12+
contents: read
13+
614
name: Analyze a Docker image
715
steps:
816
- name: Get the action.yml from the current branch
9-
uses: actions/checkout@v4
17+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1018
with:
1119
sparse-checkout: action.yml
1220
sparse-checkout-cone-mode: false
21+
persist-credentials: false
1322

1423
- uses: ./
1524
with:

.github/workflows/find-vulnerabilities.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,30 @@
1-
on: [push]
1+
on:
2+
workflow_dispatch:
3+
pull_request:
4+
push:
5+
branches:
6+
- main
27

38
jobs:
49
scan-codebase:
510
runs-on: ubuntu-24.04
11+
permissions:
12+
contents: read
13+
614
name: Scan codebase and find vulnerabilities
715
steps:
816
- name: Get the action.yml from the current branch
9-
uses: actions/checkout@v4
17+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1018
with:
1119
sparse-checkout: action.yml
1220
sparse-checkout-cone-mode: false
21+
persist-credentials: false
1322

14-
- uses: actions/checkout@v4
23+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1524
with:
1625
path: scancode-inputs
26+
persist-credentials: false
27+
1728
- uses: ./
1829
with:
1930
pipelines: "scan_codebase,find_vulnerabilities"

.github/workflows/map-deploy-to-develop-template.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,19 @@ on:
1717

1818
jobs:
1919
run-d2d-pipeline:
20-
runs-on: 'ubuntu-latest'
20+
runs-on: ubuntu-24.04
21+
permissions:
22+
contents: read
23+
2124
steps:
2225
- name: Checkout repository
23-
uses: actions/checkout@v4
26+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2427
with:
2528
repository: ${{ inputs.repository || github.repository }}
29+
persist-credentials: false
2630

2731
- name: Download build artifact
28-
uses: actions/download-artifact@v4
32+
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
2933
with:
3034
name: ${{ inputs['artifact-name'] }}
3135
path: ../scancode-inputs/
@@ -40,7 +44,7 @@ jobs:
4044
git archive --format=tar.gz -o ../scancode-inputs/from.tar.gz HEAD
4145
4246
- name: Run D2D pipeline
43-
uses: aboutcode-org/scancode-action@beta
47+
uses: aboutcode-org/scancode-action@main
4448
with:
4549
pipelines: ${{ inputs.steps && format('map_deploy_to_develop:%s', inputs.steps) || 'map_deploy_to_develop' }}
4650
inputs-path: ../scancode-inputs

.github/workflows/map-deploy-to-develop.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
1-
on: [push]
1+
on:
2+
workflow_dispatch:
3+
pull_request:
4+
push:
5+
branches:
6+
- main
27

38
jobs:
49
scan-codebase:
510
runs-on: ubuntu-24.04
11+
permissions:
12+
contents: read
13+
614
name: Map deploy to develop
715
steps:
816
- name: Get the action.yml from the current branch
9-
uses: actions/checkout@v4
17+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1018
with:
1119
sparse-checkout: action.yml
1220
sparse-checkout-cone-mode: false
21+
persist-credentials: false
1322

1423
- uses: ./
1524
with:

.github/workflows/map-source-binary-boolean-py.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,28 @@ jobs:
1111
build-python-wheel:
1212
name: Build python wheel
1313
runs-on: ubuntu-24.04
14+
permissions:
15+
contents: read
1416

1517
steps:
16-
- uses: actions/checkout@v4
18+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1719
with:
1820
repository: bastikr/boolean.py
21+
persist-credentials: false
1922

2023
- name: Set up Python
21-
uses: actions/setup-python@v5
24+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
2225
with:
23-
python-version: 3.12
24-
26+
python-version: 3.12
27+
2528
- name: Install pypa/build and twine
2629
run: python -m pip install --user --upgrade build twine packaging pip setuptools
2730

2831
- name: Build a binary wheel
2932
run: python -m build --wheel --outdir dist/
3033

3134
- name: Upload wheel
32-
uses: actions/upload-artifact@v4
35+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
3336
with:
3437
name: wheel_archives
3538
path: dist/*.whl

.github/workflows/multi-runs.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
1-
on: [push]
1+
on:
2+
workflow_dispatch:
3+
pull_request:
4+
push:
5+
branches:
6+
- main
27

38
jobs:
49
multi-runs:
510
runs-on: ubuntu-24.04
11+
permissions:
12+
contents: read
13+
614
name: Ensure the action can be executed multiple times
715
steps:
816
- name: Get the action.yml from the current branch
9-
uses: actions/checkout@v4
17+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1018
with:
1119
sparse-checkout: action.yml
1220
sparse-checkout-cone-mode: false
21+
persist-credentials: false
1322

14-
- uses: actions/checkout@v4
23+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1524
with:
1625
path: scancode-inputs
26+
persist-credentials: false
1727

1828
- uses: ./
1929
with:

.github/workflows/run-android-deploy-to-develop.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
1-
on: [push]
1+
on:
2+
workflow_dispatch:
3+
pull_request:
4+
push:
5+
branches:
6+
- main
27

38
jobs:
49
scan-codebase:
510
runs-on: ubuntu-24.04
11+
permissions:
12+
contents: read
13+
614
name: Run Android D2D
715
steps:
816
- name: Get the action.yml from the current branch
9-
uses: actions/checkout@v4
17+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1018
with:
1119
sparse-checkout: action.yml
1220
sparse-checkout-cone-mode: false
21+
persist-credentials: false
1322

1423
- uses: ./
1524
with:

.github/workflows/scan-codebase.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,30 @@
1-
on: [push]
1+
on:
2+
workflow_dispatch:
3+
pull_request:
4+
push:
5+
branches:
6+
- main
27

38
jobs:
49
scan-codebase:
510
runs-on: ubuntu-24.04
11+
permissions:
12+
contents: read
13+
614
name: Scan codebase and check for compliance issues
715
steps:
816
- name: Get the action.yml from the current branch
9-
uses: actions/checkout@v4
17+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1018
with:
1119
sparse-checkout: action.yml
1220
sparse-checkout-cone-mode: false
21+
persist-credentials: false
1322

14-
- uses: actions/checkout@v4
23+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1524
with:
1625
path: scancode-inputs
26+
persist-credentials: false
27+
1728
- uses: ./
1829
with:
1930
pipelines: "scan_codebase"
Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
1-
on: [push]
1+
on:
2+
workflow_dispatch:
3+
pull_request:
4+
push:
5+
branches:
6+
- main
27

38
jobs:
49
scan-codebase:
510
runs-on: ubuntu-24.04
11+
permissions:
12+
contents: read
13+
614
name: Scan a package archive
715
steps:
816
- name: Get the action.yml from the current branch
9-
uses: actions/checkout@v4
17+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1018
with:
1119
sparse-checkout: action.yml
1220
sparse-checkout-cone-mode: false
21+
persist-credentials: false
1322

1423
- uses: ./
1524
with:
1625
pipelines: "scan_single_package"
1726
input-urls:
18-
https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip
27+
https://github.com/${{ github.repository }}/archive/${{ github.ref }}.zip

0 commit comments

Comments
 (0)