GB/T-based Agent Code Security Auditing

Preface

In domestic project acceptance, classified protection (MLPS), or internal audits, discovered items often need to be aligned with GB/T clauses rather than just providing a CWE list. Relying solely on generic SAST tools often requires manual supplementation for national standard chapter mapping and Chinese compliance phrasing. When conducting audits within Agents that support Skills, such as Cursor or Claude Code, a repeatable workflow is needed: first, quickly scan the baseline; then, let the model perform a semantic-level deep audit; and finally, produce an archivable Markdown report.

The following introduces the community Skill gbt-code-audit on SkillHub (coordinate @user_9b59adcf/zzcp-gbt-code-audit, current version 2.0.4). It bundles GB/T 34943, 34944, 34946, and 39412, along with a “Fast Scan + LLM Deep Audit” workflow, into SKILL.md, accompanied by Python scripts and national standard reference documents. The tag requires_api_key=false indicates no additional API Key is needed.

What is this

gbt-code-audit is an Agent-oriented code security audit Skill: it detects and classifies vulnerabilities in source code based on Chinese National Standards and outputs Markdown audit reports with national standard mappings. It is published on SkillHub under the community source, categorized under dev-programming, and maintained by user_9b59adcf. The SkillHub page displays a rating of 100000, with 1833 downloads and 18 installations.

The Skill’s self-description states it is applicable to scenarios such as project acceptance, security compliance reviews, and code quality assessments. The documentation notes that it has been tested and passed under the GLM-5 model.

Core Features

The following capabilities are derived from the descriptions in SKILL.md and README.md within the Skill package.

Standards and Languages

  • National Standards: GB/T 34943-2017 (C/C++), GB/T 34944-2017 (Java), GB/T 34946-2017 (C#), GB/T 39412-2020 (General Baseline).
  • The SkillHub introduction explicitly supports multi-language detection for Java, C/C++, C#, and Python. The documentation inside the package states that theoretically, more languages can be audited; for languages with dedicated standards, a “Dedicated Standard + 39412” dual mapping is used, while for other languages, a single GB/T 39412 mapping is applied.

Dual-Engine Workflow

The core pipeline is:

Fast Scan → Baseline Storage → LLM Deep Audit → Report Generation
  • Fast Scan: Uses regex and rule matching, and can automatically call Gitleaks, Bandit, and Semgrep (only during the fast scan phase); it scans files in parallel via quick_scan to generate findings/baseline/*.md.
  • LLM Deep Audit: Requires the Agent to independently read source code, perform semantic and business logic analysis, write results to findings/llm_audit/*.md, and make “Valid / False Positive” judgments on baseline items.
  • Finalization: finalize_report handles deduplication, code snippet and line number verification, and hallucination filtering, generating audit_report_YYYYMMDD_HHMMSS.md (or a specified --output).

Supporting Assets

  • docs/reference/: Excerpts of national standard rules; docs/vulnerabilities/: Vulnerability type descriptions; docs/workflow/: Audit workflow, quality standards, and troubleshooting.
  • test-samples/: Sample vulnerable code for Java, Python, C/C++, and C# to facilitate local trial runs of the workflow.

Installation and Enablement

First, check the SkillHub CLI; if not installed, follow the official installation documentation (full installation or CLI only).

command -v skillhub && skillhub --version
# If CLI is not installed (Excerpt from https://skillhub.cn/install/skillhub.md)
curl -fsSL https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/install.sh | bash

When installing this Skill, you must use --dir to point to the current Agent’s skills directory; otherwise, it defaults to ./skills/ and may not be recognized. Common paths are as follows (same as official installation documentation):

  • Cursor: ~/.cursor/skills/
  • Claude Code: ~/.claude/skills/
  • Codex: ~/.codex/skills/ or .agents/skills/ under the project

Execute in the corresponding directory:

skillhub install zzcp-gbt-code-audit --namespace user_9b59adcf --dir ~/.cursor/skills/

Alternatively, follow the prompts on the SkillHub page to let the Agent read https://skillhub.cn/install/skillhub.md and install @user_9b59adcf/zzcp-gbt-code-audit. After installation, restart or refresh the Skills list according to the requirements of each client.

The Skill script side notes that it only uses the Python Standard Library to run scripts/skill.py; if the fast scan calls Bandit, Semgrep, or Gitleaks, the corresponding CLI tools must be installed on the local machine and discoverable by the script.

Typical Usage

Operate in the project root directory (or within the Skill package) where the Skill is loaded. On the Agent side, you must first read docs/workflow/audit_workflow.md and docs/workflow/quality_standards.md according to SKILL.md. After completing the “Standard Learning” confirmation output, proceed to the LLM audit.

1. Prepare Directories

mkdir -p findings/baseline findings/llm_audit

2. Fast Scan

Replace --target with the path of the code to be audited; the package includes samples that can be pointed to test-samples/.

python scripts/skill.py quick_scan --target test-samples/java

The scan generates baseline Markdown entries for matched items, with a default status of “False Positive,” for subsequent LLM review.

3. LLM Audit (Executed by Agent)

Follow Skill requirements: Do not rely on fast scan results to perform keyword-based repeated scanning; instead, use Read / Grep to cover all source code files. Write actual risks to findings/llm_audit/*.md, including fields for severity level, CWE, national standard mapping, problem description, and remediation plan (refer to the quality standards document for character count requirements for remediation plans).

4. Generate Report

python scripts/skill.py finalize_report --output audit_report.md

finalize_report will output deduplicated and verified statistical JSON fields (such as effective_count, hallucinations_count, etc.). The final report will only contain discovered items with a status of “Valid.”

Applicable Scenarios and Considerations

Who is it for

  • Security or quality audits that need to reflect GB/T clause mappings in deliverables.
  • Users already using Agents like Cursor, Claude Code, or Codex who want to solidify audit steps into a Skill rather than writing prompts manually every time.
  • Teams that want a clear division of labor between “Rule-based Fast Scan + Model Deep Audit” and unified Markdown archival output.

Limitations and Precautions

  • The fast scan relies mainly on regex and optional external tools and cannot replace the LLM audit step; the Skill explicitly requires the LLM audit to cover all source files and verify line numbers independently. Otherwise, finalize_report may record entries as hallucinations and exclude them from the report.
  • The quality of national standard mapping and descriptions depends on whether the Agent executes according to quality_standards.md; the script only performs format and snippet verification, while semantic validity is the responsibility of the model.
  • The SkillHub category is dev-programming. The roadmap document mentions future plans for CI/CD and Web UI, etc.; refer to the SKILL.md inside the package for details. Do not assume unreleased capabilities are available.
  • If external tools like Bandit, Semgrep, or Gitleaks are not installed, fast scan capabilities may be reduced; confirmation based on the local environment is necessary.

Conclusion

gbt-code-audit consolidates national standard clauses, a dual-stage audit workflow, and report generation scripts into a single Agent Skill, making it suitable for reproducible code security audits within the context of Chinese compliance. Installation and coordinates are subject to SkillHub:

  • Page: https://www.skillhub.cn/skills/user_9b59adcf/zzcp-gbt-code-audit
  • API Entry: https://api.skillhub.cn/user_9b59adcf/zzcp-gbt-code-audit
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye