mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-07-26 11:49:16 +00:00
ci: harden supply chain (SHA pin actions, least-privilege permissions) (#475)
Pin three third-party actions to full commit SHAs with version comments so dependabot can update them in place without exposing the pipeline to upstream tag tampering: - aquasecurity/trivy-action@v0.35.0 - peter-evans/create-pull-request@v8.1.1 - googleapis/release-please-action@v4.4.0 Add a workflow-level permissions: contents: read default to ci.yml, with update-screenshots keeping its explicit contents: write + pull-requests: write override. Add the same default to docker-publish.yml (single job). Expand .dockerignore to explicitly exclude .env*, *.key, *.pem, .github/, docs/, website/, e2e/, tests/, test-results/, and playwright-report/ as defense in depth against accidental build-context leaks. None of these paths are read by any COPY step in Dockerfile.
This commit is contained in:
+20
-1
@@ -2,7 +2,26 @@
|
|||||||
**/dist
|
**/dist
|
||||||
.git
|
.git
|
||||||
.gitignore
|
.gitignore
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Docs and non-runtime content. Not needed in the image, bloats build context.
|
||||||
plans/
|
plans/
|
||||||
Product Requirements Document
|
Product Requirements Document
|
||||||
*.md
|
*.md
|
||||||
.DS_Store
|
docs/
|
||||||
|
website/
|
||||||
|
|
||||||
|
# Tests and reports. Never shipped in the image.
|
||||||
|
e2e/
|
||||||
|
tests/
|
||||||
|
test-results/
|
||||||
|
playwright-report/
|
||||||
|
|
||||||
|
# CI config runs on GitHub Actions, not inside the image.
|
||||||
|
.github/
|
||||||
|
|
||||||
|
# Secrets and key material. Defense in depth against accidental context leaks.
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
*.key
|
||||||
|
*.pem
|
||||||
|
|||||||
@@ -17,6 +17,11 @@ concurrency:
|
|||||||
group: ci-${{ github.ref }}
|
group: ci-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
# Least-privilege default for every job. Individual jobs may override (e.g.
|
||||||
|
# update-screenshots needs contents: write + pull-requests: write to open a PR).
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Build & Validation (PRs only, skipped for release-please PRs)
|
# Build & Validation (PRs only, skipped for release-please PRs)
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
@@ -118,7 +123,7 @@ jobs:
|
|||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
- name: Scan image for vulnerabilities (Trivy)
|
- name: Scan image for vulnerabilities (Trivy)
|
||||||
uses: aquasecurity/trivy-action@master
|
uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # v0.35.0
|
||||||
with:
|
with:
|
||||||
image-ref: sencho:pr-test
|
image-ref: sencho:pr-test
|
||||||
exit-code: '1'
|
exit-code: '1'
|
||||||
@@ -195,7 +200,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Open / update screenshots PR
|
- name: Open / update screenshots PR
|
||||||
id: create-pr
|
id: create-pr
|
||||||
uses: peter-evans/create-pull-request@v8
|
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.DOCS_REPO_TOKEN }}
|
token: ${{ secrets.DOCS_REPO_TOKEN }}
|
||||||
branch: chore/refresh-screenshots
|
branch: chore/refresh-screenshots
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ jobs:
|
|||||||
name: Push Docker image to Docker Hub
|
name: Push Docker image to Docker Hub
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
steps:
|
steps:
|
||||||
- name: Check out the repo
|
- name: Check out the repo
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ jobs:
|
|||||||
release-please:
|
release-please:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: googleapis/release-please-action@v4
|
- uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4.4.0
|
||||||
with:
|
with:
|
||||||
# GITHUB_TOKEN cannot trigger other workflows (GitHub security restriction).
|
# GITHUB_TOKEN cannot trigger other workflows (GitHub security restriction).
|
||||||
# Using DOCS_REPO_TOKEN (PAT) ensures the tag push from release-please
|
# Using DOCS_REPO_TOKEN (PAT) ensures the tag push from release-please
|
||||||
|
|||||||
Reference in New Issue
Block a user