Skip to content

Commit

Permalink
Remediate security scan finding (#1096)
Browse files Browse the repository at this point in the history
- pin actions versions
- limit permissions

Co-authored-by: Krisztian Notaisz <[email protected]>
  • Loading branch information
kn-ms and kn-ms authored Jun 5, 2024
1 parent e5b4f57 commit ab67547
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 22 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
pull_request:
branches: [main]

permissions:
contents: read

jobs:
CodeQL-Build:

Expand All @@ -19,19 +22,19 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
uses: github/codeql-action/init@2e230e8fe0ad3a14a340ad0815ddb96d599d2aff # v3.25.8
# Override language selection by uncommenting this and choosing your languages
with:
languages: python

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3
uses: github/codeql-action/autobuild@2e230e8fe0ad3a14a340ad0815ddb96d599d2aff # v3.25.8

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -45,4 +48,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@2e230e8fe0ad3a14a340ad0815ddb96d599d2aff # v3.25.8
10 changes: 5 additions & 5 deletions .github/workflows/cut_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
permissions: write-all

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 0
- uses: actions/setup-python@v5
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: '3.11'

Expand All @@ -27,7 +27,7 @@ jobs:
- run: bumpver update
- run: bumpver show --env > new-version.txt
- run: releaseherald generate --latest --no-update -t news.rst
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: new-version
path: |
Expand All @@ -39,9 +39,9 @@ jobs:
needs: cut-new-version

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- run: git pull origin
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
name: new-version
- name: Get Version
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
branches:
- main

permissions:
contents: read

jobs:
build-package:
runs-on: ubuntu-latest
Expand All @@ -15,7 +18,7 @@ jobs:
security-events: write
pull-requests: read
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- run: pip install --upgrade bumpver
- run: bumpver update --no-commit
- uses: ./.github/actions/build-package
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

steps:
- name: "Checkout code"
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
persist-credentials: false

Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/test_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
is_source_changed: ${{steps.check_source_change.outputs.changed}}
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 0
- name: Check if any source changed
Expand Down Expand Up @@ -48,9 +48,9 @@ jobs:
LINT_PYTHON_VERSION: "3.7"
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Set up Python ${{ env.LINT_PYTHON_VERSION }}
uses: actions/setup-python@v5
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: ${{ env.LINT_PYTHON_VERSION }}
- name: Restore pip cache
Expand All @@ -70,19 +70,19 @@ jobs:
REACT_APP_API_BASE_URL: "/fake/api/endpoint"
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: 3.11
- name: Set up Node
uses: actions/setup-node@v4
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: "16.x"
- name: Restore pip cache
uses: ./.github/actions/pip-cache
- name: Set up PNPM
uses: pnpm/action-setup@v3
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
with:
version: 8.10.4
- name: Setup
Expand All @@ -94,7 +94,7 @@ jobs:
CI=false doit build_ui
doit test_ui
- name: Archive ui artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: ui_bundle
path: testplan/web_ui/testing/build
Expand All @@ -115,15 +115,15 @@ jobs:
steps:
- run: echo "BUILD ${{ matrix.os }} ${{ matrix.python-version }} ${{needs.is_source_changed.outputs.is_source_changed}}"
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: ${{ matrix.python-version }}
- name: Restore pip cache
uses: ./.github/actions/pip-cache
- name: Download ui bundle
uses: actions/download-artifact@v4
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
name: ui_bundle
path: testplan/web_ui/testing/build
Expand Down

0 comments on commit ab67547

Please sign in to comment.