mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-10 05:24:18 +09:00
ci: pin containers to digest, enable more zizmor rules (#38779)
Enable more strict "pedantic" zizmor rules and fix issues. Service containers are pinned to hash and renovate will update them. Enabled rules: - https://docs.zizmor.sh/audits/#excessive-permissions - https://docs.zizmor.sh/audits/#unpinned-images - https://docs.zizmor.sh/audits/#template-injection --------- Signed-off-by: silverwind <me@silverwind.io>
This commit is contained in:
@@ -9,8 +9,7 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
|
|
||||||
permissions:
|
permissions: {}
|
||||||
actions: write # to delete caches
|
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: cache-prune
|
group: cache-prune
|
||||||
@@ -19,6 +18,8 @@ jobs:
|
|||||||
prune:
|
prune:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.repository == 'go-gitea/gitea'
|
if: github.repository == 'go-gitea/gitea'
|
||||||
|
permissions:
|
||||||
|
actions: write # to delete caches
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
GH_REPO: ${{ github.repository }}
|
GH_REPO: ${{ github.repository }}
|
||||||
|
|||||||
@@ -69,9 +69,10 @@ jobs:
|
|||||||
- run: make generate-go
|
- run: make generate-go
|
||||||
env:
|
env:
|
||||||
TAGS: ${{ matrix.tags }}
|
TAGS: ${{ matrix.tags }}
|
||||||
- run: make ${{ matrix.target }}
|
- run: make "$TARGET"
|
||||||
env:
|
env:
|
||||||
TAGS: ${{ matrix.tags }}
|
TAGS: ${{ matrix.tags }}
|
||||||
|
TARGET: ${{ matrix.target }}
|
||||||
|
|
||||||
# reclaims the caches this run superseded, so the next save still fits in the allowance
|
# reclaims the caches this run superseded, so the next save still fits in the allowance
|
||||||
prune:
|
prune:
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ on:
|
|||||||
# - cron: "7 0 * * 1" # every Monday at 00:07 UTC
|
# - cron: "7 0 * * 1" # every Monday at 00:07 UTC
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
cron-licenses:
|
cron-licenses:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ on:
|
|||||||
- cron: "7 0 * * *" # every day at 00:07 UTC
|
- cron: "7 0 * * *" # every day at 00:07 UTC
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
crowdin-pull:
|
crowdin-pull:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
@@ -40,11 +40,7 @@ on:
|
|||||||
required: false
|
required: false
|
||||||
default: labels,merge_queue,lock,feedback,last_call,milestones,lgtm,translation_comment,pr_actions
|
default: labels,merge_queue,lock,feedback,last_call,milestones,lgtm,translation_comment,pr_actions
|
||||||
|
|
||||||
permissions:
|
permissions: {}
|
||||||
contents: read
|
|
||||||
issues: write
|
|
||||||
pull-requests: write
|
|
||||||
statuses: write
|
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ format('{0}-{1}', github.workflow, (github.event_name == 'pull_request_target' || github.event_name == 'pull_request_review') && format('pr-{0}', github.event.pull_request.number) || 'maintenance') }}
|
group: ${{ format('{0}-{1}', github.workflow, (github.event_name == 'pull_request_target' || github.event_name == 'pull_request_review') && format('pr-{0}', github.event.pull_request.number) || 'maintenance') }}
|
||||||
@@ -55,6 +51,11 @@ jobs:
|
|||||||
if: github.repository == 'go-gitea/gitea'
|
if: github.repository == 'go-gitea/gitea'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
issues: write
|
||||||
|
pull-requests: write
|
||||||
|
statuses: write
|
||||||
steps:
|
steps:
|
||||||
# pull_request_review runs without repository secrets on fork PRs, so fall
|
# pull_request_review runs without repository secrets on fork PRs, so fall
|
||||||
# back to the workflow token for the non-backport checks handled here.
|
# back to the workflow token for the non-backport checks handled here.
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ jobs:
|
|||||||
timeout-minutes: 50
|
timeout-minutes: 50
|
||||||
services:
|
services:
|
||||||
pgsql:
|
pgsql:
|
||||||
image: postgres:14
|
image: postgres:14@sha256:caf49e3b10d377aa2cfee478591d623808527beb27125d38797b418013f72d81
|
||||||
env:
|
env:
|
||||||
POSTGRES_DB: test
|
POSTGRES_DB: test
|
||||||
POSTGRES_PASSWORD: postgres
|
POSTGRES_PASSWORD: postgres
|
||||||
@@ -35,7 +35,7 @@ jobs:
|
|||||||
minio:
|
minio:
|
||||||
# as github actions doesn't support "entrypoint", we need to use a non-official image
|
# as github actions doesn't support "entrypoint", we need to use a non-official image
|
||||||
# that has a custom entrypoint set to "minio server /data"
|
# that has a custom entrypoint set to "minio server /data"
|
||||||
image: bitnamilegacy/minio:2025.7.23
|
image: bitnamilegacy/minio:2025.7.23@sha256:8935e75fa5d11295c17171e4aa49efe390a1193cd7f12e4d21b92af9ffef09d7
|
||||||
env:
|
env:
|
||||||
MINIO_ROOT_USER: 123456
|
MINIO_ROOT_USER: 123456
|
||||||
MINIO_ROOT_PASSWORD: 12345678
|
MINIO_ROOT_PASSWORD: 12345678
|
||||||
@@ -57,7 +57,7 @@ jobs:
|
|||||||
timeout-minutes: 50
|
timeout-minutes: 50
|
||||||
services:
|
services:
|
||||||
pgsql:
|
pgsql:
|
||||||
image: postgres:14
|
image: postgres:14@sha256:caf49e3b10d377aa2cfee478591d623808527beb27125d38797b418013f72d81
|
||||||
env:
|
env:
|
||||||
POSTGRES_DB: test
|
POSTGRES_DB: test
|
||||||
POSTGRES_PASSWORD: postgres
|
POSTGRES_PASSWORD: postgres
|
||||||
@@ -71,7 +71,7 @@ jobs:
|
|||||||
minio:
|
minio:
|
||||||
# as github actions doesn't support "entrypoint", we need to use a non-official image
|
# as github actions doesn't support "entrypoint", we need to use a non-official image
|
||||||
# that has a custom entrypoint set to "minio server /data"
|
# that has a custom entrypoint set to "minio server /data"
|
||||||
image: bitnamilegacy/minio:2025.7.23
|
image: bitnamilegacy/minio:2025.7.23@sha256:8935e75fa5d11295c17171e4aa49efe390a1193cd7f12e4d21b92af9ffef09d7
|
||||||
env:
|
env:
|
||||||
MINIO_ROOT_USER: 123456
|
MINIO_ROOT_USER: 123456
|
||||||
MINIO_ROOT_PASSWORD: 12345678
|
MINIO_ROOT_PASSWORD: 12345678
|
||||||
@@ -115,7 +115,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
services:
|
services:
|
||||||
elasticsearch:
|
elasticsearch:
|
||||||
image: docker.elastic.co/elasticsearch/elasticsearch:8.19.15
|
image: docker.elastic.co/elasticsearch/elasticsearch:8.19.15@sha256:aeda96cd85b0cadeb3a3b900789f3b85e902c994052dadbaf8dd99a539e2ef93
|
||||||
env:
|
env:
|
||||||
discovery.type: single-node
|
discovery.type: single-node
|
||||||
xpack.security.enabled: false
|
xpack.security.enabled: false
|
||||||
@@ -125,7 +125,7 @@ jobs:
|
|||||||
ports:
|
ports:
|
||||||
- "9200:9200"
|
- "9200:9200"
|
||||||
meilisearch:
|
meilisearch:
|
||||||
image: getmeili/meilisearch:v1
|
image: getmeili/meilisearch:v1@sha256:d36e713e8f89483af1ab0d72011bbd503f5ab100b68ccbfad51c39e3f0a0567d
|
||||||
env:
|
env:
|
||||||
MEILI_ENV: development # disable auth
|
MEILI_ENV: development # disable auth
|
||||||
ports:
|
ports:
|
||||||
@@ -140,7 +140,7 @@ jobs:
|
|||||||
ports:
|
ports:
|
||||||
- 6379:6379
|
- 6379:6379
|
||||||
minio:
|
minio:
|
||||||
image: bitnamilegacy/minio:2025.7.23
|
image: bitnamilegacy/minio:2025.7.23@sha256:8935e75fa5d11295c17171e4aa49efe390a1193cd7f12e4d21b92af9ffef09d7
|
||||||
env:
|
env:
|
||||||
MINIO_ROOT_USER: 123456
|
MINIO_ROOT_USER: 123456
|
||||||
MINIO_ROOT_PASSWORD: 12345678
|
MINIO_ROOT_PASSWORD: 12345678
|
||||||
@@ -182,7 +182,7 @@ jobs:
|
|||||||
services:
|
services:
|
||||||
mysql:
|
mysql:
|
||||||
# the bitnami mysql image has more options than the official one, it's easier to customize
|
# the bitnami mysql image has more options than the official one, it's easier to customize
|
||||||
image: bitnamilegacy/mysql:8.4
|
image: bitnamilegacy/mysql:8.4@sha256:7089d796fc9b4629a628bd445e4afabe607351ee665444c3197bdeaed812ea65
|
||||||
env:
|
env:
|
||||||
ALLOW_EMPTY_PASSWORD: true
|
ALLOW_EMPTY_PASSWORD: true
|
||||||
MYSQL_DATABASE: testgitea
|
MYSQL_DATABASE: testgitea
|
||||||
@@ -191,7 +191,7 @@ jobs:
|
|||||||
options: >-
|
options: >-
|
||||||
--mount type=tmpfs,destination=/bitnami/mysql/data
|
--mount type=tmpfs,destination=/bitnami/mysql/data
|
||||||
elasticsearch:
|
elasticsearch:
|
||||||
image: docker.elastic.co/elasticsearch/elasticsearch:8.19.15
|
image: docker.elastic.co/elasticsearch/elasticsearch:8.19.15@sha256:aeda96cd85b0cadeb3a3b900789f3b85e902c994052dadbaf8dd99a539e2ef93
|
||||||
env:
|
env:
|
||||||
discovery.type: single-node
|
discovery.type: single-node
|
||||||
xpack.security.enabled: false
|
xpack.security.enabled: false
|
||||||
@@ -229,7 +229,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
services:
|
services:
|
||||||
mssql:
|
mssql:
|
||||||
image: mcr.microsoft.com/mssql/server:2019-latest
|
image: mcr.microsoft.com/mssql/server:2019-latest@sha256:46f719fd3457d4e7e8e5845fe00c35c20e7bae7ff1e8b9fe595f2a81029f5ba8
|
||||||
env:
|
env:
|
||||||
ACCEPT_EULA: Y
|
ACCEPT_EULA: Y
|
||||||
MSSQL_PID: Standard
|
MSSQL_PID: Standard
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ concurrency:
|
|||||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
labeler:
|
labeler:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
@@ -31,10 +31,11 @@ jobs:
|
|||||||
- name: Publish snap
|
- name: Publish snap
|
||||||
run: |
|
run: |
|
||||||
for attempt in 1 2 3 4 5; do
|
for attempt in 1 2 3 4 5; do
|
||||||
snapcraft upload "${{ steps.build.outputs.snap }}" --release latest/edge && exit 0
|
snapcraft upload "$SNAP" --release latest/edge && exit 0
|
||||||
echo "::warning::snap upload attempt $attempt failed, retrying in 15s"
|
echo "::warning::snap upload attempt $attempt failed, retrying in 15s"
|
||||||
sleep 15
|
sleep 15
|
||||||
done
|
done
|
||||||
exit 1
|
exit 1
|
||||||
env:
|
env:
|
||||||
|
SNAP: ${{ steps.build.outputs.snap }}
|
||||||
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}
|
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ concurrency:
|
|||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
nightly-binary:
|
nightly-binary:
|
||||||
runs-on: namespace-profile-gitea-release-binary
|
runs-on: namespace-profile-gitea-release-binary
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ concurrency:
|
|||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: false
|
cancel-in-progress: false
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
binary:
|
binary:
|
||||||
runs-on: namespace-profile-gitea-release-binary
|
runs-on: namespace-profile-gitea-release-binary
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ concurrency:
|
|||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: false
|
cancel-in-progress: false
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
binary:
|
binary:
|
||||||
runs-on: namespace-profile-gitea-release-binary
|
runs-on: namespace-profile-gitea-release-binary
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
rules:
|
||||||
|
anonymous-definition:
|
||||||
|
disable: true
|
||||||
|
undocumented-permissions:
|
||||||
|
disable: true
|
||||||
|
concurrency-limits:
|
||||||
|
disable: true
|
||||||
@@ -348,7 +348,7 @@ lint-editorconfig:
|
|||||||
.PHONY: lint-actions
|
.PHONY: lint-actions
|
||||||
lint-actions: .venv ## lint action workflow files
|
lint-actions: .venv ## lint action workflow files
|
||||||
@$(GO) run $(ACTIONLINT_PACKAGE)
|
@$(GO) run $(ACTIONLINT_PACKAGE)
|
||||||
@uv run --frozen zizmor --quiet --min-confidence=medium .github
|
@uv run --frozen zizmor --quiet --persona=pedantic --min-confidence=medium .github
|
||||||
|
|
||||||
.PHONY: lint-shell
|
.PHONY: lint-shell
|
||||||
lint-shell: ## lint shell scripts
|
lint-shell: ## lint shell scripts
|
||||||
|
|||||||
@@ -100,6 +100,10 @@
|
|||||||
"matchPackageNames": ["mcr.microsoft.com/mssql/server"],
|
"matchPackageNames": ["mcr.microsoft.com/mssql/server"],
|
||||||
"allowedVersions": "/^2019($|[.-])/", // pin to oldest in extended support
|
"allowedVersions": "/^2019($|[.-])/", // pin to oldest in extended support
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"matchPackageNames": ["docker.elastic.co/elasticsearch/elasticsearch"],
|
||||||
|
"allowedVersions": "/^8($|[.-])/", // pin to oldest supported major
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"matchManagers": ["gomod"],
|
"matchManagers": ["gomod"],
|
||||||
"postUpdateOptions": ["gomodUpdateImportPaths"],
|
"postUpdateOptions": ["gomodUpdateImportPaths"],
|
||||||
|
|||||||
Reference in New Issue
Block a user