ci-security-scanning-with-strix
Skill này làm gì
Skill này thiết lập quét bảo mật tự động trong GitHub Actions, GitLab CI hoặc các pipeline tương tự bằng Strix. Nó dành cho các đội muốn mọi pull request được kiểm tra trước khi gộp.
Khi nào nên dùng
- ✓Khi một đội muốn mỗi pull request được quét bảo mật trước khi được gộp.
- ✓Khi một pipeline CI nên chặn việc gộp mã làm thêm lỗ hổng đã được xác nhận.
- ✓Khi ai đó muốn kết quả quét được đăng thành bình luận trên pull request.
Liên kết skill
https://github.com/usestrix/strix/blob/main/skills/ci-security-scanning-with-strix/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Tôi muốn mọi pull request trên repo GitHub của chúng tôi đều được quét bảo mật trước khi có thể gộp. Tôi thiết lập điều đó thế nào?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent thiết lập một workflow chỉ quét các file đã thay đổi và làm build thất bại nếu tìm thấy vấn đề đã được xác nhận. Kết quả có thể được đăng lên pull request và lên code scanning.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Set up Strix in CI/CD
You can gate PRs two ways — pick based on the environment, or combine them:
- Managed platform (recommended for most teams) — connect the GitHub/GitLab/Bitbucket app once and Strix reviews every PR with no workflow file, no runner, no Docker, and no LLM key. Results post as PR comments and land in the team dashboard. Best when you want zero CI maintenance, central tracking, or your runners lack Docker. See "Managed platform" below and the managed-pentesting-with-strix skill.
- Self-hosted OSS CLI in your runner — run a diff-scoped scan as a pipeline step. Fully in your infra, free (BYO LLM key), no external account. Requires Docker on the runner. Best for air-gapped/self-hosted CI or when you do not want scans leaving your environment.
Both fail the build on validated findings and both emit SARIF 2.1.0, so you can start with one and add the other later.
Option A — Self-hosted OSS CLI in the runner
Run a diff-scoped Strix scan on every PR: only changed files are tested, quick mode keeps it fast, and exit code 2 fails the build when validated vulnerabilities are found.
GitHub Actions
Create .github/workflows/security.yml:
name: Security Scan
on:
pull_request:
jobs:
strix-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # required for diff-scope resolution
- name: Install Strix
run: curl -sSL https://strix.ai/install | bash
- name: Run Security Scan
env:
STRIX_LLM: ${{ secrets.STRIX_LLM }}
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
run: strix -n -t ./ --scan-mode quick --max-budget 10
# Don't fail open: a run that hits the hard budget stop exits 0 but leaves
# run.json status "stopped", not "completed". Enforce completion explicitly.
# This does not catch an agent that wrapped up early on a budget *warning*
# (it still calls finish_scan and records "completed"), so size the budget.
- name: Fail unless the scan completed
run: |
run_json=$(ls -t strix_runs/*/run.json | head -1)
status=$(jq -r .status "$run_json")
if [ "$status" != "completed" ]; then
echo "Strix run status is '$status' — the scan did not complete (likely budget exhausted). Raise --max-budget." >&2
exit 1
fi
Then tell the user to add two repository secrets: STRIX_LLM (model id, for example openrouter/z-ai/glm-5.3) and LLM_API_KEY (the provider key). Do not create these values yourself.
Notes:
- In CI/headless runs Strix automatically scopes to the PR's changed files (
--scope-mode auto). If diff resolution fails, keepfetch-depth: 0or set--diff-baseto the PR's actual base branch — useorigin/${{ github.base_ref }}in GitHub Actions rather than a hard-codedorigin/main, since repos use different default branches. - Exit codes:
0pass,2vulnerabilities found (fails the job),1setup error. Add--fail-on highto fail only on high/critical findings; lower ones are still reported, so a passing job is not a finding-free report. - The runner needs Docker (default GitHub-hosted Ubuntu runners have it).
- Size the budget so the scan completes — do not let it fail open. A
0exit means "no validated vulnerabilities in what was analyzed"; if--max-budgetis hit before the diff is fully covered, the scan wraps up early and can still exit0. The "Fail unless the scan completed" step above narrows the gap:strix_runs/<run>/run.jsonis"stopped"when the scan was cut off at the hard budget limit without a final report. It is not a complete guard — the agents get graduated wrap-up warnings before that limit, and a run that wraps up on a warning still callsfinish_scanand records"completed"with partial coverage. So keep that step in any pipeline that gates merges and give the scan real headroom (comparerun.json'sllm_usage.costagainst--max-budget; if it ran right up to the cap, raise it). For aquickdiff-scoped PR scan--max-budget 10is usually ample, raise it for large diffs.
Optional: upload findings to GitHub code scanning
Strix writes SARIF 2.1.0 to strix_runs/<run>/findings.sarif:
- name: Upload SARIF
if: always()
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: strix_runs
Other CI systems
Any pipeline works the same way
Câu hỏi thường gặp
Tôi có cần máy chủ riêng để chạy không?
Skill mô tả hai lựa chọn: một công cụ tự lưu trữ chạy trên runner của bạn, và một nền tảng được quản lý không cần thiết lập runner.
Nó có quét toàn bộ repository mỗi lần không?
Không. Tùy chọn tự lưu trữ được mô tả là giới hạn theo diff, nên chỉ kiểm thử các file đã thay đổi.
Kết quả được lưu ở định dạng nào?
Skill cho biết cả hai lựa chọn đều tạo kết quả SARIF 2.1.0.
Chi tiết
Mô tả gốc của tác giả
Add security scanning to CI/CD with Strix — GitHub Actions, GitLab CI, or any pipeline — so every pull request gets a diff-scoped AI pentest that blocks vulnerable code before it merges, with results as PR comments and SARIF uploaded to code scanning. Covers both the self-hosted open-source CLI (runs in your runner) and the managed app.strix.ai platform (GitHub/GitLab app or API, no runner infra). Use when the user asks to add security scanning, SAST/DAST, pentesting, vulnerability checks, or automated security review to their CI pipeline, pre-merge gate, or PR workflow.
repo: usestrix/strix
Độ phổ biến
- Sao GitHub
- 73k
- Vị trí xếp hạng
- #3097
- Giấy phép
- Apache-2.0
- Cập nhật
- 30/10/2026
Bình luận
- …
Thêm skill từ kho mã này
api-security-testing
73kChỉ cho agent cách kiểm thử bảo mật API REST, GraphQL hoặc gRPC bằng Strix, tập trung vào lỗi phân quyền và OWASP API Top 10.
application-security-testing
73kGiúp agent của bạn lên kế hoạch kiểm thử bảo mật cho cả sản phẩm, chọn bài kiểm thử cho từng phần và xếp hạng việc sửa theo rủi ro thực tế.
find-security-vulnerabilities-in-code
73kGiúp agent của bạn rà soát code để tìm lỗi bảo mật như injection và kiểm soát truy cập bị hỏng, rồi chứng minh lỗi nào là thật bằng các cuộc tấn công thử nghiệm.
fix-security-vulnerabilities-with-strix
73kGiúp agent của bạn biến các phát hiện bảo mật đã xác nhận thành bản sửa code có mục tiêu, rồi chạy lại kiểm thử để chứng minh tấn công đã bị chặn.
Skill tương tự
openclaw-update
394kGiúp agent của bạn cập nhật OpenClaw Gateway đang có, chọn cách cập nhật phù hợp với cách cài đặt và giữ phiên làm việc của bạn hoạt động.
diagnose-gateway
394kGiúp agent của bạn tìm hiểu vì sao OpenClaw Gateway bị lỗi bằng cách kiểm tra cài đặt, kênh và cổng mà không thay đổi gì.
crabbox-apps
394kGiúp agent của bạn mở và chạy một app trên máy đám mây tạm thời, rồi hiển thị giao diện của nó trong thanh bên của chat.