skills/oh-distributed-security-design-review/SKILL.md
OpenHarmony分布式系统安全代码检视专用技能。当用户要求"检视代码安全实现"、"代码安全审查"、"安全代码review"或类似的分布式系统代码安全检视请求时触发。此技能提供18条OpenHarmony分布式业务安全设计规则的详细检视指导,涵盖授权控制、状态机、数据传输、权限管理、可信关系等安全领域。使用此技能可在通用网络安全规则基础上,针对OpenHarmony分布式系统进行专项安全检视。
npx skillsauth add openharmonyinsight/openharmony-skills oh-distributed-security-design-reviewInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
本技能提供OpenHarmony分布式业务安全代码检视的专业指导,包含18条安全设计规则和对应的检视要点。当检视分布式系统代码安全性时,在通用网络安全规则基础上,使用这些规则进行加强检视。
首先理解代码的业务场景和所在模块:
识别关键模块: 确定代码是否涉及以下模块
识别业务类型: 判断是否涉及以下安全敏感业务
确定角色: 识别代码是主体侧(客户端)还是客体侧(服务端)
根据代码涉及的业务类型,加载security_rules.md中对应的规则:
快速索引关键词:
对每个适用的安全规则,执行以下检视:
定位相关代码: 使用Grep搜索关键模式
Grep patterns examples:
- "auth", "authorize", "permission" for authorization checks
- "PIN", "secret", "key" for sensitive data
- "state", "status" for state machine
- "random", "generate" for secret generation
检查实现细节:
记录发现:
除了OpenHarmony特定规则外,还需检查通用安全实践:
生成结构化的安全检视报告,包含:
Bad Example:
// 客体侧直接使用主体侧传入的标志控制弹框
void handleAuthRequest(bool showPopup) {
if (!showPopup) {
// 直接跳过授权弹框
grantAccess();
}
}
Correct Approach:
// 客体侧独立决策是否需要授权
void handleAuthRequest() {
if (isSystemBusinessAndRegistered()) {
// 已注册的免授权业务
grantAccess();
} else {
// 默认必须弹框
showAuthorizationDialog();
}
}
Bad Example:
// 明文传输PIN码
message.pin_code = userPin;
sendToRemote(message);
Correct Approach:
// 加密后传输
encryptedPin = encryptPin(userPin, sessionKey);
message.encrypted_pin = encryptedPin;
sendToRemote(message);
Bad Example:
// 自行比对账号信息判断可信关系
bool isTrusted() {
return localAccount == remoteAccount;
}
Correct Approach:
// 依赖HiChain查询
bool isTrusted() {
CredentialType type = HiChain.queryCredentialType(remoteDevice);
return type == CredentialType.SAME_ACCOUNT;
}
Bad Example:
// 默认值放通
bool enableSecurityCheck = true; // 默认启用
Correct Approach:
// 默认值禁用
bool enableSecurityCheck = false; // 默认禁用,需显式启用
User request: "检视这段分布式设备管理代码的安全性"
Review process:
testing
--- name: ohos-req-value-decision description: Use after review meeting to record decision and route to next step. Triggers: 评审决策纪要, 评审结论回流, value decision, 评审接纳, 评审不接纳, 评审退回, 下次重新上会. Do NOT use for feature baseline (ohos-req-feature-baseline), review gate checks (ohos-req-review-gate), or IR generation (ohos-req-feature-to-ir). metadata: author: openharmony scope: common stage: requirements capability: value-decision version: 0.3.0 status: draft tags: - sdd - requirements
development
Use when converting an OpenHarmony requirement document, spec, or design proposal into an OpenHarmony review slide deck (需求评审 / 需求变更评审 / 设计评审 PPTX) — produces the fixed OpenHarmony-branded review-deck structure (OH logo on every page) with architecture/flow diagrams and field tables. Triggers on "需求评审PPT", "需求变更评审", "把需求文档转成评审PPT", "spec转评审PPT", "requirement/spec to review deck". NOT for arbitrary or generic slide decks unrelated to OpenHarmony requirement/design review.
testing
Use when performing the Phase 0 Step 0.5 Review Ready Gate on a 04-feature.md, especially when the user says "evaluate gate", "review readiness", "feature ready?", "should we generate IR", or when the ohos-req-intake-orchestration main session needs a structured Ready / Conditional Ready / Not Ready judgment instead of doing the check inline. Reads 01-04, runs seven fixed checks plus a conditional-items check, and returns a machine-readable JSON summary plus a human-readable table that the main session can route on. Do NOT use for feature baseline generation (ohos-req-feature-baseline), value decision recording (ohos-req-value-decision), or IR generation (ohos-req-feature-to-ir).
testing
--- name: ohos-req-requirement-intake description: Use when importing an OHOS requirement into Phase 0.1, especially for 01-requirement.md, requirement intake, background, user value, scenarios, scope, FR/NFR, affected modules, or priority. Triggers: 需求导入, 01-requirement, 需求基线, RR单号. Do NOT use for feasibility analysis (ohos-req-feasibility-analysis), architecture decision (ohos-req-arch-decision), or feature baseline (ohos-req-feature-baseline). metadata: author: openharmony scope: common