cert-review

io.github.RaminNietzsche由 GitHub 账号 RaminNietzsche 发布v1.2.0更新于 Nov 21, 2026

SEI CERT C/C++ code review: rule lookup, clang-tidy and cppcheck findings mapped to CERT rules

发布方自己的服务:Review Expert

已验证STDIO仅桌面开发者工具安全与监控

概览

AI 生成的概览

本地 MCP 服务器,用于 SEI CERT C/C++ 代码审查:规则查询,以及将 clang-tidy、cppcheck、Semgrep 结果映射到 CERT 规则编号。

可以做什么
  • 查询、搜索并按标准、语言、类别、等级和覆盖度筛选 CERT C/C++ 规则与建议,含示例、风险行、CWE 标签
  • 对文件、目录或 diff 变更行运行 clang-tidy、Clang 静态分析器、cppcheck 和内置 Semgrep 规则,可选基线过滤
  • 解释单条发现:对应规则、最接近的合规/不合规示例对及修复步骤
  • 生成审查包(代码片段与候选规则文本),并校验发现必须引用真实规则编号和原文引用
  • 将发现格式化为 markdown、GitHub、GitLab、SARIF 或 Code Quality 输出
适用场景
需要按 SEI CERT、MISRA C:2012、MISRA C++:2023 或 AUTOSAR C++14 审查 C/C++ 改动,并希望分析器结果对应到具体规则编号时使用。适合 Ceph 项目(内置专用配置),也适合为人工或 LLM 辅助审查提供规则依据。
运行要求
以本地 stdio 进程运行,通常使用已发布的 Docker 镜像,或 Python 3.11+ 的源码检出并安装 mcp SDK。Docker 镜像已内置 clang-tidy、cppcheck、Semgrep;本地安装需自行准备。可靠解析通常需要 compile_commands.json。可选环境变量 CERT_REVIEW_HOME 及已授权的 MISRA/AUTOSAR 文本路径。
安装前请注意
静态覆盖有限:许多规则仅有部分覆盖或没有检查器,缺少编译数据库的文件可能被跳过并以 partial 状态提示而非“无问题”。Ceph 源码需在 Linux 上分析。MISRA 与 AUTOSAR 文本受版权保护,未随包提供。工具声明为只读,但粘贴 diff 时可能在仓库路径或临时目录下重建文件。

安装

在 SourceWeft 中

  1. 打开 控制台中的 cert-review,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

cert-review-mcp

[cert-review MCP server – quality and maintenance score on Glama]

SEI CERT C and C++ code review as an MCP server, a CLI and two review skills, tuned for Ceph, with the same tools for MISRA C:2012, MISRA C++:2023 and AUTOSAR C++14 (docs/misra-autosar.md).

It does three things:

  1. Knows the standards. data/rules.json holds every rule and recommendation of the SEI CERT C standard (122 rules, 183 recommendations) and every rule of the SEI CERT C++ standard (83 rules), with paired noncompliant/compliant examples, the risk row (severity, likelihood, detectable, repairable, priority, level), CWE tags and the automated-detection tables. It is built reproducibly from a pinned upstream commit and checked against the standards' own index pages.
  2. Runs real analyzers and maps them to rule IDs. clang-tidy (cert-* and mapped checks), the Clang Static Analyzer, cppcheck and 40 bundled Semgrep rules for INT, EXP, MEM, CON and other CERT rules; optionally Infer and the CodeQL CERT query packs (docs/analyzers.md). Findings are normalised to one schema, de-duplicated, filtered by a profile, and optionally limited to changed lines.
  3. Prepares the rest for a manual review layer without letting it make things up. For rules no checker covers, build_review_packet selects code hunks and the few rule texts worth reading; validate_findings rejects any finding that does not cite an existing rule ID and quote that rule's text.
  4. Speaks MISRA and AUTOSAR too. A standard filter on every rule tool and a standards selection for the checks (default: CERT only). Findings map to MISRA C:2012 (cppcheck MISRA addon), MISRA C++:2023 and AUTOSAR C++14 IDs. Their copyrighted texts are not bundled; you can load your licensed copy. See MISRA and AUTOSAR.

Comments are only drafted and formatted. Nothing is ever posted to GitHub or GitLab by this project.

Not an official CERT or CMU product. See NOTICE for attribution (CC BY 4.0 text, MIT examples) and the pinned source commit.

Architecture

[Architecture: data built by tools/, the engine in src/cert_review, and the MCP and CLI front ends]

The diagram source is in docs/architecture.md.

Coverage

Each rule is deterministic (a rule-specific checker exists: a clang-tidy cert-* check or a CodeQL CERT query), partial (only general checkers or the bundled Semgrep pattern rules map) or llm-only (no checker). The reference toolchain is what the Docker images run: clang-tidy/clang 19.1.7, cppcheck 2.17.1 and Semgrep 1.186.0 with the bundled rules. The extended toolchain adds Infer 1.3.0 and CodeQL 2.27 with the CERT packs 2.63.0, which are optional and not in the images.

SetTotalAll mappings: det / partial / llm-onlyReference toolchainExtended toolchain
C rules122100 / 12 / 1016 / 51 / 55100 / 8 / 14
C recommendations1834 / 4 / 1754 / 2 / 1774 / 3 / 176
C++ rules8382 / 0 / 118 / 31 / 3482 / 0 / 1

Before the Semgrep rules, the reference toolchain covered C rules 16 / 34 / 72 and C++ rules 18 / 29 / 36. A mapped checker is not a detection guarantee; the measured numbers follow.

MISRA C:2012 221 guidelines (131 / 28 / 62), MISRA C++:2023 178 (4 / 31 / 143), AUTOSAR C++14 397 (5 / 51 / 341); details and measurements in docs/misra-autosar.md.

Measured precision and recall on the CERT examples: docs/accuracy.md. Rule counts versus the official index pages: docs/rule-counts.md. Results on a real Ceph subtree: docs/ceph-trial.md.

Recall on real security fixes (Ceph CVEs and memory-safety fixes, curl, libtiff and others): docs/benchmark-real.md.

Install

bash
git clone <this repository> cert-review-mcp && cd cert-review-mcppython3 -m venv .venv && . .venv/bin/activatepip install -e '.[dev]'sudo apt-get install clang clang-tidy cppcheck       # static layer (optional but recommended)pip install semgrep==1.186.0                        # optional: the bundled CERT pattern rulespytest                                              # 190 tests

The package reads data/ and profiles/ from the checkout (set CERT_REVIEW_HOME to point elsewhere). Python 3.11+; works with the official mcp SDK 1.x (FastMCP, 1.15 or later) and 2.x (MCPServer).

Cursor

.cursor/mcp.json in your project (or ~/.cursor/mcp.json):

json
{  "mcpServers": {    "cert-review": {      "command": "/path/to/cert-review-mcp/.venv/bin/cert-review-mcp",      "env": { "CERT_REVIEW_HOME": "/path/to/cert-review-mcp" }    }  }}

Then ask: "Use the cert-review ceph_review prompt on my current diff." Copy skills/ into your skills folder to make the review procedure available.

Docker

Dockerfile.mcp builds the MCP server with the analyzers included (no local clang or cppcheck needed). Mount your project at the same absolute path it has on the host:

bash
docker build -f Dockerfile.mcp -t cert-review-mcp .
json
{  "mcpServers": {    "cert-review": {      "command": "docker",      "args": ["run", "-i", "--rm", "-v", "/home/me/proj:/home/me/proj:ro", "cert-review-mcp"]    }  }}

The same mcpServers block works in Claude Desktop and Cursor. Release tags also publish multi-arch images (amd64, arm64) to Docker Hub as raminnietzsche/cert-review-mcp; use raminnietzsche/cert-review-mcp:latest instead of cert-review-mcp to skip the build. Details, the CLI from the image, and a tools/list check: docs/docker.md.

MCP Registry

The server is listed in the official MCP Registry as io.github.RaminNietzsche/cert-review-mcp (server.json), so clients that read the registry can install the Docker image from there.

Claude Code

bash
claude mcp add cert-review -- /path/to/cert-review-mcp/.venv/bin/cert-review-mcpmkdir -p ~/.claude/skills && cp -r skills/cert-review skills/ceph-cert-review ~/.claude/skills/

Use as a GitHub Action

yaml
- uses: actions/checkout@v4  with: { fetch-depth: 0 }- uses: RaminNietzsche/cert-review-mcp@v1  with:    profile: default            # or ceph, misra, autosar    fail-on: error    upload-sarif: "true"        # SARIF to code scanning

Diff mode on pull requests, SARIF, a job summary, and optional inline review comments (review-comments: "true", off by default). A GitLab include template publishes Code Quality and SAST reports. Inputs, outputs and examples: docs/action.md, examples/github-workflow.yml.

MCP tools

Every tool is read-only: it reads local files and bundled data and runs local analyzers. Nothing is written, uploaded or posted. All tools declare MCP annotations, a title and, except format_findings, an output schema.

For check_diff and build_review_packet with pasted diff_text, files that are missing on the MCP host are reconstructed from the patch under repo (the directory is created when needed). On remote servers that cannot see your checkout, pass the unified diff and a logical root path (for example /workspace/ceph); omit repo to use a disposable tree under the system temp directory.

ToolPurpose
list_rules(standard, lang, category, kind, classification, level, detectable, coverage, limit)Filter the rule database; summaries with coverage tier
search_rules(query, standard, limit, lang)Rank rules by keyword relevance (API names, concepts, IDs)
get_rule(rule_id, profile, include_examples)One rule or guideline: text or summary, examples, risk row or classification, CWE, checkers, cross-references, profile notes
get_rule_coverage(standard, lang, kind, include_ids)Rule counts per tier: deterministic / partial / llm-only
check_files(path, profile, standards, compdb, root, lang, tools, ...)Analyzer findings for a file or a directory tree
check_diff(repo, base, head | diff_text, profile, standards, compdb, ...)Analyzer findings on changed lines only
explain_finding(finding, profile, context_lines)One finding: rule summary, why it matches, closest noncompliant/compliant example pair, fix steps
build_review_packet(path | repo + base | diff_text, ...)Code hunks plus candidate rule texts for manual review
validate_findings(findings, packet, profile)Accept only grounded findings (rule ID + verbatim quote; MISRA/AUTOSAR quotes only when a licensed text is loaded)
format_findings(findings, style, root, warnings)markdown, github, gitlab, sarif, codequality or gitlab-sast; formatting only

check_files and check_diff take an optional baseline_path: findings recorded in a baseline file are hidden and counted (new, baselined, fixed). See docs/baseline.md.

MCP tool and parameter names changed after the v1 release; see CHANGELOG.md.

standard accepts cert (default), cert-c, cert-cpp, misra, misra-c-2012, misra-cpp-2023, autosar, autosar-cpp14 or all.

Resources: rule://EXP34-C, profile://ceph. Prompts: cert_review, ceph_review.

CLI

bash
cert-review check src/common/Throttle.cc --profile ceph --compdb build --format markdowncert-review diff --repo ~/ceph --base origin/main --profile ceph --format sarif -o out.sarifcert-review diff --diff-file change.patch --format github > review.json   # payload onlycert-review explain EXP34-Ccert-review explain-finding ERR34-C --file src/parse.c --line 42     # closest example + fixcert-review baseline create src --compdb build                      # record existing findingscert-review check src --compdb build --baseline .cert-review-baseline.json --fail-on warningcert-review coverage --lang cppcert-review rules --lang cpp --coverage llm-onlycert-review packet --repo ~/ceph --base origin/main --profile ceph -o packet.jsoncert-review validate findings.json --packet packet.jsoncert-review check src --profile misra                       # MISRA C:2012 + MISRA C++:2023cert-review check src --standards autosar-cpp14,cert        # AUTOSAR and CERT IDs togethercert-review rules --standard misra-c-2012 --classification mandatorycert-review explain MISRA-C-2012-17.2

--fail-on error|warning|note sets the exit code for CI; with --baseline only new findings count. Silence one rule on a line with // cert-review: ignore EXP34-C reason.

Profiles

profiles/default.yaml is plain CERT. profiles/ceph.yaml encodes Ceph: C++23/C11, priority and severity per rule, suppressions with reasons (ceph_assert, dout, crimson, tests, vendored trees), and idioms (bufferlist, ceph::mutex, RefCountedObject, errno returns, asio/seastar callbacks) that tell the reviewer how each project construct changes a rule. Evidence for each idiom is cited inside the file. profiles/misra.yaml and profiles/autosar.yaml select MISRA C:2012 + MISRA C++:2023 and AUTOSAR C++14 (standards:), with severity taken from the guideline classification.

MISRA and AUTOSAR

StandardGuidelinesMandatory / required / advisoryMapped to a checker
MISRA C:2012 (Amendments 1-4, the MISRA C:2023 set)22123 / 150 / 48159 (131 by the cppcheck MISRA addon)
MISRA C++:20231785 / 123 / 5035
AUTOSAR C++14 (AP 19-03)397- / 362 / 3556

The MISRA and AUTOSAR documents are copyrighted, so none of their guideline text is included: only IDs, classification, AUTOSAR enforcement and target, checker mappings, public SEI CERT cross-references and one-line summaries written for this project (labelled as paraphrases). Point CERT_REVIEW_MISRA_C_TEXTS, CERT_REVIEW_MISRA_CPP_TEXTS, CERT_REVIEW_AUTOSAR_TEXTS or a profile's rule_texts: at your licensed copy to see the official headlines and to have validate_findings check quotes against them. Without it, MISRA/AUTOSAR findings are accepted on a valid rule ID (grounding: "rule-id-only"). Mapping sources, measured results and file formats: docs/misra-autosar.md.

Rebuilding the data

bash
git clone https://github.com/cmu-sei/secure-coding-standards cert-srcpython3 tools/build_rules.py --src cert-src            # fails if counts differ from the index pagespython3 tools/build_checker_map.py --codechecker <codechecker clone> --llvm <llvm-project clone>python3 tools/build_corpus.py && python3 tools/eval_accuracy.pypython3 tools/build_guidelines.py --cppcheck <cppcheck 2.17.1 clone> --autosar autosar.txt  # MISRA/AUTOSARpython3 tools/ceph_compdb.py --ceph ~/ceph --out /tmp/ceph-compdb src/common   # cheap compile db

Limitations

  • Static coverage is thin by nature: most CERT rules are not decidable by tools; the llm-only and partial rules depend on the review layer and on a human.
  • Tools need compilable code. Without compile_commands.json many files do not parse and checks are skipped. The engine reports this instead of "no findings": the tool status becomes partial, the markdown, SARIF (executionSuccessful: false plus a toolExecutionNotifications warning), GitHub review, Action summary and CLI output carry a warning, and --fail-on-parse-error (alias --fail-on-partial; Action input fail-on-parse-error) turns it into a failing exit code. A file on which an analyzer hits its 300 s timeout is treated the same way.
  • Ceph needs Linux. Its sources include Linux-only headers (linux/version.h, ...) and Linux-only Boost.Asio features, so e.g. src/rgw/radosgw-admin/radosgw-admin.cc cannot be parsed on macOS even with the SDK sysroot and Homebrew Boost. Analyse Ceph on Linux, with the Docker image, or with the GitHub Action. tools/ceph_compdb.py adds -isysroot on macOS, which is enough for some directories (src/common) but not for all of them.
  • Mappings come from CodeChecker labels and clang-tidy aliases plus a small curated overlay; general analyzers can map to several rules, so the engine keeps the best few per line.
  • Most MISRA C++ and AUTOSAR guidelines have no open-source checker; MISRA C coverage depends on cppcheck's MISRA addon (needs python3).
  • Ceph's profile is based on reading the code and on a limited trial, not on a full build.

License

Code: Apache-2.0 (LICENSE). Bundled CERT content: CC BY 4.0 (text) and MIT (examples); see NOTICE. MISRA and AUTOSAR: facts and original summaries only, no guideline text; see NOTICE and docs/misra-autosar.md.

来源:README.md,提交 63b3a81

工具

0
SourceWeft 曾在隔离沙箱中以无凭据方式启动该软件包一次,以列出其工具,但未能完成:该软件包类型无法在沙箱中运行。

版本历史

1
  1. v1.2.0最新Nov 21, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

其他 Review 集成