diff --git a/.github/codeql/codeql-actions-critical-security.yml b/.github/codeql/codeql-actions-critical-security.yml new file mode 100644 index 00000000000..bd638a6a667 --- /dev/null +++ b/.github/codeql/codeql-actions-critical-security.yml @@ -0,0 +1,8 @@ +name: openclaw-codeql-actions-critical-security + +paths: + - .github/actions + - .github/workflows + +paths-ignore: + - .github/workflows/stale.yml diff --git a/.github/codeql/codeql-javascript-typescript-critical-quality.yml b/.github/codeql/codeql-javascript-typescript-critical-quality.yml new file mode 100644 index 00000000000..f78b35ffd96 --- /dev/null +++ b/.github/codeql/codeql-javascript-typescript-critical-quality.yml @@ -0,0 +1,54 @@ +name: openclaw-codeql-javascript-typescript-critical-quality + +disable-default-queries: true + +queries: + - uses: security-and-quality + +query-filters: + - include: + problem.severity: + - error + - exclude: + tags: + - security + +paths: + - src/agents/*auth*.ts + - src/agents/**/*auth*.ts + - src/agents/auth-health*.ts + - src/agents/auth-profiles + - src/agents/bash-tools.exec-host-shared.ts + - src/agents/sandbox + - src/agents/sandbox.ts + - src/agents/sandbox-*.ts + - src/config + - src/cron/service/jobs.ts + - src/cron/stagger.ts + - src/gateway/*auth*.ts + - src/gateway/**/*auth*.ts + - src/gateway/*secret*.ts + - src/gateway/**/*secret*.ts + - src/gateway/protocol/**/*secret*.ts + - src/gateway/resolve-configured-secret-input-string*.ts + - src/gateway/security-path*.ts + - src/gateway/server-methods/secrets*.ts + - src/infra/secret-file*.ts + - src/secrets + - src/security + +paths-ignore: + - "**/node_modules" + - "**/coverage" + - "**/*.generated.ts" + - "**/*.bundle.js" + - "**/*-runtime.js" + - "**/*.test.ts" + - "**/*.test.tsx" + - "**/*.e2e.test.ts" + - "**/*.e2e.test.tsx" + - "**/*test-support*" + - "**/*test-helper*" + - "**/*mock*" + - "**/*fixture*" + - "**/*bench*" diff --git a/.github/codeql/codeql-javascript-typescript-critical-security.yml b/.github/codeql/codeql-javascript-typescript-critical-security.yml new file mode 100644 index 00000000000..411ea92f447 --- /dev/null +++ b/.github/codeql/codeql-javascript-typescript-critical-security.yml @@ -0,0 +1,57 @@ +name: openclaw-codeql-javascript-typescript-critical-security + +disable-default-queries: true + +queries: + - uses: security-extended + +query-filters: + - include: + precision: + - high + - very-high + - exclude: + problem.severity: + - recommendation + - warning + +paths: + - src/agents/*auth*.ts + - src/agents/**/*auth*.ts + - src/agents/auth-health*.ts + - src/agents/auth-profiles + - src/agents/bash-tools.exec-host-shared.ts + - src/agents/sandbox + - src/agents/sandbox.ts + - src/agents/sandbox-*.ts + - src/config/*secret*.ts + - src/config/**/*secret*.ts + - src/cron/service/jobs.ts + - src/cron/stagger.ts + - src/gateway/*auth*.ts + - src/gateway/**/*auth*.ts + - src/gateway/*secret*.ts + - src/gateway/**/*secret*.ts + - src/gateway/protocol/**/*secret*.ts + - src/gateway/resolve-configured-secret-input-string*.ts + - src/gateway/security-path*.ts + - src/gateway/server-methods/secrets*.ts + - src/infra/secret-file*.ts + - src/secrets + - src/security + +paths-ignore: + - "**/node_modules" + - "**/coverage" + - "**/*.generated.ts" + - "**/*.bundle.js" + - "**/*-runtime.js" + - "**/*.test.ts" + - "**/*.test.tsx" + - "**/*.e2e.test.ts" + - "**/*.e2e.test.tsx" + - "**/*test-support*" + - "**/*test-helper*" + - "**/*mock*" + - "**/*fixture*" + - "**/*bench*" diff --git a/.github/codeql/codeql-javascript-typescript.yml b/.github/codeql/codeql-javascript-typescript.yml deleted file mode 100644 index cda13cdcaff..00000000000 --- a/.github/codeql/codeql-javascript-typescript.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: openclaw-codeql-javascript-typescript - -paths: - - src - - extensions - - ui/src - - skills - -paths-ignore: - - apps - - dist - - docs - - "**/node_modules" - - "**/coverage" - - "**/*.generated.ts" - - "**/*.bundle.js" - - "**/*-runtime.js" - - "**/*.test.ts" - - "**/*.test.tsx" - - "**/*.e2e.test.ts" - - "**/*.e2e.test.tsx" diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 1f4eead39f7..5e17e66e168 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -2,12 +2,22 @@ name: CodeQL on: workflow_dispatch: + inputs: + profile: + description: CodeQL profile to run + required: false + default: all + type: choice + options: + - all + - security + - quality schedule: - cron: "0 6 * * *" concurrency: - group: codeql-${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} - cancel-in-progress: ${{ github.event_name == 'pull_request' }} + group: codeql-${{ github.workflow }}-${{ github.event_name == 'workflow_dispatch' && github.run_id || github.sha }} + cancel-in-progress: false env: FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true" @@ -18,121 +28,58 @@ permissions: security-events: write jobs: - analyze: - name: Analyze (${{ matrix.language }}) + critical-security: + name: Critical Security (${{ matrix.language }}) + if: ${{ github.event_name != 'workflow_dispatch' || inputs.profile == 'all' || inputs.profile == 'security' }} runs-on: ${{ matrix.runs_on }} + timeout-minutes: ${{ matrix.timeout_minutes }} strategy: fail-fast: false matrix: include: - language: javascript-typescript - runs_on: blacksmith-32vcpu-ubuntu-2404 - needs_node: true - needs_python: false - needs_java: false - needs_swift_tools: false - needs_manual_build: false - needs_autobuild: false - config_file: ./.github/codeql/codeql-javascript-typescript.yml + runs_on: ubuntu-24.04 + timeout_minutes: 25 + config_file: ./.github/codeql/codeql-javascript-typescript-critical-security.yml - language: actions - runs_on: blacksmith-16vcpu-ubuntu-2404 - needs_node: false - needs_python: false - needs_java: false - needs_swift_tools: false - needs_manual_build: false - needs_autobuild: false - config_file: "" - - language: python - runs_on: blacksmith-16vcpu-ubuntu-2404 - needs_node: false - needs_python: true - needs_java: false - needs_swift_tools: false - needs_manual_build: false - needs_autobuild: false - config_file: "" - - language: java-kotlin - runs_on: blacksmith-16vcpu-ubuntu-2404 - needs_node: false - needs_python: false - needs_java: true - needs_swift_tools: false - needs_manual_build: true - needs_autobuild: false - config_file: "" - - language: swift - runs_on: ${{ github.repository == 'openclaw/openclaw' && 'blacksmith-12vcpu-macos-latest' || 'macos-latest' }} - needs_node: false - needs_python: false - needs_java: false - needs_swift_tools: true - needs_manual_build: true - needs_autobuild: false - config_file: "" + runs_on: ubuntu-24.04 + timeout_minutes: 10 + config_file: ./.github/codeql/codeql-actions-critical-security.yml steps: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 with: submodules: false - - name: Setup Node environment - if: matrix.needs_node - uses: ./.github/actions/setup-node-env - with: - install-bun: "false" - - - name: Setup Python - if: matrix.needs_python - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 - with: - python-version: "3.12" - - - name: Setup Java - if: matrix.needs_java - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 - with: - distribution: temurin - java-version: "21" - - - name: Setup Swift build tools - if: matrix.needs_swift_tools - run: | - sudo xcode-select -s /Applications/Xcode_26.1.app - xcodebuild -version - brew install xcodegen swiftlint swiftformat - swift --version - - name: Initialize CodeQL uses: github/codeql-action/init@b25d0ebf40e5b63ee81e1bd6e5d2a12b7c2aeb61 # v4 with: languages: ${{ matrix.language }} - queries: security-and-quality - config-file: ${{ matrix.config_file || '' }} - - - name: Autobuild - if: matrix.needs_autobuild - uses: github/codeql-action/autobuild@b25d0ebf40e5b63ee81e1bd6e5d2a12b7c2aeb61 # v4 - - - name: Build Android for CodeQL - if: matrix.language == 'java-kotlin' - working-directory: apps/android - run: ./gradlew --no-daemon :app:assemblePlayDebug - - - name: Build Swift for CodeQL - if: matrix.language == 'swift' - run: | - set -euo pipefail - swift build --package-path apps/macos --configuration release - cd apps/ios - xcodegen generate - xcodebuild build \ - -project OpenClaw.xcodeproj \ - -scheme OpenClaw \ - -destination "generic/platform=iOS Simulator" \ - CODE_SIGNING_ALLOWED=NO + config-file: ${{ matrix.config_file }} - name: Analyze uses: github/codeql-action/analyze@b25d0ebf40e5b63ee81e1bd6e5d2a12b7c2aeb61 # v4 with: - category: "/language:${{ matrix.language }}" + category: "/codeql-critical-security/${{ matrix.language }}" + + critical-quality: + name: Critical Quality (javascript-typescript) + if: ${{ github.event_name != 'workflow_dispatch' || inputs.profile == 'all' || inputs.profile == 'quality' }} + runs-on: ubuntu-24.04 + timeout-minutes: 25 + steps: + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + with: + submodules: false + + - name: Initialize CodeQL + uses: github/codeql-action/init@b25d0ebf40e5b63ee81e1bd6e5d2a12b7c2aeb61 # v4 + with: + languages: javascript-typescript + config-file: ./.github/codeql/codeql-javascript-typescript-critical-quality.yml + + - name: Analyze + uses: github/codeql-action/analyze@b25d0ebf40e5b63ee81e1bd6e5d2a12b7c2aeb61 # v4 + with: + category: "/codeql-critical-quality/javascript-typescript" diff --git a/docs/ci.md b/docs/ci.md index 6dee5bf16a7..209cebae8cf 100644 --- a/docs/ci.md +++ b/docs/ci.md @@ -192,6 +192,16 @@ listed PRs when `apply=true`. Before mutating GitHub, it verifies that the landed PR is merged and that each duplicate has either a shared referenced issue or overlapping changed hunks. +The `CodeQL` workflow is intentionally a narrow first-pass scanner, not the +full repository sweep. Daily and manual runs scan Actions workflow code plus the +highest-risk JavaScript/TypeScript auth, secrets, sandbox, cron, and gateway +surfaces. The critical security lane uses high-precision security queries, and +the separate critical quality lane runs only error-severity non-security +queries over the same narrow JavaScript/TypeScript surface. Swift, Android, +Python, UI, and bundled-plugin CodeQL expansion should be added back as scoped +or sharded follow-up work only after the narrow profile has stable runtime and +signal. + The `Docs Agent` workflow is an event-driven Codex maintenance lane for keeping existing docs aligned with recently landed changes. It has no pure schedule: a successful non-bot push CI run on `main` can trigger it, and manual dispatch can