From 12400b4c834e1f1e38682c444502c5109b0cd0a4 Mon Sep 17 00:00:00 2001 From: kasun Date: Mon, 23 Nov 2026 00:12:53 +0100 Subject: [PATCH 1/3] chore(ci): deploy stacks only on their own workflow changes Any file under .gitea/workflows triggered pulumi up on 03, 04 and 05, so adding an unrelated workflow would deploy all three. PR previews still watch the whole folder. --- .gitea/workflows/03-deploy-k8s-infra.yaml | 2 +- .gitea/workflows/04-deploy-k8s-apps.yaml | 2 +- .gitea/workflows/05-deploy-monitoring.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/03-deploy-k8s-infra.yaml b/.gitea/workflows/03-deploy-k8s-infra.yaml index 673f4ca..2db0c44 100644 --- a/.gitea/workflows/03-deploy-k8s-infra.yaml +++ b/.gitea/workflows/03-deploy-k8s-infra.yaml @@ -7,7 +7,7 @@ on: - main paths: - "03-k8s-infra/**" - - ".gitea/workflows/**" + - ".gitea/workflows/03-deploy-k8s-infra.yaml" pull_request: branches: - main diff --git a/.gitea/workflows/04-deploy-k8s-apps.yaml b/.gitea/workflows/04-deploy-k8s-apps.yaml index c0ad554..e375538 100644 --- a/.gitea/workflows/04-deploy-k8s-apps.yaml +++ b/.gitea/workflows/04-deploy-k8s-apps.yaml @@ -7,7 +7,7 @@ on: - main paths: - "04-k8s-apps/**" - - ".gitea/workflows/**" + - ".gitea/workflows/04-deploy-k8s-apps.yaml" pull_request: branches: - main diff --git a/.gitea/workflows/05-deploy-monitoring.yaml b/.gitea/workflows/05-deploy-monitoring.yaml index 033150c..f2e1384 100644 --- a/.gitea/workflows/05-deploy-monitoring.yaml +++ b/.gitea/workflows/05-deploy-monitoring.yaml @@ -7,7 +7,7 @@ on: - main paths: - "05-monitoring/**" - - ".gitea/workflows/**" + - ".gitea/workflows/05-deploy-monitoring.yaml" pull_request: branches: - main From 0d5f49591a4939dc1efe3e18b2c7ce958339a2b5 Mon Sep 17 00:00:00 2001 From: kasun Date: Mon, 23 Nov 2026 00:12:55 +0100 Subject: [PATCH 2/3] chore: block secrets in commits with a Betterleaks hook The ignore file covers one old Gitea token in deleted .env.local, which was confirmed revoked (API returned 401). --- .betterleaksignore | 2 ++ .githooks/pre-commit | 11 +++++++++++ .gitignore | 4 +++- 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 .betterleaksignore create mode 100755 .githooks/pre-commit diff --git a/.betterleaksignore b/.betterleaksignore new file mode 100644 index 0000000..3d4d11e --- /dev/null +++ b/.betterleaksignore @@ -0,0 +1,2 @@ +# Old Gitea token in deleted .env.local. Confirmed revoked (API returned 401) on 2026-11-22. +8c69ec772ab5f0df73fa2614e5b8b22adb9bbd15:.env.local:gitea-access-token:2 diff --git a/.githooks/pre-commit b/.githooks/pre-commit new file mode 100755 index 0000000..1416c72 --- /dev/null +++ b/.githooks/pre-commit @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +# Git pre-commit hook: blocks a commit if its staged changes contain a secret. +# +# Activate once per clone: git config core.hooksPath .githooks +# Skip in an emergency: git commit --no-verify +if ! command -v betterleaks >/dev/null 2>&1; then + echo "pre-commit: betterleaks is not installed, so staged changes can't be scanned" >&2 + exit 1 +fi + +exec betterleaks git --pre-commit --staged --redact --no-banner --no-color . diff --git a/.gitignore b/.gitignore index 340f7d1..20ec77e 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,6 @@ node_modules/ bin/ Pulumi.dev.yaml sdks/ -.env \ No newline at end of file +.env +.env.* +!.env.example From 9b388ff8e2abd3928a22850a043eeca4403480f8 Mon Sep 17 00:00:00 2001 From: kasun Date: Mon, 23 Nov 2026 00:12:57 +0100 Subject: [PATCH 3/3] chore(ci): scan full Git history for secrets Covers commits that never ran the local hook, such as edits made in the Gitea web editor. --- .gitea/workflows/secret-scan.yaml | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .gitea/workflows/secret-scan.yaml diff --git a/.gitea/workflows/secret-scan.yaml b/.gitea/workflows/secret-scan.yaml new file mode 100644 index 0000000..de40d57 --- /dev/null +++ b/.gitea/workflows/secret-scan.yaml @@ -0,0 +1,34 @@ +name: Secret Scan + +on: + workflow_dispatch: + push: + branches: + - main + pull_request: + branches: + - main + +env: + BETTERLEAKS_VERSION: "1.10.1" + BETTERLEAKS_SHA256: c174b42d7aa60caf58c0c3e555c0e4bed01fe6b0d99a412bce777b5af4ce913e + +jobs: + scan: + name: Betterleaks + runs-on: ubuntu-latest + steps: + - name: Checkout Full History + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install Betterleaks + run: | + curl -fsSL -o /tmp/betterleaks.tar.gz \ + "https://github.com/betterleaks/betterleaks/releases/download/v${BETTERLEAKS_VERSION}/betterleaks_${BETTERLEAKS_VERSION}_linux_x64.tar.gz" + echo "${BETTERLEAKS_SHA256} /tmp/betterleaks.tar.gz" | sha256sum -c - + tar -xzf /tmp/betterleaks.tar.gz -C /tmp betterleaks + + - name: Scan Git History + run: /tmp/betterleaks git . --redact --verbose --no-banner --no-color --log-opts="--all -m -p -U0"