Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix(security): remediate template-injection vulnerabilities in workflows

LearningCircuitafa0dd0ad0bf
diff --git a/.github/workflows/ai-code-reviewer.yml b/.github/workflows/ai-code-reviewer.yml
index b7a5d28917..37c954eddf 100644
--- a/.github/workflows/ai-code-reviewer.yml
+++ b/.github/workflows/ai-code-reviewer.yml
@@ -33,10 +33,12 @@ jobs:
sudo apt-get install -y jq
- name: Get PR diff
+ env:
+ BASE_REF: ${{ github.event.pull_request.base.ref }}
run: |
# Fetch the base branch (works for any target branch, not just main)
- git fetch origin ${{ github.event.pull_request.base.ref }}
- git diff origin/${{ github.event.pull_request.base.ref }}...HEAD --no-color > diff.txt
+ git fetch origin "$BASE_REF"
+ git diff origin/"$BASE_REF"...HEAD --no-color > diff.txt
- name: Download AI reviewer script
run: |
diff --git a/.github/workflows/check-css-classes.yml b/.github/workflows/check-css-classes.yml
index 9cc1512591..405fd35d58 100644
--- a/.github/workflows/check-css-classes.yml
+++ b/.github/workflows/check-css-classes.yml
@@ -126,10 +126,13 @@ jobs:
- name: Show CSS check results
if: always()
+ env:
+ STEP_OUTCOME: ${{ steps.css_check.outcome }}
+ STEP_CONCLUSION: ${{ steps.css_check.conclusion }}
run: |
echo "=== CSS Check Results ==="
- echo "Step outcome: ${{ steps.css_check.outcome }}"
- echo "Step conclusion: ${{ steps.css_check.conclusion }}"
+ echo "Step outcome: $STEP_OUTCOME"
+ echo "Step conclusion: $STEP_CONCLUSION"
echo ""
if [ "$CSS_CHECK_FAILED" = "true" ]; then
echo "❌ CSS check failed - violations were found:"
diff --git a/.github/workflows/danger-zone-alert.yml b/.github/workflows/danger-zone-alert.yml
index 84a77d00df..6805fc53f9 100644
--- a/.github/workflows/danger-zone-alert.yml
+++ b/.github/workflows/danger-zone-alert.yml
@@ -39,9 +39,11 @@ jobs:
- name: Analyze dangerous changes
id: analyze
+ env:
+ BASE_REF: ${{ github.base_ref }}
run: |
# Get list of modified files
- DANGEROUS_FILES=$(git diff --name-only "origin/${{ github.base_ref }}...HEAD" | grep -E "(encrypted_db|sqlcipher|auth/|security/|password|encrypt|decrypt|crypto|\.secrets)" || true)
+ DANGEROUS_FILES=$(git diff --name-only "origin/${BASE_REF}...HEAD" | grep -E "(encrypted_db|sqlcipher|auth/|security/|password|encrypt|decrypt|crypto|\.secrets)" || true)
if [ -z "$DANGEROUS_FILES" ]; then
echo "No dangerous files modified"
diff --git a/.github/workflows/docker-multiarch-test.yml b/.github/workflows/docker-multiarch-test.yml
index 8e390fbac3..534f004dff 100644
--- a/.github/workflows/docker-multiarch-test.yml
+++ b/.github/workflows/docker-multiarch-test.yml
@@ -131,13 +131,15 @@ jobs:
egress-policy: audit
- name: Summary
+ env:
+ BUILD_RESULT: ${{ needs.test-multiarch-build.result }}
run: |
{
echo "## Multi-Architecture Build Test Results"
echo ""
} >> "$GITHUB_STEP_SUMMARY"
- if [ "${{ needs.test-multiarch-build.result }}" == "success" ]; then
+ if [ "$BUILD_RESULT" == "success" ]; then
{
echo "✅ **All platforms built and tested successfully!**"
echo ""
diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml
index 7d16bd0273..c57bca8eb4 100644
--- a/.github/workflows/docker-publish.yml
+++ b/.github/workflows/docker-publish.yml
@@ -201,12 +201,16 @@ jobs:
- name: Determine version tag
id: version
+ env:
+ EVENT_NAME: ${{ github.event_name }}
+ DISPATCH_TAG: ${{ github.event.client_payload.tag }}
+ RELEASE_TAG: ${{ github.event.release.tag_name }}
run: |
set -euo pipefail
- if [ "${{ github.event_name }}" = "repository_dispatch" ]; then
- TAG="${{ github.event.client_payload.tag }}"
+ if [ "$EVENT_NAME" = "repository_dispatch" ]; then
+ TAG="$DISPATCH_TAG"
else
- TAG="${{ github.event.release.tag_name }}"
+ TAG="$RELEASE_TAG"
fi
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
# Extract version without 'v' prefix
diff --git a/.github/workflows/e2e-research-test.yml b/.github/workflows/e2e-research-test.yml
index 0c4bc27a6a..0db439b428 100644
--- a/.github/workflows/e2e-research-test.yml
+++ b/.github/workflows/e2e-research-test.yml
@@ -34,9 +34,11 @@ jobs:
- name: Get PR diff
if: github.event.label.name == 'ldr_research'
+ env:
+ BASE_REF: ${{ github.event.pull_request.base.ref }}
run: |
- git fetch origin ${{ github.event.pull_request.base.ref }}
- git diff origin/${{ github.event.pull_request.base.ref }}...HEAD --no-color > diff.txt
+ git fetch origin "$BASE_REF"
+ git diff origin/"$BASE_REF"...HEAD --no-color > diff.txt
echo "Diff size: $(wc -c < diff.txt) bytes"
- name: Setup Python
diff --git a/.github/workflows/file-whitelist-check.yml b/.github/workflows/file-whitelist-check.yml
index 719a731802..532f58c512 100644
--- a/.github/workflows/file-whitelist-check.yml
+++ b/.github/workflows/file-whitelist-check.yml
@@ -27,8 +27,8 @@ jobs:
fetch-depth: 0
- name: Security checks for files
+ env:
+ GITHUB_EVENT_NAME: ${{ github.event_name }}
+ GITHUB_BASE_REF: ${{ github.base_ref }}
run: |
- # Pass GitHub environment variables to the script
- export GITHUB_EVENT_NAME="${{ github.event_name }}"
- export GITHUB_BASE_REF="${{ github.base_ref }}"
.github/scripts/file-whitelist-check.sh
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 783eeb5374..0f963b2648 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -423,19 +423,25 @@ jobs:
subject-path: 'dist/*'
- name: Pre-publish summary
+ env:
+ EVENT_NAME: ${{ github.event_name }}
+ DISPATCH_TAG: ${{ github.event.client_payload.tag }}
+ DISPATCH_PRERELEASE: ${{ github.event.client_payload.prerelease }}
+ RELEASE_TAG: ${{ github.event.release.tag_name }}
+ RELEASE_PRERELEASE: ${{ github.event.release.prerelease }}
run: |
echo "=== 🚀 Ready to Publish ==="
echo ""
echo "📦 Package Information:"
# Handle both release event and repository_dispatch
- if [ "${{ github.event_name }}" = "repository_dispatch" ]; then
+ if [ "$EVENT_NAME" = "repository_dispatch" ]; then
echo " - Trigger: repository_dispatch"
- echo " - Tag: ${{ github.event.client_payload.tag }}"
- echo " - Prerelease: ${{ github.event.client_payload.prerelease }}"
+ echo " - Tag: $DISPATCH_TAG"
+ echo " - Prerelease: $DISPATCH_PRERELEASE"
else
echo " - Trigger: release"
- echo " - Tag: ${{ github.event.release.tag_name }}"
- echo " - Prerelease: ${{ github.event.release.prerelease }}"
+ echo " - Tag: $RELEASE_TAG"
+ echo " - Prerelease: $RELEASE_PRERELEASE"
fi
echo ""
echo "📁 Package files to publish:"
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 646aa22828..fad2ffbc21 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -37,8 +37,11 @@ jobs:
- name: Determine version
id: version
+ env:
+ EVENT_NAME: ${{ github.event_name }}
+ GIT_REF: ${{ github.ref }}
run: |
- if [[ "${{ github.event_name }}" = "push" && "${{ github.ref }}" =~ ^refs/tags/ ]]; then
+ if [[ "$EVENT_NAME" = "push" && "$GIT_REF" =~ ^refs/tags/ ]]; then
# Extract version from tag (remove 'v' prefix)
VERSION="${GITHUB_REF#refs/tags/v}"
else
@@ -50,28 +53,31 @@ jobs:
- name: Check if release already exists
id: check_release
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ VERSION_TAG: ${{ steps.version.outputs.tag }}
run: |
- if gh release view "${{ steps.version.outputs.tag }}" >/dev/null 2>&1; then
- echo "Release ${{ steps.version.outputs.tag }} already exists, skipping..."
+ if gh release view "$VERSION_TAG" >/dev/null 2>&1; then
+ echo "Release $VERSION_TAG already exists, skipping..."
echo "exists=true" >> "$GITHUB_OUTPUT"
else
- echo "Release ${{ steps.version.outputs.tag }} does not exist, proceeding..."
+ echo "Release $VERSION_TAG does not exist, proceeding..."
echo "exists=false" >> "$GITHUB_OUTPUT"
fi
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Verify version matches __version__.py
if: steps.check_release.outputs.exists == 'false'
+ env:
+ EXPECTED_VERSION: ${{ steps.version.outputs.version }}
run: |
VERSION_FILE_VERSION=$(grep -oP '(?<=__version__ = ")[^"]*' src/local_deep_research/__version__.py)
- if [ "$VERSION_FILE_VERSION" != "${{ steps.version.outputs.version }}" ]; then
+ if [ "$VERSION_FILE_VERSION" != "$EXPECTED_VERSION" ]; then
echo "Error: Version mismatch!"
- echo "Tag/input version: ${{ steps.version.outputs.version }}"
+ echo "Tag/input version: $EXPECTED_VERSION"
echo "__version__.py version: $VERSION_FILE_VERSION"
exit 1
fi
- echo "Version verified: ${{ steps.version.outputs.version }}"
+ echo "Version verified: $EXPECTED_VERSION"
- name: Generate SBOM (Software Bill of Materials)
if: steps.check_release.outputs.exists == 'false'
diff --git a/.github/workflows/responsive-ui-tests-enhanced.yml b/.github/workflows/responsive-ui-tests-enhanced.yml
index 7a9ab4f071..6e60a6071a 100644
--- a/.github/workflows/responsive-ui-tests-enhanced.yml
+++ b/.github/workflows/responsive-ui-tests-enhanced.yml
@@ -207,10 +207,15 @@ jobs:
- name: Upload to GitHub Pages (if available)
if: always() && github.event_name == 'pull_request'
continue-on-error: true
+ env:
+ PR_NUMBER: ${{ github.event.pull_request.number }}
+ VIEWPORT: ${{ matrix.viewport }}
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ REPO_NAME: ${{ github.event.repository.name }}
run: |
# This requires GitHub Pages to be enabled for the repo
# Create a branch for the screenshots
- BRANCH_NAME="pr-screenshots-${{ github.event.pull_request.number }}-${{ matrix.viewport }}"
+ BRANCH_NAME="pr-screenshots-${PR_NUMBER}-${VIEWPORT}"
cd tests/ui_tests/responsive
git init
@@ -219,13 +224,13 @@ jobs:
# Add all screenshots and gallery
git add responsive-ui-tests screenshot-gallery.html
- git commit -m "Screenshots for PR #${{ github.event.pull_request.number }}"
+ git commit -m "Screenshots for PR #${PR_NUMBER}"
# Push to a dedicated branch (requires write permissions)
- git push --force "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" HEAD:$BRANCH_NAME 2>/dev/null || true
+ git push --force "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" HEAD:$BRANCH_NAME 2>/dev/null || true
# The URL would be: https://[owner].github.io/[repo]/pr-screenshots-[number]-[viewport]/screenshot-gallery.html
- echo "Screenshots available at: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/$BRANCH_NAME/screenshot-gallery.html" || true
+ echo "Screenshots available at: https://${GITHUB_REPOSITORY_OWNER}.github.io/${REPO_NAME}/$BRANCH_NAME/screenshot-gallery.html" || true
- name: Stop application server
if: always()
diff --git a/.github/workflows/sync-main-to-dev.yml b/.github/workflows/sync-main-to-dev.yml
index ac894bfe2b..0da4503f2b 100644
--- a/.github/workflows/sync-main-to-dev.yml
+++ b/.github/workflows/sync-main-to-dev.yml
@@ -122,11 +122,11 @@ jobs:
- name: Push successful merge
if: steps.check_sync.outputs.sync_needed == 'true' && steps.merge_attempt.outputs.merge_conflicts == 'false'
+ env:
+ BRANCH_NAME: ${{ steps.create_branch.outputs.branch_name }}
run: |
- BRANCH_NAME="${{ steps.create_branch.outputs.branch_name }}"
-
# Push the merged changes
- git push origin $BRANCH_NAME
+ git push origin "$BRANCH_NAME"
- name: Create or Update Pull Request
if: steps.check_sync.outputs.sync_needed == 'true'
@@ -436,17 +436,21 @@ jobs:
- name: Log final status
if: steps.check_sync.outputs.sync_needed == 'true'
+ env:
+ MERGE_CONFLICTS: ${{ steps.merge_attempt.outputs.merge_conflicts }}
+ SAFE_TO_MERGE: ${{ steps.verify_commits.outputs.safe_to_merge }}
+ APPROVED: ${{ steps.auto_approve.outputs.approved }}
run: |
echo "========================================="
echo "Sync Workflow Summary:"
echo "========================================="
- if [ "${{ steps.merge_attempt.outputs.merge_conflicts }}" == "true" ]; then
+ if [ "$MERGE_CONFLICTS" == "true" ]; then
echo "⚠️ Status: PR created with CONFLICTS"
echo "Action required: Manual conflict resolution needed"
- elif [ "${{ steps.verify_commits.outputs.safe_to_merge }}" != "true" ]; then
+ elif [ "$SAFE_TO_MERGE" != "true" ]; then
echo "⚠️ Status: PR created but contains unexpected commits"
echo "Action required: Manual review needed"
- elif [ "${{ steps.auto_approve.outputs.approved }}" == "true" ]; then
+ elif [ "$APPROVED" == "true" ]; then
echo "✅ Status: PR created, approved, and auto-merge enabled"
echo "The PR will merge automatically once checks pass"
else
diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml
index 51027dbf11..453644eb3c 100644
--- a/.github/workflows/update-dependencies.yml
+++ b/.github/workflows/update-dependencies.yml
@@ -43,8 +43,10 @@ jobs:
cache: true
- name: 👚 Update to latest compatible versions
+ env:
+ PDM_ARGS: ${{ inputs.pdm_args || '-u --save-compatible --no-sync --no-self' }}
run: |
- pdm update ${{ inputs.pdm_args || '-u --save-compatible --no-sync --no-self' }}
+ pdm update $PDM_ARGS
- name: 📝 Create pull request
uses: peter-evans/create-pull-request@98357b18bf14b5342f975ff684046ec3b2a07725 # v8
diff --git a/.github/workflows/update-npm-dependencies.yml b/.github/workflows/update-npm-dependencies.yml
index 12cb5a394f..024244ae82 100644
--- a/.github/workflows/update-npm-dependencies.yml
+++ b/.github/workflows/update-npm-dependencies.yml
@@ -60,9 +60,12 @@ jobs:
npm audit fix --level moderate || echo "Some vulnerabilities could not be auto-fixed"
- name: 👚 Update to latest compatible versions
+ env:
+ NPM_DIR: ${{ matrix.npm_directory.path }}
+ NPM_ARGS: ${{ inputs.npm_args || '--save' }}
run: |
- cd "${{ matrix.npm_directory.path }}"
- npm update "${{ inputs.npm_args || '--save' }}"
+ cd "$NPM_DIR"
+ npm update $NPM_ARGS
- name: 🔨 Build (if applicable)
run: |
diff --git a/.github/workflows/validate-image-pinning.yml b/.github/workflows/validate-image-pinning.yml
index f303b5b083..a2f51a5e90 100644
--- a/.github/workflows/validate-image-pinning.yml
+++ b/.github/workflows/validate-image-pinning.yml
@@ -92,6 +92,9 @@ jobs:
egress-policy: audit
- name: Generate summary
+ env:
+ COMPOSE_RESULT: ${{ needs.validate-docker-compose.result }}
+ WORKFLOW_RESULT: ${{ needs.validate-workflow-images.result }}
run: |
{
echo "## 🔒 Docker Image Pinning Validation"
@@ -107,18 +110,18 @@ jobs:
echo "### Validation Results"
echo ""
- if [ "${{ needs.validate-docker-compose.result }}" = "success" ] && \
- [ "${{ needs.validate-workflow-images.result }}" = "success" ]; then
+ if [ "$COMPOSE_RESULT" = "success" ] && \
+ [ "$WORKFLOW_RESULT" = "success" ]; then
echo "✅ **All images properly pinned with SHA256 digests**"
echo ""
echo "All docker-compose and workflow files pass validation."
else
echo "❌ **Image pinning violations found**"
echo ""
- if [ "${{ needs.validate-docker-compose.result }}" != "success" ]; then
+ if [ "$COMPOSE_RESULT" != "success" ]; then
echo "- ❌ docker-compose files have unpinned images"
fi
- if [ "${{ needs.validate-workflow-images.result }}" != "success" ]; then
+ if [ "$WORKFLOW_RESULT" != "success" ]; then
echo "- ❌ Workflow files have unpinned service containers"
fi
echo ""