Skip to content

armgit / camel

Public Imported from GitHub
0

🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org

[StepSecurity] Apply security best practices (#3503)

StepSecurity Bot80b1992676b3
diff --git a/.container/Dockerfile b/.container/Dockerfile
index f29d04604..312fd8f4e 100644
--- a/.container/Dockerfile
+++ b/.container/Dockerfile
@@ -1,4 +1,4 @@
-FROM python:3.10-bookworm
+FROM python:3.10-bookworm@sha256:7dd2fbef5caa5ad7be66474411cff3a6a2dcf7f9f9cb16fd962e819f4f57b85f
RUN pip install uv
RUN groupadd -r appuser && useradd -r -g appuser appuser
diff --git a/.container/minimal_build/Dockerfile b/.container/minimal_build/Dockerfile
index 9c3cf4854..0f56fe99a 100644
--- a/.container/minimal_build/Dockerfile
+++ b/.container/minimal_build/Dockerfile
@@ -1,4 +1,4 @@
-FROM python:3.10-bookworm
+FROM python:3.10-bookworm@sha256:7dd2fbef5caa5ad7be66474411cff3a6a2dcf7f9f9cb16fd962e819f4f57b85f
RUN pip install uv
RUN groupadd -r appuser && useradd -r -g appuser appuser
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 000000000..e9496d645
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,86 @@
+version: 2
+updates:
+ - package-ecosystem: docker
+ directory: /.container
+ schedule:
+ interval: daily
+
+ - package-ecosystem: docker
+ directory: /.container/minimal_build
+ schedule:
+ interval: daily
+
+ - package-ecosystem: github-actions
+ directory: /
+ schedule:
+ interval: daily
+
+ - package-ecosystem: pip
+ directory: /apps/dilemma
+ schedule:
+ interval: daily
+
+ - package-ecosystem: pip
+ directory: /camel/benchmarks/mock_website
+ schedule:
+ interval: daily
+
+ - package-ecosystem: docker
+ directory: /camel/interpreters/docker
+ schedule:
+ interval: daily
+
+ - package-ecosystem: npm
+ directory: /camel/toolkits/hybrid_browser_toolkit/ts
+ schedule:
+ interval: daily
+
+ - package-ecosystem: docker
+ directory: /examples/runtimes/ubuntu_docker_runtime
+ schedule:
+ interval: daily
+
+ - package-ecosystem: pip
+ directory: /examples/usecases/airbnb_mcp
+ schedule:
+ interval: daily
+
+ - package-ecosystem: pip
+ directory: /examples/usecases/chat_with_github
+ schedule:
+ interval: daily
+
+ - package-ecosystem: pip
+ directory: /examples/usecases/chat_with_youtube
+ schedule:
+ interval: daily
+
+ - package-ecosystem: pip
+ directory: /examples/usecases/cloudfare_mcp_camel
+ schedule:
+ interval: daily
+
+ - package-ecosystem: pip
+ directory: /examples/usecases/codeforces_question_solver
+ schedule:
+ interval: daily
+
+ - package-ecosystem: pip
+ directory: /examples/usecases/mistral_OCR
+ schedule:
+ interval: daily
+
+ - package-ecosystem: pip
+ directory: /examples/usecases/multi_agent_research_assistant
+ schedule:
+ interval: daily
+
+ - package-ecosystem: pip
+ directory: /examples/usecases/pptx_toolkit_usecase
+ schedule:
+ interval: daily
+
+ - package-ecosystem: pip
+ directory: /examples/usecases/youtube_ocr
+ schedule:
+ interval: daily
diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml
index 3e73d2191..35d249aea 100644
--- a/.github/workflows/build_package.yml
+++ b/.github/workflows/build_package.yml
@@ -8,11 +8,19 @@ on:
- "**/*.md"
- "LICENSE"
+permissions:
+ contents: read
+
jobs:
build:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - name: Harden the runner (Audit all outbound calls)
+ uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
+ with:
+ egress-policy: audit
+
+ - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Free disk space
run: |
@@ -28,7 +36,7 @@ jobs:
df -h
- name: Set up Python environment
- uses: actions/setup-python@v3
+ uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3.1.4
with:
python-version: "3.10"
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
new file mode 100644
index 000000000..031e56333
--- /dev/null
+++ b/.github/workflows/codeql.yml
@@ -0,0 +1,78 @@
+# For most projects, this workflow file will not need changing; you simply need
+# to commit it to your repository.
+#
+# You may wish to alter this file to override the set of languages analyzed,
+# or to provide custom queries or build logic.
+#
+# ******** NOTE ********
+# We have attempted to detect the languages in your repository. Please check
+# the `language` matrix defined below to confirm you have the correct set of
+# supported CodeQL languages.
+#
+name: "CodeQL"
+
+on:
+ push:
+ branches: ["master"]
+ pull_request:
+ # The branches below must be a subset of the branches above
+ branches: ["master"]
+ schedule:
+ - cron: "0 0 * * 1"
+
+permissions:
+ contents: read
+
+jobs:
+ analyze:
+ name: Analyze
+ runs-on: ubuntu-latest
+ permissions:
+ actions: read
+ contents: read
+ security-events: write
+
+ strategy:
+ fail-fast: false
+ matrix:
+ language: ["javascript", "python", "typescript"]
+ # CodeQL supports [ $supported-codeql-languages ]
+ # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
+
+ steps:
+ - name: Harden the runner (Audit all outbound calls)
+ uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
+ with:
+ egress-policy: audit
+
+ - name: Checkout repository
+ uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
+
+ # Initializes the CodeQL tools for scanning.
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@497990dfed22177a82ba1bbab381bc8f6d27058f # v3.31.6
+ with:
+ languages: ${{ matrix.language }}
+ # If you wish to specify custom queries, you can do so here or in a config file.
+ # By default, queries listed here will override any specified in a config file.
+ # Prefix the list here with "+" to use these queries and those in the config file.
+
+ # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
+ # If this step fails, then you should remove it and run the build manually (see below)
+ - name: Autobuild
+ uses: github/codeql-action/autobuild@497990dfed22177a82ba1bbab381bc8f6d27058f # v3.31.6
+
+ # ℹ️ Command-line programs to run using the OS shell.
+ # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
+
+ # If the Autobuild fails above, remove it and uncomment the following three lines.
+ # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
+
+ # - run: |
+ # echo "Run, Build Application using script"
+ # ./location_of_script_within_repo/buildscript.sh
+
+ - name: Perform CodeQL Analysis
+ uses: github/codeql-action/analyze@497990dfed22177a82ba1bbab381bc8f6d27058f # v3.31.6
+ with:
+ category: "/language:${{matrix.language}}"
diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml
new file mode 100644
index 000000000..d9284f67a
--- /dev/null
+++ b/.github/workflows/dependency-review.yml
@@ -0,0 +1,27 @@
+# Dependency Review Action
+#
+# This Action will scan dependency manifest files that change as part of a Pull Request,
+# surfacing known-vulnerable versions of the packages declared or updated in the PR.
+# Once installed, if the workflow run is marked as required,
+# PRs introducing known-vulnerable packages will be blocked from merging.
+#
+# Source repository: https://github.com/actions/dependency-review-action
+name: 'Dependency Review'
+on: [pull_request]
+
+permissions:
+ contents: read
+
+jobs:
+ dependency-review:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Harden the runner (Audit all outbound calls)
+ uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
+ with:
+ egress-policy: audit
+
+ - name: 'Checkout Repository'
+ uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
+ - name: 'Dependency Review'
+ uses: actions/dependency-review-action@3c4e3dcb1aa7874d2c16be7d79418e9b7efd6261 # v4.8.2
diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml
index e5165ae06..ac7112351 100644
--- a/.github/workflows/documentation.yml
+++ b/.github/workflows/documentation.yml
@@ -13,8 +13,13 @@ jobs:
runs-on: ubuntu-latest
steps:
+ - name: Harden the runner (Audit all outbound calls)
+ uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
+ with:
+ egress-policy: audit
+
- name: Checkout code
- uses: actions/checkout@v4
+ uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
fetch-depth: 0
persist-credentials: false
diff --git a/.github/workflows/pr-label-automation.yml b/.github/workflows/pr-label-automation.yml
index 549c18771..a15533f78 100644
--- a/.github/workflows/pr-label-automation.yml
+++ b/.github/workflows/pr-label-automation.yml
@@ -11,8 +11,13 @@ jobs:
add-labels:
runs-on: ubuntu-latest
steps:
+ - name: Harden the runner (Audit all outbound calls)
+ uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
+ with:
+ egress-policy: audit
+
- name: Add Review Required label
- uses: actions/github-script@v7
+ uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
diff --git a/.github/workflows/pre_commit.yml b/.github/workflows/pre_commit.yml
index f95a6a747..aab606c1a 100644
--- a/.github/workflows/pre_commit.yml
+++ b/.github/workflows/pre_commit.yml
@@ -18,7 +18,12 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - name: Harden the runner (Audit all outbound calls)
+ uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
+ with:
+ egress-policy: audit
+
+ - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Set up Python environment and install dependencies
uses: ./.github/actions/camel_install
with:
diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml
index 8df618725..51792dafe 100644
--- a/.github/workflows/publish_release.yml
+++ b/.github/workflows/publish_release.yml
@@ -7,6 +7,9 @@ on:
workflow_dispatch:
+permissions:
+ contents: read
+
jobs:
build-and-publish-pypi:
name: Build and publish to PyPI
@@ -15,11 +18,16 @@ jobs:
contents: write
steps:
+ - name: Harden the runner (Audit all outbound calls)
+ uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
+ with:
+ egress-policy: audit
+
- name: Checkout code
- uses: actions/checkout@v4
+ uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set up Python
- uses: actions/setup-python@v4
+ uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4.9.1
with:
python-version: '3.10'
@@ -46,7 +54,7 @@ jobs:
twine upload dist/*
- name: Upload built artifacts
- uses: actions/upload-artifact@v4
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: dist
path: dist
@@ -59,11 +67,16 @@ jobs:
contents: write
steps:
+ - name: Harden the runner (Audit all outbound calls)
+ uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
+ with:
+ egress-policy: audit
+
- name: Checkout code
- uses: actions/checkout@v4
+ uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Download built artifacts
- uses: actions/download-artifact@v4
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: dist
path: dist
@@ -78,7 +91,7 @@ jobs:
fi
- name: Release to GitHub
- uses: softprops/action-gh-release@v2
+ uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
with:
generate_release_notes: true
draft: false
@@ -92,21 +105,26 @@ jobs:
packages: write
steps:
+ - name: Harden the runner (Audit all outbound calls)
+ uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
+ with:
+ egress-policy: audit
+
- name: Checkout code
- uses: actions/checkout@v4
+ uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Log in to GitHub Container Registry
- uses: docker/login-action@v3
+ uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v3
+ uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
- name: Build and Push Docker image
- uses: docker/build-push-action@v5
+ uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5.4.0
with:
context: .
file: .container/minimal_build/Dockerfile
diff --git a/.github/workflows/pytest_apps.yml b/.github/workflows/pytest_apps.yml
index cd6ba5a07..738b4774f 100644
--- a/.github/workflows/pytest_apps.yml
+++ b/.github/workflows/pytest_apps.yml
@@ -26,7 +26,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - name: Harden the runner (Audit all outbound calls)
+ uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
+ with:
+ egress-policy: audit
+
+ - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Set up Python environment and install dependencies
uses: ./.github/actions/camel_install
with:
@@ -46,7 +51,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - name: Harden the runner (Audit all outbound calls)
+ uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
+ with:
+ egress-policy: audit
+
+ - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Set up Python environment and install dependencies
uses: ./.github/actions/camel_install
with:
diff --git a/.github/workflows/pytest_package.yml b/.github/workflows/pytest_package.yml
index f985f9487..addb08b8c 100644
--- a/.github/workflows/pytest_package.yml
+++ b/.github/workflows/pytest_package.yml
@@ -24,7 +24,12 @@ jobs:
pytest_package_fast_test:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - name: Harden the runner (Audit all outbound calls)
+ uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
+ with:
+ egress-policy: audit
+
+ - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Set up Python environment and install dependencies
uses: ./.github/actions/camel_install
with:
@@ -113,7 +118,12 @@ jobs:
pytest_package_llm_test:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - name: Harden the runner (Audit all outbound calls)
+ uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
+ with:
+ egress-policy: audit
+
+ - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Set up Python environment and install dependencies
uses: ./.github/actions/camel_install
with:
@@ -202,7 +212,12 @@ jobs:
pytest_package_very_slow_test:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - name: Harden the runner (Audit all outbound calls)
+ uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
+ with:
+ egress-policy: audit
+
+ - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Set up Python environment and install dependencies
uses: ./.github/actions/camel_install
with:
diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml
index f0e72252f..46828e0bc 100644
--- a/.github/workflows/scorecard.yml
+++ b/.github/workflows/scorecard.yml
@@ -33,6 +33,11 @@ jobs:
# actions: read
steps:
+ - name: Harden the runner (Audit all outbound calls)
+ uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
+ with:
+ egress-policy: audit
+
- name: "Checkout code"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
@@ -73,6 +78,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard (optional).
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
- name: "Upload to code-scanning"
- uses: github/codeql-action/upload-sarif@v3
+ uses: github/codeql-action/upload-sarif@497990dfed22177a82ba1bbab381bc8f6d27058f # v3.31.6
with:
sarif_file: results.sarif
diff --git a/.github/workflows/test_minimal_dependency.yml b/.github/workflows/test_minimal_dependency.yml
index f82391091..da0bdbe55 100644
--- a/.github/workflows/test_minimal_dependency.yml
+++ b/.github/workflows/test_minimal_dependency.yml
@@ -9,16 +9,24 @@ on:
- "test/integration_test/**"
- ".github/workflows/test_minimal_dependency.yml"
+permissions:
+ contents: read
+
jobs:
minimal-dependency:
name: Minimal dependency check
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - name: Harden the runner (Audit all outbound calls)
+ uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
+ with:
+ egress-policy: audit
+
+ - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Set up Python
- uses: actions/setup-python@v4
+ uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4.9.1
with:
python-version: "3.10"
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 9a73c5955..72311029c 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -35,4 +35,21 @@ repos:
- id: codespell
exclude: ^(docs/reference/|docs/.*\.rst$) # Ignore auto-generated content only
additional_dependencies:
- - tomli # for python_version < '3.11'
\ No newline at end of file
+ - tomli # for python_version < '3.11'
+ - repo: https://github.com/gitleaks/gitleaks
+ rev: v8.16.3
+ hooks:
+ - id: gitleaks
+ - repo: https://github.com/pre-commit/mirrors-eslint
+ rev: v8.38.0
+ hooks:
+ - id: eslint
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v4.4.0
+ hooks:
+ - id: end-of-file-fixer
+ - id: trailing-whitespace
+ - repo: https://github.com/pylint-dev/pylint
+ rev: v2.17.2
+ hooks:
+ - id: pylint
diff --git a/camel/interpreters/docker/Dockerfile b/camel/interpreters/docker/Dockerfile
index 8a3862f37..c1d916d72 100644
--- a/camel/interpreters/docker/Dockerfile
+++ b/camel/interpreters/docker/Dockerfile
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1
-FROM ubuntu:22.04
+FROM ubuntu:22.04@sha256:104ae83764a5119017b8e8d6218fa0832b09df65aae7d5a6de29a85d813da2fb
ENV DEBIAN_FRONTEND=noninteractive
diff --git a/examples/runtimes/ubuntu_docker_runtime/Dockerfile b/examples/runtimes/ubuntu_docker_runtime/Dockerfile
index 3664e75ae..a36c72c63 100644
--- a/examples/runtimes/ubuntu_docker_runtime/Dockerfile
+++ b/examples/runtimes/ubuntu_docker_runtime/Dockerfile
@@ -1,4 +1,4 @@
-FROM ubuntu:22.04
+FROM ubuntu:22.04@sha256:104ae83764a5119017b8e8d6218fa0832b09df65aae7d5a6de29a85d813da2fb
# Set non-interactive environment
ENV DEBIAN_FRONTEND=noninteractive