Summary
OpenHarmony分布式系统安全代码检视专用技能。当用户要求"检视代码安全实现"、"代码安全审查"、"安全代码review"或类似的分布式系统代码安全检视请求时触发。此技能提供18条OpenHarmony分布式业务安全设计规则的详细检视指导,涵盖授权控制、状态机、数据传输、权限管理、可信关系等安全领域。使用此技能可…
openharmonyinsight/openharmony-skills
OpenHarmony分布式系统安?
npx skills add openharmonyinsight/openharmony-skills --skill oh-distributed-security-design-review
OpenHarmony分布式系统安全代码检视专用技能。当用户要求"检视代码安全实现"、"代码安全审查"、"安全代码review"或类似的分布式系统代码安全检视请求时触发。此技能提供18条OpenHarmony分布式业务安全设计规则的详细检视指导,涵盖授权控制、状态机、数据传输、权限管理、可信关系等安全领域。使用此技能可…
Related neighbors and high-traction skills in the same topics — useful to compare before installing.
Guidance for distinctive, intentional visual design when building new UI or reshaping an existi…
866.4K installsBrowser automation CLI for AI agents. Use when the user needs to interact with websites, includ…
810.4K installsReview UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "chec…
617.3K installsBuild, deploy, evaluate, optimize, fine-tune, and manage Microsoft Foundry agents, models, and …
576.5K installsDebug Azure production issues on Azure using AppLens, Azure Monitor, resource health, and safe …
568.9K installsOther skills from openharmonyinsight/openharmony-skills · top by installs.
npx skills add openharmonyinsight/openharmony-skills
Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.
main
Files included with this skill beyond the listing page.
SKILL.md
7,323 B
SUMMARY.md
551 B
本技能提供OpenHarmony分布式业务安全代码检视的专业指导,包含18条安全设计规则和对应的检视要点。当检视分布式系统代码安全性时,在通用网络安全规则基础上,使用这些规则进行加强检视。
首先理解代码的业务场景和所在模块:
- 分布式设备管理 - 分布式软总线 - 其他需要分布式能力的模块
- 设备间认证和授权 - 用户敏感数据传输 - 跨设备状态机管理 - 可信关系管理 - 硬件资源访问
根据代码涉及的业务类型,加载[securityrules.md](references/securityrules.md)中对应的规则:
快速索引关键词:
对每个适用的安全规则,执行以下检视:
`` 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 ``
- 对照规则中的Check points逐项检查 - 查找潜在的违规模式 - 识别缺失的安全措施
- 标记违规代码位置 (file:line) - 说明违反的具体规则 - 提供修复建议
除了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:
- ✓ Rule 1: 授权流程是否在客体侧独立控制 - ✗ Rule 2: 发现状态机未校验上下文 - ✓ Rule 7: 可信关系生命周期管理正确 - ✗ Rule 8: 发现自定义可信判断逻辑