@devries-cameron20 / composio-1 / commits / d3875f99d
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

chore(ci): add least-privilege tokens, fork-pr guards, audit gate (#3748)

This PR: - depends on #3751 (dependency fixes split out; **merge #3751 first** or the new audit gate below is red) - adds top-level `permissions: contents: read` to the 23 workflows missing one, with job-level opt-ups only where jobs demonstrably need writes (releases, docs automation PR creation, audit PR comments); the `security.secrets-detection.yml` caller job mirrors the reusable workflow's declared scopes so the secret-scanning check keeps working under the cap - pins the secrets-detection reusable-workflow ref to ComposioHQ/.github@a6c053d (master, post ComposioHQ/.github#12) whose actions are now SHA-pinned, fixing the `startup_failure` every PR was hitting - guards all four E2E jobs in `ts.test-e2e.yml` so dependabot and fork PRs (which get no secrets) skip secret-backed steps with a `::notice` instead of failing red; install/build and the secret-free CLI docker build still run on fork PRs - makes `pnpm audit --prod --audit-level=high` a hard gate in `ts.audit.yml` (the advisory PR-comment flow is unchanged) and adds root `package.json`/`pnpm-lock.yaml`/`pnpm-workspace.yaml` to the audit triggers so manifest-only changes can't bypass it - drops the orphaned job-level `pull-requests: write` from `ts.test.yml` (no step has used the PR API since the #2212 comment step was removed) ## Context Implements `plans/002-ci-hardening-permissions-and-fork-guards.md` (advisor plan, orthogonal to the SDK v1 roadmap). A hard `pnpm audit` gate was tried once before and reverted for blocking unrelated PRs (#2213, `dec0ced78`); it lands now paired with #3751, which clears the high advisories, and it only fails on high/critical advisories in production dependencies. Reviewer notes: - release workflows verified statically: `py.release` publishes via PyPI credentials (no token writes); `ts.release` does all writes via the minted GitHub App token and keeps `id-token: write` - worth a dry run after merge: one fork PR to confirm the four skip notices, and one same-repo Secrets Detection run to confirm no 403 warning (the run on this PR already passed clean) - known follow-ups (deliberately out of scope): dev-dependency high advisories (gate is `--prod`), a scheduled audit run, encoding the permissions convention in `.agents/skills/repo-guidance`, extracting the duplicated guard into a composite action

Alberto Schiabel committed Jul 4, 2026 at 12:26 UTC d3875f99d124bd1ae945d6e2cb262b209080ff5e
23 files changed +150 -7
.github/workflows/claude-code-doc-review.yml
+4
@@ -9,6 +9,10 @@ on:
9 - "docs/components/**/*.tsx"
10 - "docs/app/**/*.tsx"
11 - "docs/app/**/*.css"
12 +
13 +permissions:
14 + contents: read
15 +
16 jobs:
17 claude-review:
18 # Optional: Filter by PR author
.github/workflows/claude.yml
+3
@@ -10,6 +10,9 @@ on:
10 pull_request_review:
11 types: [submitted]
12
13 +permissions:
14 + contents: read
15 +
16 jobs:
17 claude:
18 if: |
.github/workflows/cli.test-installation.yml
+3
@@ -19,6 +19,9 @@ on:
19 default: 'latest'
20 type: string
21
22 +permissions:
23 + contents: read
24 +
25 jobs:
26 toolchain-versions:
27 name: Read toolchain test matrix
.github/workflows/docs-check-links.yml
+3
@@ -13,6 +13,9 @@ concurrency:
13 group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
14 cancel-in-progress: ${{ github.event_name == 'pull_request' }}
15
16 +permissions:
17 + contents: read
18 +
19 jobs:
20 check-links:
21 runs-on: ubuntu-latest
.github/workflows/docs-tests.yml
+3
@@ -13,6 +13,9 @@ concurrency:
13 group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
14 cancel-in-progress: ${{ github.event_name == 'pull_request' }}
15
16 +permissions:
17 + contents: read
18 +
19 jobs:
20 test:
21 runs-on: ubuntu-latest
.github/workflows/docs-typescript-check.yml
+3
@@ -13,6 +13,9 @@ concurrency:
13 group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
14 cancel-in-progress: ${{ github.event_name == 'pull_request' }}
15
16 +permissions:
17 + contents: read
18 +
19 jobs:
20 typescript-check:
21 runs-on: ubuntu-latest
.github/workflows/docs-update-data.yml
+3
@@ -7,6 +7,9 @@ on:
7 types: [apollo-production-deploy]
8 workflow_dispatch:
9
10 +permissions:
11 + contents: read
12 +
13 jobs:
14 update-data:
15 runs-on: ubuntu-latest
.github/workflows/docs.changelog-notification.yml
+3
@@ -6,6 +6,9 @@ on:
6 paths:
7 - 'docs/content/changelog/**.mdx'
8
9 +permissions:
10 + contents: read
11 +
12 jobs:
13 notify-changelog:
14 name: Send Changelog Notification
.github/workflows/docs.changelog-to-docs.yml
+3
@@ -6,6 +6,9 @@ on:
6 paths:
7 - 'docs/content/changelog/**.mdx'
8
9 +permissions:
10 + contents: read
11 +
12 jobs:
13 suggest-docs-updates:
14 name: Suggest Documentation Updates
.github/workflows/docs.health-check.yml
+3
@@ -5,6 +5,9 @@ on:
5 - cron: '0 * * * *' # Every hour
6 workflow_dispatch: # Manual trigger
7
8 +permissions:
9 + contents: read
10 +
11 jobs:
12 health-check:
13 name: Check docs accessibility
.github/workflows/docs.sdk-change-sync.yml
+3
@@ -10,6 +10,9 @@ on:
10 - 'python/composio/**'
11 workflow_dispatch:
12
13 +permissions:
14 + contents: read
15 +
16 jobs:
17 sync-docs:
18 runs-on: ubuntu-latest
.github/workflows/docs.sync-connect-clients.yml
+3
@@ -5,6 +5,9 @@ on:
5 types: [dashboard-production-deploy]
6 workflow_dispatch:
7
8 +permissions:
9 + contents: read
10 +
11 jobs:
12 sync-clients:
13 runs-on: ubuntu-latest
.github/workflows/generate-sdk-docs.yml
+3
@@ -15,6 +15,9 @@ on:
15 - 'mise.lock'
16 workflow_dispatch:
17
18 +permissions:
19 + contents: read
20 +
21 jobs:
22 generate-ts-docs:
23 runs-on: ubuntu-latest
.github/workflows/py.check.yaml
+3
@@ -22,6 +22,9 @@ concurrency:
22 group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
23 cancel-in-progress: ${{ github.event_name == 'pull_request' }}
24
25 +permissions:
26 + contents: read
27 +
28 jobs:
29 common-checks:
30 runs-on: ubuntu-latest
.github/workflows/py.release.yml
+3
@@ -11,6 +11,9 @@ on:
11 type: boolean
12 default: false
13
14 +permissions:
15 + contents: read
16 +
17 jobs:
18 publish-core:
19 name: Build and release SDK
.github/workflows/py.test.yml
+3
@@ -28,6 +28,9 @@ concurrency:
28 group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
29 cancel-in-progress: ${{ github.event_name == 'pull_request' }}
30
31 +permissions:
32 + contents: read
33 +
34 jobs:
35 toolchain-versions:
36 name: Read toolchain test matrix
.github/workflows/security.secrets-detection.yml
+11 -1
@@ -7,9 +7,19 @@ on:
7 - master
8 - next
9
10 +permissions:
11 + contents: read
12 +
13 jobs:
14 secrets:
12 - uses: ComposioHQ/.github/.github/workflows/secrets-detection.yml@7dc23a1c1c850570499a4a87f272712463fa8dcb # master
15 + # The called reusable workflow declares these scopes; a narrower caller
16 + # grant clamps its token and the secret-scanning check 403s into a warning.
17 + permissions:
18 + contents: read
19 + pull-requests: write
20 + issues: write
21 + security-events: write
22 + uses: ComposioHQ/.github/.github/workflows/secrets-detection.yml@a6c053d4cb1820a7a85bc7837efe47cc0a559e26 # master (#12: SHA-pinned actions)
23 secrets: inherit
24 with:
25 slack_channel: "buzz-security"
.github/workflows/ts.audit.yml
+13
@@ -9,6 +9,9 @@ on:
9 - '.github/workflows/ts.audit.yml'
10 - 'mise.toml'
11 - 'mise.lock'
12 + - 'package.json'
13 + - 'pnpm-lock.yaml'
14 + - 'pnpm-workspace.yaml'
15 pull_request:
16 branches: [master, next]
17 paths:
@@ -17,16 +20,23 @@ on:
20 - '.github/workflows/ts.audit.yml'
21 - 'mise.toml'
22 - 'mise.lock'
23 + - 'package.json'
24 + - 'pnpm-lock.yaml'
25 + - 'pnpm-workspace.yaml'
26
27 concurrency:
28 group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
29 cancel-in-progress: ${{ github.event_name == 'pull_request' }}
30
31 +permissions:
32 + contents: read
33 +
34 jobs:
35 audit:
36 name: Audit
37 runs-on: ubuntu-latest
38 permissions:
39 + contents: read
40 pull-requests: write
41
42 steps:
@@ -77,3 +87,6 @@ jobs:
87 with:
88 file-path: audit-comment.txt
89 comment-tag: pnpm-audit-security-warning
90 +
91 + - name: Fail on high/critical advisories
92 + run: pnpm audit --prod --audit-level=high
.github/workflows/ts.build.yml
+3
@@ -31,6 +31,9 @@ concurrency:
31 group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
32 cancel-in-progress: ${{ github.event_name == 'pull_request' }}
33
34 +permissions:
35 + contents: read
36 +
37 # Print Turborepo telemetry events to the logs instead of sending them.
38 env:
39 TURBO_TELEMETRY_DEBUG: 1
.github/workflows/ts.release.yml
+3
@@ -5,6 +5,9 @@ on:
5 push:
6 branches: [next]
7
8 +permissions:
9 + contents: read
10 +
11 # Print Turborepo telemetry events to the logs instead of sending them.
12 env:
13 TURBO_TELEMETRY_DEBUG: 1
.github/workflows/ts.test-e2e.yml
+65 -4
@@ -24,6 +24,9 @@ concurrency:
24 group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
25 cancel-in-progress: ${{ github.event_name == 'pull_request' }}
26
27 +permissions:
28 + contents: read
29 +
30 # Print Turborepo telemetry events to the logs instead of sending them.
31 env:
32 TURBO_TELEMETRY_DEBUG: 1
@@ -93,6 +96,8 @@ jobs:
96
97 - name: Check API keys
98 id: api-keys
99 + env:
100 + IS_FORK_PR: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork }}
101 run: |
102 missing=()
103 for name in COMPOSIO_API_KEY OPENAI_API_KEY ANTHROPIC_API_KEY; do
@@ -103,8 +108,8 @@ jobs:
108
109 if [ "${#missing[@]}" -gt 0 ]; then
110 echo "available=false" >> "$GITHUB_OUTPUT"
106 - if [ "$GITHUB_ACTOR" = "dependabot[bot]" ]; then
107 - echo "::notice::Skipping secret-backed Node.js E2E tests for Dependabot; missing ${missing[*]}."
111 + if [ "$GITHUB_ACTOR" = "dependabot[bot]" ] || [ "$IS_FORK_PR" = "true" ]; then
112 + echo "::notice::Skipping secret-backed E2E tests; missing ${missing[*]}."
113 exit 0
114 fi
115
@@ -179,7 +184,34 @@ jobs:
184 - name: Build
185 run: pnpm run build:packages
186
187 + - name: Check API keys
188 + id: api-keys
189 + env:
190 + IS_FORK_PR: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork }}
191 + run: |
192 + missing=()
193 + for name in COMPOSIO_API_KEY OPENAI_API_KEY; do
194 + if [ -z "${!name}" ]; then
195 + missing+=("$name")
196 + fi
197 + done
198 +
199 + if [ "${#missing[@]}" -gt 0 ]; then
200 + echo "available=false" >> "$GITHUB_OUTPUT"
201 + if [ "$GITHUB_ACTOR" = "dependabot[bot]" ] || [ "$IS_FORK_PR" = "true" ]; then
202 + echo "::notice::Skipping secret-backed E2E tests; missing ${missing[*]}."
203 + exit 0
204 + fi
205 +
206 + printf '::error::%s is not set\n' "${missing[@]}"
207 + exit 1
208 + fi
209 +
210 + echo "available=true" >> "$GITHUB_OUTPUT"
211 + echo "✅ API keys are configured"
212 +
213 - name: Run Deno E2E Tests
214 + if: steps.api-keys.outputs.available == 'true'
215 run: pnpm run test:e2e:deno
216
217 # CLI E2E tests, running in scratch Docker to isolate environment
@@ -218,6 +250,32 @@ jobs:
250 - name: Build
251 run: pnpm run build:packages
252
253 + - name: Check API keys
254 + id: api-keys
255 + env:
256 + IS_FORK_PR: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork }}
257 + run: |
258 + missing=()
259 + for name in COMPOSIO_API_KEY OPENAI_API_KEY COMPOSIO_USER_API_KEY; do
260 + if [ -z "${!name}" ]; then
261 + missing+=("$name")
262 + fi
263 + done
264 +
265 + if [ "${#missing[@]}" -gt 0 ]; then
266 + echo "available=false" >> "$GITHUB_OUTPUT"
267 + if [ "$GITHUB_ACTOR" = "dependabot[bot]" ] || [ "$IS_FORK_PR" = "true" ]; then
268 + echo "::notice::Skipping secret-backed E2E tests; missing ${missing[*]}."
269 + exit 0
270 + fi
271 +
272 + printf '::error::%s is not set\n' "${missing[@]}"
273 + exit 1
274 + fi
275 +
276 + echo "available=true" >> "$GITHUB_OUTPUT"
277 + echo "✅ API keys are configured"
278 +
279 - name: Pre-build Docker image for CLI e2e tests
280 run: |
281 CLI_VERSION=$(node -p "require('./ts/packages/cli/package.json').version")
@@ -232,6 +290,7 @@ jobs:
290 .
291
292 - name: Run CLI E2E Tests
293 + if: steps.api-keys.outputs.available == 'true'
294 run: pnpm run test:e2e:cli
295
296 # Cloudflare Workerd E2E tests
@@ -271,6 +330,8 @@ jobs:
330
331 - name: Check API keys
332 id: api-keys
333 + env:
334 + IS_FORK_PR: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork }}
335 run: |
336 missing=()
337 for name in COMPOSIO_API_KEY OPENAI_API_KEY; do
@@ -281,8 +342,8 @@ jobs:
342
343 if [ "${#missing[@]}" -gt 0 ]; then
344 echo "available=false" >> "$GITHUB_OUTPUT"
284 - if [ "$GITHUB_ACTOR" = "dependabot[bot]" ]; then
285 - echo "::notice::Skipping secret-backed Cloudflare E2E tests for Dependabot; missing ${missing[*]}."
345 + if [ "$GITHUB_ACTOR" = "dependabot[bot]" ] || [ "$IS_FORK_PR" = "true" ]; then
346 + echo "::notice::Skipping secret-backed E2E tests; missing ${missing[*]}."
347 exit 0
348 fi
349
.github/workflows/ts.test.yml
+3 -2
@@ -24,12 +24,13 @@ concurrency:
24 group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
25 cancel-in-progress: ${{ github.event_name == 'pull_request' }}
26
27 +permissions:
28 + contents: read
29 +
30 jobs:
31 test:
32 name: Test Typescript SDK
33 runs-on: ubuntu-latest
31 - permissions:
32 - pull-requests: write
34
35 steps:
36 - name: Checkout Code
.github/workflows/ts.typecheck.yml
+3
@@ -24,6 +24,9 @@ concurrency:
24 group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
25 cancel-in-progress: ${{ github.event_name == 'pull_request' }}
26
27 +permissions:
28 + contents: read
29 +
30 jobs:
31 typecheck:
32 name: Typecheck Typescript SDK