Skip to content

Every analytics tool wants a subscription. And your data. I built Twiligent instead. YouTube stats. Instagram stats. One dashboard. Runs locally on your machine.

ci: give every workflow a read-only GITHUB_TOKEN

spacesdrive5a452e5275e7
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ebadfb3..ad783e3 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -7,6 +7,10 @@ on:
branches-ignore: [main]
workflow_dispatch:
+# the GITHUB_TOKEN only reads the repository; deploys authenticate to Cloudflare with their own secrets
+permissions:
+ contents: read
+
jobs:
check:
runs-on: ubuntu-latest
diff --git a/.github/workflows/deploy-backend.yml b/.github/workflows/deploy-backend.yml
index 83d94cb..35faeaa 100644
--- a/.github/workflows/deploy-backend.yml
+++ b/.github/workflows/deploy-backend.yml
@@ -12,6 +12,10 @@ on:
- '.github/workflows/deploy-backend.yml'
workflow_dispatch:
+# the GITHUB_TOKEN only reads the repository; deploys authenticate to Cloudflare with their own secrets
+permissions:
+ contents: read
+
jobs:
deploy:
runs-on: ubuntu-latest
diff --git a/.github/workflows/deploy-frontend.yml b/.github/workflows/deploy-frontend.yml
index 9f08c39..94154c1 100644
--- a/.github/workflows/deploy-frontend.yml
+++ b/.github/workflows/deploy-frontend.yml
@@ -12,6 +12,10 @@ on:
- '.github/workflows/deploy-frontend.yml'
workflow_dispatch:
+# the GITHUB_TOKEN only reads the repository; deploys authenticate to Cloudflare with their own secrets
+permissions:
+ contents: read
+
jobs:
deploy:
runs-on: ubuntu-latest
diff --git a/.github/workflows/deploy-site.yml b/.github/workflows/deploy-site.yml
index bbc64f0..de824c4 100644
--- a/.github/workflows/deploy-site.yml
+++ b/.github/workflows/deploy-site.yml
@@ -11,6 +11,10 @@ on:
- '.github/workflows/deploy-site.yml'
workflow_dispatch:
+# the GITHUB_TOKEN only reads the repository; deploys authenticate to Cloudflare with their own secrets
+permissions:
+ contents: read
+
jobs:
deploy:
runs-on: ubuntu-latest
diff --git a/.github/workflows/publish-scheduled.yml b/.github/workflows/publish-scheduled.yml
index 150fa9b..e304fd6 100644
--- a/.github/workflows/publish-scheduled.yml
+++ b/.github/workflows/publish-scheduled.yml
@@ -25,6 +25,10 @@ concurrency:
group: publish-scheduled
cancel-in-progress: false
+# the GITHUB_TOKEN only reads the repository; the publisher reaches Supabase and Instagram with its own secrets
+permissions:
+ contents: read
+
jobs:
publish:
runs-on: ubuntu-latest
diff --git a/docs/architecture/cloudflare/CI_CD.md b/docs/architecture/cloudflare/CI_CD.md
index 45f8be6..0afa31b 100644
--- a/docs/architecture/cloudflare/CI_CD.md
+++ b/docs/architecture/cloudflare/CI_CD.md
@@ -178,6 +178,8 @@ Native binaries such as workerd, esbuild, rollup, lightningcss and Tailwind's ox
Every third-party action is pinned to a full commit SHA, with the tag it came from in a comment (`actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4`). Whoever controls an action's repository can move a tag to different code; a commit cannot change, so a compromised action release cannot reach the deploy secrets without a change to this repository. The `@v4` mentions above name the version each pin came from.
+Every workflow also sets `permissions: contents: read`, so the `GITHUB_TOKEN` a step receives can read the repository and nothing else; the deploys and the publisher reach Cloudflare, Supabase and Instagram with their own secrets.
+
To update a pin, resolve the new tag to its commit and replace the SHA and the comment together:
```bash