技能 编程开发 代码安全扫描审查

代码安全扫描审查

v20261125
ci-review
此技能在 GitHub Action 作业中执行自动化安全扫描。它根据探针配置分析拉取请求变更或分支提交。流程包括解析变更范围、生成安全报告、有条件地建议漏洞补丁、重新验证已修复问题,并标记扫描完成。该技能在无监督模式下运行,集成于 Claude 安全插件工作流。
获取技能
244 次下载
概览

GitHub Action scan

This door runs unattended in the GitHub Action's job: it scans a pull request's changes or, on any other event (a schedule, a manual run), the checked-out branch, and leaves the report for the job's later steps. Ask no questions at any point. Invoking this skill is the user's "Yes" to the scan's fixed start confirmation, so the scan recipe's step 3 is already answered; and where a recipe would ask, take its "I don't know" default and say what you chose. The scan's effort tier is the effort in the probe's file (step 1). A change_scan_effort of high there is the user's typed --change-scan-effort high.

Git here only reads, typed plainly from the repository root with no -C and nothing set in front of it: the job's environment already carries git's settings, and Claude Code may refuse any other spelling. So wherever a text spells GIT with variables in front or with -C, type the plain form. List files with git ls-files, and read one at a revision with git show <rev>:<path> (not ls-tree). Write nothing through git.

The report directory goes in the folder the probe's file names as reports (step 1), not in the recipes' start folder: wherever this skill or a recipe makes or names the report directory, CLAUDE-SECURITY-<ts> or <report directory>, use the absolute path <reports>/CLAUDE-SECURITY-<ts>. The job shows the report's prose to people, in the review or on the job summary, so write no absolute path of this machine in that prose: name each file from the repository root.

  1. Read the probe. Read .git/claude-security-probe.json. If it is not there, stop with one line: this command is for the Claude Security plugin's GitHub Action; to scan here, type /claude-security. If branch_scan is true, go to step 8. Otherwise, when pull_request.merge_base is a sha, that is the scan's base. If fixes_only is true, the scan is done: its report directory is the one in reports that holds CLAUDE-SECURITY-COMPLETE. Do step 3 on it, then step 7. Skip steps 2, 4, 5 and 6, also where step 3 sends you to step 4.
  2. Scan the changes. Follow the scan-changes recipe from "Resolving the range and sizing it" through "Delivery", as a branch's changes with --base <merge_base> when the probe gave one and the recipe's default base order otherwise, with <reports> as the first argument of its step 5's command; skip its sub-menu and its kickoff message. If the range has no changed files, say so in one line and stop. Start no later step until its redactor has finished.
  3. Suggest patches — only if the probe's suggest_patches is true, and no finding's cwe_id or other_cwe_ids holds CWE-798, CWE-259, CWE-321 or CWE-671 (with one, the review shows no finding's text and no fix). Otherwise skip to step 4. If both hold and a finding without older_than_the_change survived, follow the suggest-patches recipe from "The patches" (its step 0) to the end of its step 5, on the report you just wrote with the selection all (at a change_scan_effort of high, the ids of the findings without older_than_the_change instead, as in F1,F3: there all takes older flaws too), REPO ROOT from git rev-parse --show-toplevel, and PATCH BASE the full commit id the scan stamped (revision.commit in the stamp); skip its sub-menu, Preconditions and Interview. Run it in an unclean working tree too: the line that write_scan_meta.py prints there, and the scan recipe's rule to make no fix offer, are for a session with a user. Where its --prepare prints units: [], leave the recipe and go to this skill's step 4. Tell each patch-generator and patch-verifier you dispatch, in the revision round too, what this job lets them run. The project's documented test command is worth one try. <reports>/node_modules (spell the path out), where it exists, is this job's own link to the packages installed in the checkout's top folder: packages that a test run finds through it are the project's own, not borrowed, and need no search for where they come from. A refused command is not retried in another spelling or tool. No ad-hoc probe is run (python3 -c, pip, a hand-written harness). They report what could not run and judge by reading. Hold your turn through every agent it dispatches, as its step 4 says; nothing wakes an unattended session that ends its turn.
  4. Re-check what was reported before. Skip this step, and write no file, when the probe's previous_findings is empty or absent, or when the new report's CLAUDE-SECURITY-RESULTS.jsonl has, for every entry, a finding with the entry's claudeSecurityPluginFindingId and line. Otherwise, for each entry with no such finding (one id can have several entries, each on a line of its own): read the file at the entry's path and line in this checkout with the Read tool (not a shell command) and judge whether the reported flaw is gone from there. Then write CLAUDE-SECURITY-PREVIOUS.json into the report directory: a JSON array with one object for each entry that you read, {"claudeSecurityPluginFindingId": "<id>", "line": <the entry's line>, "status": "fixed" | "not_reassessed", "note": "<one sentence>"} — fixed only when you read the code there and the flaw is gone from it, not_reassessed otherwise (you cannot tell, or the flaw is still there — say which in the note).
  5. Mark the report complete. If the scan rendered a report, Write a file named CLAUDE-SECURITY-COMPLETE, holding complete, in the report directory.
  6. Explain the findings of the change. Skip when any finding holds one of step 3's CWE ids. Dispatch one claude-security:finding-explainer for each line of CLAUDE-SECURITY-RESULTS.jsonl that lacks older_than_the_change, at most eight in one message, each with these five lines and nothing else: id: <the line's "id" value, such as F1>, jsonl: <report directory>/CLAUDE-SECURITY-RESULTS.jsonl, line: <the number of the finding's line in that file>, note: <report directory>/patches/<id>.md (note: none if step 3 was skipped), out: <report directory>/explanations/<id>.json. Hold your turn until all of a message's agents have replied, then send the next eight. Retry none and mend no file: where an explanation is absent, the review shows the scan's own text.
  7. Report. In a few sentences: what was scanned, how many findings, which got a suggested fix and which did not when fixes were drafted, and what became of previously reported findings; offer nothing further. Stop here.
  8. Branch scan. Follow the scan-codebase recipe from its step 4 through "Delivery" over the whole repository, unscoped, setting focus by its size gauge; skip its sub-menu and kickoff message. Once its redactor has finished, if it rendered a report, write step 5's completion mark. Report in a few sentences: what was scanned, how many findings, and the stamped verification status; offer nothing further.

Environment and Paths (substituted at invocation, use verbatim)

@${CLAUDEPLUGINROOT}/skills/claude-security/role.md

信息
分类 编程开发
名称 ci-review
版本 v20261125
大小 7.66KB
更新时间 2026-11-26
语言