Skip to content

Speakr is a personal, self-hosted web application designed for transcribing audio recordings

Python

CI: actions pinned by commit, read-only default permissions, tests on the locked packages, lock check; Dependabot waits 7 days for new releases

Murtaza Nasirc0383caf1fe7
diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml
index 12b90ab3..08fb9937 100644
--- a/.forgejo/workflows/test.yml
+++ b/.forgejo/workflows/test.yml
@@ -35,10 +35,9 @@ jobs:
steps:
- name: Checkout repository
- uses: actions/checkout@v5
-
+ uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
- name: Set up Python
- uses: actions/setup-python@v6
+ uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '3.11'
cache: pip
@@ -47,7 +46,7 @@ jobs:
run: sudo apt-get update && sudo apt-get install -y ffmpeg
- name: Install dependencies
- run: pip install -r requirements.txt pytest pytest-cov
+ run: pip install --require-hashes --no-deps -r requirements.lock && pip install pytest pytest-cov
- name: Run test suite
env:
@@ -62,10 +61,9 @@ jobs:
steps:
- name: Checkout repository
- uses: actions/checkout@v5
-
+ uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
- name: Set up Node
- uses: actions/setup-node@v4
+ uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: '20'
# No npm cache: package-lock.json is gitignored in this repo, so it's
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 169730d8..81c97068 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -1,19 +1,32 @@
# Dependency updates (#434), checked once a month. Pull requests for security
# advisories are enabled separately, under Settings, Code security.
+#
+# A release is proposed only after it has been public for a week (cooldown):
+# most malicious releases are found and withdrawn within days. Dependabot
+# updates requirements.txt; the lock-check job then fails until the lock
+# files are regenerated with scripts/lock-requirements.sh, so every new
+# version is reviewed before it is locked. Actions are pinned by commit and
+# the base image by digest; Dependabot updates both.
version: 2
updates:
- package-ecosystem: pip
directory: /
schedule:
interval: monthly
+ cooldown:
+ default-days: 7
open-pull-requests-limit: 5
- package-ecosystem: docker
directory: /
schedule:
interval: monthly
+ cooldown:
+ default-days: 7
open-pull-requests-limit: 2
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
+ cooldown:
+ default-days: 7
open-pull-requests-limit: 2
diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml
index fe77eb84..18917510 100644
--- a/.github/workflows/cla.yml
+++ b/.github/workflows/cla.yml
@@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: "Post CLA Reminder"
- uses: actions/github-script@v8
+ uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: |
const prNumber = context.payload.pull_request?.number;
diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml
index 60799d68..29168370 100644
--- a/.github/workflows/docker-publish.yml
+++ b/.github/workflows/docker-publish.yml
@@ -19,6 +19,10 @@ env:
# Use explicit image name instead of github.repository
IMAGE_NAME: learnedmachine/speakr
+# Read-only by default; a job that needs more declares it
+permissions:
+ contents: read
+
jobs:
test:
runs-on: ubuntu-latest
@@ -40,10 +44,9 @@ jobs:
steps:
- name: Checkout repository
- uses: actions/checkout@v5
-
+ uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
- name: Set up Python
- uses: actions/setup-python@v6
+ uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '3.11'
@@ -51,7 +54,7 @@ jobs:
run: sudo apt-get update && sudo apt-get install -y ffmpeg
- name: Install dependencies
- run: pip install -r requirements.txt pytest pytest-cov
+ run: pip install --require-hashes --no-deps -r requirements.lock && pip install pytest pytest-cov
- name: Run full test suite (gates the release)
env:
@@ -76,13 +79,11 @@ jobs:
df -h /
- name: Checkout repository
- uses: actions/checkout@v5
-
+ uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
- name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v3
-
+ uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- name: Build lite image (amd64, local)
- uses: docker/build-push-action@v6
+ uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
with:
context: .
platforms: linux/amd64
@@ -103,7 +104,7 @@ jobs:
curl -fs -o /dev/null http://127.0.0.1:8899/login
- name: Set up Python
- uses: actions/setup-python@v6
+ uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '3.11'
@@ -141,20 +142,17 @@ jobs:
df -h /
- name: Checkout repository
- uses: actions/checkout@v5
-
+ uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
# Set up QEMU for multi-platform builds
- name: Set up QEMU
- uses: docker/setup-qemu-action@v3
-
+ uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
# Set up Docker Buildx
- name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v3
-
+ uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
# Login to Docker Hub
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
- uses: docker/login-action@v3
+ uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
@@ -163,7 +161,7 @@ jobs:
# Extract metadata (tags, labels) for Docker
- name: Extract Docker metadata
id: meta
- uses: docker/metadata-action@v5
+ uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
@@ -174,7 +172,7 @@ jobs:
# Build and push full Docker image
- name: Build and push Docker image
id: build-and-push
- uses: docker/build-push-action@v6
+ uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
with:
context: .
platforms: linux/amd64,linux/arm64
@@ -205,20 +203,17 @@ jobs:
df -h /
- name: Checkout repository
- uses: actions/checkout@v5
-
+ uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
# Set up QEMU for multi-platform builds
- name: Set up QEMU
- uses: docker/setup-qemu-action@v3
-
+ uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
# Set up Docker Buildx
- name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v3
-
+ uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
# Login to Docker Hub
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
- uses: docker/login-action@v3
+ uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
@@ -227,7 +222,7 @@ jobs:
# Extract metadata for lite image
- name: Extract Docker metadata (lite)
id: meta-lite
- uses: docker/metadata-action@v5
+ uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Never tag the lite image as `latest`; `latest` is the full image,
@@ -244,7 +239,7 @@ jobs:
# Build and push lightweight Docker image (no PyTorch/sentence-transformers)
- name: Build and push lite Docker image
id: build-and-push-lite
- uses: docker/build-push-action@v6
+ uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
with:
context: .
platforms: linux/amd64,linux/arm64
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 1bdc6544..b10d0ef3 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
- uses: actions/checkout@v5
+ uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
with:
# git-revision-date-localized needs full history for page dates;
# since plugin 1.6 a shallow clone is a warning, which --strict
@@ -30,7 +30,7 @@ jobs:
fetch-depth: 0
- name: Setup Python
- uses: actions/setup-python@v6
+ uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '3.11'
@@ -50,7 +50,7 @@ jobs:
mkdocs build --strict
- name: Upload artifact
- uses: actions/upload-pages-artifact@v5
+ uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: ./site
@@ -63,4 +63,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
- uses: actions/deploy-pages@v5
+ uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1
\ No newline at end of file
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index cf19c164..6720b106 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -14,6 +14,10 @@ on:
pull_request:
workflow_dispatch:
+# Read-only by default; a job that needs more declares it
+permissions:
+ contents: read
+
jobs:
python-tests:
runs-on: ubuntu-latest
@@ -35,10 +39,9 @@ jobs:
steps:
- name: Checkout repository
- uses: actions/checkout@v5
-
+ uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
- name: Set up Python
- uses: actions/setup-python@v6
+ uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '3.11'
cache: pip
@@ -47,7 +50,7 @@ jobs:
run: sudo apt-get update && sudo apt-get install -y ffmpeg
- name: Install dependencies
- run: pip install -r requirements.txt pytest pytest-cov
+ run: pip install --require-hashes --no-deps -r requirements.lock && pip install pytest pytest-cov
- name: Build the Tailwind stylesheet as the image build does
run: scripts/build_css.sh
@@ -73,17 +76,16 @@ jobs:
steps:
- name: Checkout Speakr
- uses: actions/checkout@v5
-
+ uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
- name: Checkout whisperx-asr-service
- uses: actions/checkout@v5
+ uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
with:
repository: murtaza-nasir/whisperx-asr-service
ref: ${{ env.WHISPERX_REF }}
path: whisperx
- name: Set up Python
- uses: actions/setup-python@v6
+ uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '3.11'
cache: pip
@@ -93,7 +95,7 @@ jobs:
- name: Install dependencies
run: |
- pip install -r requirements.txt pytest
+ pip install --require-hashes --no-deps -r requirements.lock && pip install pytest
python -m venv /tmp/wxv
/tmp/wxv/bin/pip install -r whisperx/tests/requirements-ci.txt
@@ -121,6 +123,15 @@ jobs:
if: always()
run: tail -n 200 /tmp/whisperx.log || true
+ lock-check:
+ # The lock files pin every package with its hashes; they must match
+ # requirements.txt and requirements-embeddings.txt
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
+ - name: Lock files match the requirements
+ run: scripts/lock-requirements.sh --check
+
browser-smoke:
# Opens every page in headless Chromium and fails on failed requests,
# JavaScript errors, leftover template text, or a header whose user menu
@@ -132,16 +143,15 @@ jobs:
steps:
- name: Checkout repository
- uses: actions/checkout@v5
-
+ uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
- name: Set up Python
- uses: actions/setup-python@v6
+ uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '3.11'
cache: pip
- name: Install dependencies
- run: pip install -r requirements.txt pytest playwright
+ run: pip install --require-hashes --no-deps -r requirements.lock && pip install pytest playwright
- name: Download vendor files as the image build does
run: PRODUCTION=1 python scripts/download_offline_deps.py
@@ -173,10 +183,9 @@ jobs:
steps:
- name: Checkout repository
- uses: actions/checkout@v5
-
+ uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
- name: Set up Node
- uses: actions/setup-node@v4
+ uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: '20'
# No npm cache: package-lock.json is gitignored in this repo, so it's