|
| 1 | +name: Audit Python SDK |
| 2 | + |
| 3 | +# Python counterpart of ts.audit.yml. Every tracked uv lockfile is exported to |
| 4 | +# a pinned requirements list and scanned with pip-audit against the PyPI |
| 5 | +# advisory database and OSV. Runtime dependencies only, matching the |
| 6 | +# `pnpm audit --prod` gate: the exports pass `--no-dev`, and workspace members |
| 7 | +# themselves are skipped since they are not published on PyPI. |
| 8 | +# |
| 9 | +# Advisories with no patched release belong in IGNORED_VULNS below, with a |
| 10 | +# comment. Do not silence the gate by dropping `--strict`. |
| 11 | + |
| 12 | +on: |
| 13 | + push: |
| 14 | + branches: [master, next] |
| 15 | + paths: |
| 16 | + - 'pyproject.toml' |
| 17 | + - 'uv.lock' |
| 18 | + - 'python/pyproject.toml' |
| 19 | + - 'python/providers/*/pyproject.toml' |
| 20 | + - 'python/providers/*/uv.lock' |
| 21 | + - '.github/actions/setup-python-uv/action.yml' |
| 22 | + - '.github/workflows/py.audit.yml' |
| 23 | + - 'mise.toml' |
| 24 | + - 'mise.lock' |
| 25 | + pull_request: |
| 26 | + branches: [master, next] |
| 27 | + paths: |
| 28 | + - 'pyproject.toml' |
| 29 | + - 'uv.lock' |
| 30 | + - 'python/pyproject.toml' |
| 31 | + - 'python/providers/*/pyproject.toml' |
| 32 | + - 'python/providers/*/uv.lock' |
| 33 | + - '.github/actions/setup-python-uv/action.yml' |
| 34 | + - '.github/workflows/py.audit.yml' |
| 35 | + - 'mise.toml' |
| 36 | + - 'mise.lock' |
| 37 | + schedule: |
| 38 | + # Advisories land without a commit; re-check the default branch weekly. |
| 39 | + - cron: '30 6 * * 5' |
| 40 | + |
| 41 | +concurrency: |
| 42 | + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }} |
| 43 | + cancel-in-progress: ${{ github.event_name == 'pull_request' }} |
| 44 | + |
| 45 | +permissions: |
| 46 | + contents: read |
| 47 | + |
| 48 | +env: |
| 49 | + PIP_AUDIT_VERSION: 2.10.1 |
| 50 | + # chromadb <=1.5.9 (via crewai, which pins chromadb~=1.1.0). Upstream has |
| 51 | + # published no patched release for any of the four advisories, so no bump |
| 52 | + # reaches them. All four affect the Chroma *server* (auth, RBAC, and code |
| 53 | + # injection in server endpoints); composio-crewai only imports the client |
| 54 | + # library through crewai and never starts a server. Drop each entry once |
| 55 | + # crewai moves to a chromadb release that closes it. |
| 56 | + # PYSEC-2026-311 = CVE-2026-45829 = GHSA-f4j7-r4q5-qw2c (pre-auth code injection) |
| 57 | + # CVE-2026-45833 = GHSA-36p7-vc44-83pf (code injection) |
| 58 | + # CVE-2026-45830 = GHSA-2wm9-hf6c-p5cr (cross-tenant data access) |
| 59 | + # CVE-2026-45831 = GHSA-xph7-9rjv-w5fr (RBAC scope not checked) |
| 60 | + IGNORED_VULNS: >- |
| 61 | + PYSEC-2026-311 |
| 62 | + CVE-2026-45833 |
| 63 | + CVE-2026-45830 |
| 64 | + CVE-2026-45831 |
| 65 | +
|
| 66 | +jobs: |
| 67 | + audit: |
| 68 | + name: Audit ${{ matrix.lock.name }} |
| 69 | + runs-on: ubuntu-latest |
| 70 | + strategy: |
| 71 | + fail-fast: false |
| 72 | + matrix: |
| 73 | + lock: |
| 74 | + # The uv workspace at the repository root: the composio package and |
| 75 | + # every provider listed in [tool.uv.workspace]. |
| 76 | + - name: workspace |
| 77 | + directory: '.' |
| 78 | + export-flags: '--all-packages' |
| 79 | + standalone: false |
| 80 | + # Provider projects with their own lockfiles, which pin the published |
| 81 | + # `composio` from PyPI rather than the workspace checkout. uv resolves |
| 82 | + # them on their own even though python/providers/openai is listed as |
| 83 | + # a workspace member: discovery walks up from the provider, hits |
| 84 | + # python/pyproject.toml first, and stops there because that project |
| 85 | + # declares no workspace. The "Check lockfile origin" step below |
| 86 | + # asserts this so a change to that layout cannot silently turn these |
| 87 | + # jobs into a re-scan of the workspace export. |
| 88 | + - name: composio-openai |
| 89 | + directory: 'python/providers/openai' |
| 90 | + export-flags: '' |
| 91 | + standalone: true |
| 92 | + - name: composio-claude-agent-sdk |
| 93 | + directory: 'python/providers/claude_agent_sdk' |
| 94 | + export-flags: '' |
| 95 | + standalone: true |
| 96 | + |
| 97 | + steps: |
| 98 | + - name: Checkout Code |
| 99 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 100 | + |
| 101 | + - name: Setup Python with UV |
| 102 | + uses: ./.github/actions/setup-python-uv |
| 103 | + with: |
| 104 | + enable-caching: 'false' |
| 105 | + |
| 106 | + - name: Export locked runtime requirements |
| 107 | + env: |
| 108 | + LOCK_DIRECTORY: ${{ matrix.lock.directory }} |
| 109 | + EXPORT_FLAGS: ${{ matrix.lock.export-flags }} |
| 110 | + run: | |
| 111 | + # shellcheck disable=SC2086 # EXPORT_FLAGS is intentionally word-split. |
| 112 | + uv export \ |
| 113 | + --frozen \ |
| 114 | + --no-dev \ |
| 115 | + --no-hashes \ |
| 116 | + --no-emit-workspace \ |
| 117 | + --directory "$LOCK_DIRECTORY" \ |
| 118 | + --output-file "$RUNNER_TEMP/requirements.txt" \ |
| 119 | + $EXPORT_FLAGS |
| 120 | + echo "Exported $(grep -c '==' "$RUNNER_TEMP/requirements.txt") pinned packages" |
| 121 | +
|
| 122 | + - name: Check lockfile origin |
| 123 | + env: |
| 124 | + LOCK_DIRECTORY: ${{ matrix.lock.directory }} |
| 125 | + STANDALONE: ${{ matrix.lock.standalone }} |
| 126 | + run: | |
| 127 | + # A standalone provider lock pins composio from PyPI, so its export |
| 128 | + # carries a `composio==` line. A workspace export never does, because |
| 129 | + # `--no-emit-workspace` drops workspace members. |
| 130 | + if grep -q '^composio==' "$RUNNER_TEMP/requirements.txt"; then |
| 131 | + origin=standalone |
| 132 | + else |
| 133 | + origin=workspace |
| 134 | + fi |
| 135 | + if [[ "$STANDALONE" == "true" && "$origin" != "standalone" ]]; then |
| 136 | + echo "::error::expected $LOCK_DIRECTORY/uv.lock to resolve on its own, but uv exported the workspace lock" |
| 137 | + exit 1 |
| 138 | + fi |
| 139 | + if [[ "$STANDALONE" != "true" && "$origin" != "workspace" ]]; then |
| 140 | + echo "::error::expected the workspace lock, but uv exported a standalone project lock" |
| 141 | + exit 1 |
| 142 | + fi |
| 143 | + echo "Audited the $origin lockfile" |
| 144 | +
|
| 145 | + - name: Run pip-audit |
| 146 | + run: | |
| 147 | + ignore_flags=() |
| 148 | + for id in $IGNORED_VULNS; do |
| 149 | + ignore_flags+=(--ignore-vuln "$id") |
| 150 | + done |
| 151 | + uvx --from "pip-audit==$PIP_AUDIT_VERSION" pip-audit \ |
| 152 | + --requirement "$RUNNER_TEMP/requirements.txt" \ |
| 153 | + --no-deps \ |
| 154 | + --strict \ |
| 155 | + --progress-spinner off \ |
| 156 | + "${ignore_flags[@]}" |
0 commit comments