Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions .github/workflows/publish-security-signals-results.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,6 @@ name: Publish Security Signals results

on:
workflow_dispatch:
push:
branches:
- main
- 'pe/**'
paths:
- '.github/workflows/publish-security-signals-results.yml'
- 'cmd/clawscan/**'
- 'internal/**'
- 'leaderboard/submissions/**'
- 'scripts/publish-security-signals-results.sh'
- 'scripts/validate-security-signals-submissions.sh'

permissions:
contents: read
Expand Down
59 changes: 59 additions & 0 deletions .github/workflows/runtime-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Runtime Image

on:
push:
branches:
- main
tags:
- 'v*'
paths:
- '.github/workflows/runtime-image.yml'
- 'docker/clawscan-runtime/**'
pull_request:
paths:
- '.github/workflows/runtime-image.yml'
- 'docker/clawscan-runtime/**'
workflow_dispatch:

permissions:
contents: read
packages: write

jobs:
build:
name: Build runtime image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}

- name: Resolve image metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/clawscan-runtime
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}

- name: Build image
uses: docker/build-push-action@v6
with:
context: .
file: docker/clawscan-runtime/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
88 changes: 88 additions & 0 deletions .github/workflows/runtime-tool-updates.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Runtime Tool Updates

on:
schedule:
- cron: '17 9 1 * *'
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
update-runtime-tools:
name: Update runtime tool pins
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 24

- name: Update Dockerfile pins
run: node scripts/update-runtime-tool-versions.mjs

- name: Detect runtime pin changes
id: changes
run: |
if git diff --quiet -- docker/clawscan-runtime/Dockerfile; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
fi

- name: Build candidate runtime image
if: steps.changes.outputs.changed == 'true'
run: docker build -t clawscan-runtime:candidate docker/clawscan-runtime

- name: Smoke candidate runtime image
if: steps.changes.outputs.changed == 'true'
run: |
docker run --rm clawscan-runtime:candidate codex --help >/dev/null
docker run --rm clawscan-runtime:candidate claude --help >/dev/null
docker run --rm clawscan-runtime:candidate skillspector --help >/dev/null
docker run --rm clawscan-runtime:candidate snyk-agent-scan --help >/dev/null
docker run --rm clawscan-runtime:candidate socket --help >/dev/null
docker run --rm clawscan-runtime:candidate agentverus-scanner --help >/dev/null
docker run --rm clawscan-runtime:candidate skill-scanner --help >/dev/null

- name: Open runtime update PR
if: steps.changes.outputs.changed == 'true'
env:
GH_TOKEN: ${{ github.token }}
BRANCH: automation/runtime-tool-updates
TITLE: Update ClawScan runtime tool pins
run: |
set -euo pipefail

git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -B "$BRANCH"
git add docker/clawscan-runtime/Dockerfile
git commit -m "chore: update clawscan runtime tool pins"
git push --force-with-lease origin "$BRANCH"

cat > /tmp/runtime-tool-update-pr.md <<'EOF'
Updates pinned tool versions in `docker/clawscan-runtime/Dockerfile`.

Automated proof in this workflow:
- Docker runtime image builds.
- Baked CLIs print help successfully.

Manual merge gate:
- Build the candidate image from this branch.
- Run ClawScan with `CLAWSCAN_SANDBOX_IMAGE=clawscan-runtime:candidate`.
- Compare benchmark artifacts against the current runtime image.
- Include SkillTrustBench evidence before merge.
- Include OpenClaw Security Signals evidence when ClawHub profile behavior is affected.
- Explain any verdict drift, failure-rate change, or runtime regression.
EOF

if gh pr view "$BRANCH" --json number >/dev/null 2>&1; then
gh pr edit "$BRANCH" --title "$TITLE" --body-file /tmp/runtime-tool-update-pr.md
else
gh pr create --base main --head "$BRANCH" --title "$TITLE" --body-file /tmp/runtime-tool-update-pr.md
fi
34 changes: 29 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,33 @@ export AIG_MODEL=gpt-4.1
export AIG_MODEL_API_KEY=...
```

## Sandbox Runtime

ClawScan runs command-backed scanners and judge commands through Docker by
default. The runtime image is `ghcr.io/openclaw/clawscan-runtime:latest`, which
is built to contain the built-in scanner CLIs plus Codex and Claude Code for
judge/profile commands, so users do not need to install those tools on the host.

The Docker sandbox keeps network access on for scanner APIs, mounts only the
target/work/output paths needed by the command, and passes only the declared env
var names for the selected scanners or profile judge. ClawScan records env
presence as `present` or `missing`; it never writes secret values to artifacts.

Use the opt-out only when the surrounding environment is already isolated, such
as a locked-down CI worker where Docker is unavailable:

```bash
clawscan ./my-skill --scanner skillspector --sandbox off
CLAWSCAN_SANDBOX=off clawscan ./my-skill --scanner skillspector
```

CI runners can smoke-test Docker support with:

```bash
docker version
docker run --rm ghcr.io/openclaw/clawscan-runtime:latest skillspector --help
```

## Install

Homebrew is the recommended install path on macOS and Linux:
Expand Down Expand Up @@ -299,11 +326,8 @@ GitHub Pages publishes the docs site from `docs/` on pushes to `main`.
- Command-backed custom scanner adapters, so teams can add their own scanner
commands through a documented adapter contract once the built-in scanner
boundary has settled.
- Reusable GitHub Action or workflow for CI. The goal is a copy-pasteable way
to install ClawScan, install the dependencies needed by built-in scanners,
run a selected profile or config, and upload the JSON artifact. Judge harness
CLIs such as `codex` should stay explicit setup steps because `--judge` is an
arbitrary command supplied by the workflow author.
- Version-pinned Docker runtime image tags that pair each ClawScan release with
a reviewed scanner toolchain.

## Development

Expand Down
5 changes: 4 additions & 1 deletion cmd/clawscan/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,8 @@ Core flags:
Defaults to ./clawscan-results.json unless --json is passed.
--json Print the full artifact JSON to stdout and skip the default output file.
--judge <cmd> Optional external judge harness command.
--sandbox <docker|off> Command sandbox mode. Defaults to docker; use off only in already-isolated environments.
--sandbox-image <image> Docker runtime image. Defaults to %s or CLAWSCAN_SANDBOX_IMAGE.
--benchmark [id] Run a supported benchmark dataset instead of one target. Defaults to SkillTrustBench.
--split <name> Benchmark split. Defaults to benchmark for SkillTrustBench and eval_holdout for OpenClaw.
--limit <n> Maximum benchmark rows to run. 0 means all rows.
Expand All @@ -378,6 +380,7 @@ Built-in profiles:
%s

Required environment variables:
sandbox: CLAWSCAN_SANDBOX=off disables Docker by default; CLAWSCAN_SANDBOX_IMAGE overrides the runtime image.
clawhub judge: OPENAI_API_KEY
ai-infra-guard: AIG_BASE_URL, AIG_MODEL, AIG_MODEL_API_KEY
socket: SOCKET_TOKEN
Expand All @@ -398,5 +401,5 @@ Judge summary:
If no judge is configured, ClawScan only records scanner evidence.
If a judge is configured, ClawScan runs it through the platform shell and expects a JSON object on stdout or at {{ output }}.
Placeholders: {{ workspace }}, {{ prompt[:path] }}, {{ output_schema[:path] }}, {{ output }}.
`, strings.Join(runner.ScannerIDs(), ", "), strings.Join(profiles.ProfileIDs(), ", "))
`, runner.DefaultSandboxImage, strings.Join(runner.ScannerIDs(), ", "), strings.Join(profiles.ProfileIDs(), ", "))
}
5 changes: 5 additions & 0 deletions cmd/clawscan/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ func TestRunCommandPrintsHelp(t *testing.T) {
"--limit <n>",
"--offset <n>",
"--predictions-output <path>",
"--sandbox <docker|off>",
"--sandbox-image <image>",
"clawscan-results.json",
"Supported benchmarks:",
"cuhk-zhuque/SkillTrustBench",
Expand All @@ -40,6 +42,8 @@ func TestRunCommandPrintsHelp(t *testing.T) {
"Accepted scanner IDs:",
"agentverus, ai-infra-guard, cisco, clawscan-static, skillspector, snyk, socket, virustotal",
"Required environment variables:",
"CLAWSCAN_SANDBOX=off",
"CLAWSCAN_SANDBOX_IMAGE",
"OPENAI_API_KEY",
"AIG_BASE_URL",
"AIG_MODEL",
Expand Down Expand Up @@ -265,6 +269,7 @@ func TestRunCommandUsesBuiltInProfile(t *testing.T) {
"--scanner-result", "skillspector=" + skillSpectorFixture,
"--scanner-result", "virustotal=" + virusTotalFixture,
"--judge", "printf '{\"verdict\":\"benign\"}\\n' > {{ output }}",
"--sandbox", "off",
"--json",
}, []string{}); err != nil {
t.Fatal(err)
Expand Down
34 changes: 34 additions & 0 deletions docker/clawscan-runtime/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM python:3.12-slim

ARG SKILLSPECTOR_REF=ab0431ff2a9e9d75ba866f986be17f8600cfd086
ARG CISCO_AI_SKILL_SCANNER_VERSION=2.0.12
ARG SNYK_AGENT_SCAN_VERSION=0.5.12
ARG CLAUDE_CODE_VERSION=2.1.193
ARG OPENAI_CODEX_VERSION=0.142.2
ARG AGENTVERUS_SCANNER_VERSION=0.8.1
ARG SOCKET_CLI_VERSION=1.1.129

ENV PATH="/root/.local/bin:${PATH}" \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PYTHONUNBUFFERED=1

RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates curl git gnupg \
&& curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
&& apt-get install -y --no-install-recommends nodejs \
&& rm -rf /var/lib/apt/lists/*

RUN python -m pip install --no-cache-dir --upgrade pip uv \
&& python -m pip install --no-cache-dir \
"git+https://github.com/NVIDIA/skillspector.git@${SKILLSPECTOR_REF}" \
"cisco-ai-skill-scanner==${CISCO_AI_SKILL_SCANNER_VERSION}" \
&& uv tool install "snyk-agent-scan==${SNYK_AGENT_SCAN_VERSION}" \
&& ln -sf /root/.local/bin/snyk-agent-scan /usr/local/bin/snyk-agent-scan

RUN npm install -g \
"@anthropic-ai/claude-code@${CLAUDE_CODE_VERSION}" \
"@openai/codex@${OPENAI_CODEX_VERSION}" \
"agentverus-scanner@${AGENTVERUS_SCANNER_VERSION}" \
"socket@${SOCKET_CLI_VERSION}"

WORKDIR /workspace
37 changes: 37 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,43 @@ go run ./cmd/clawscan \
--output /tmp/clawscan-benchmark-smoke.json
```

Docker runtime smoke:

```bash
docker build -t clawscan-runtime:dev docker/clawscan-runtime
docker run --rm clawscan-runtime:dev codex --help
docker run --rm clawscan-runtime:dev claude --help
docker run --rm clawscan-runtime:dev skillspector --help
```

## Runtime Tool Updates

The runtime image pins scanner and judge-tool versions in
`docker/clawscan-runtime/Dockerfile`. Do not float these installs to `latest`:
runtime tool changes can alter scanner output, judge behavior, runtime, and
failure rate.

The `Runtime Tool Updates` workflow runs monthly, updates the pinned versions,
builds the candidate image, runs CLI smoke checks, and opens a PR. That PR must
not be auto-merged from smoke checks alone.

Before merging a runtime-tool update PR, run a benchmark comparison from the PR
branch and attach the result artifacts or summary to the PR:

```bash
docker build -t clawscan-runtime:candidate docker/clawscan-runtime

CLAWSCAN_SANDBOX_IMAGE=clawscan-runtime:candidate \
go run ./cmd/clawscan \
--benchmark SkillTrustBench \
--scanner clawscan-static \
--output /tmp/clawscan-skilltrustbench-candidate.json
```

For ClawHub-affecting changes, also compare the OpenClaw Security Signals
benchmark or the relevant ClawHub profile benchmark path. Explain any verdict
drift, scanner failures, or runtime regression before merge.

## Docs Site

The docs site is generated from Markdown in `docs/`:
Expand Down
20 changes: 20 additions & 0 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ export OPENAI_API_KEY=...
clawscan --scanner skillspector
```

By default, ClawScan runs command-backed scanners and judge commands inside the
Docker runtime image `ghcr.io/openclaw/clawscan-runtime:latest`. The sandbox
keeps network access on for scanner APIs and passes only the env var names
declared by the selected scanner or profile judge.

Run scanners that require credentials by exporting env vars next to the command:

```bash
Expand Down Expand Up @@ -86,6 +91,13 @@ To use another built-in profile over the same discovered skill targets:
clawscan --profile skills-sh
```

If Docker is unavailable because the surrounding worker is already isolated,
opt out explicitly:

```bash
clawscan --profile skills-sh --sandbox off
```

Built-in profiles:

| Profile | Scanners | Judge |
Expand Down Expand Up @@ -116,6 +128,10 @@ fails with an ambiguity error.
```yaml
version: 1

sandbox:
mode: docker
image: ghcr.io/openclaw/clawscan-runtime:latest

profiles:
clawhub-release:
scanners:
Expand All @@ -127,6 +143,8 @@ profiles:
- skillspector
- clawscan-static
output: ./clawscan-results/skills-sh-review.json
sandbox:
image: ghcr.io/acme/custom-clawscan-runtime:v1
judge:
command: judge --out {{ output }}
requiredEnv:
Expand Down Expand Up @@ -223,6 +241,8 @@ Actual secret values are never written to run artifacts.
| `--output <path>` | Write the full artifact JSON to a specific file. Defaults to `./clawscan-results.json` when `--json` is not passed. |
| `--json` | Print the full artifact JSON to stdout and skip the default output file. |
| `--judge <cmd>` | Run an optional external judge harness. |
| `--sandbox <docker|off>` | Select command sandbox mode. Defaults to Docker. |
| `--sandbox-image <image>` | Override the Docker runtime image. |
| `--benchmark [id]` | Run a supported benchmark instead of one target. Defaults to SkillTrustBench. |
| `--split <name>` | Benchmark split. Defaults to `benchmark` for SkillTrustBench and `eval_holdout` for OpenClaw. |
| `--limit <n>` | Maximum benchmark rows to run. `0` means all rows. |
Expand Down
Loading
Loading