T09 · Insecure Skill Coding Practices
- Location
SKILL.md:130- Finding
Plaintext Credential Storage and Client-Side Secret Embedding
- Content
View full analysis
Vulnerability Details
File Locations:
SKILL.md:130-174SKILL.md:253SKILL.md:446-453assets/generate_excel_template.py:42-57
Vulnerability Type: Plaintext sensitive-data storage and hardcoded client-side secrets
Risk Level: HighVulnerable Code Snippets
SKILL.md:130-174directs the workflow to copy a credential-bearing workbook into the project root and process its secret fields:text 3. 复制到用户项目根目录并命名为 `ShareSDK_HarmonyOS_Config.xlsx`text - MobTech `appKey` - MobTech `appSecret`text 读取 `ShareSDK_HarmonyOS_Config.xlsx` 后,至少校验: - `appKey`:必填,不能为空 - `appSecret`:必填,不能为空SKILL.md:253instructs the Agent to embed MobTech credentials directly into ArkTS source code:ts ZztSDK.init(context, "您的AppKey", "您的AppSecret")SKILL.md:446-453similarly embeds a WeChat AppSecret in client-side configuration:ts let map = new HashMap<string, Object>() map.set(mobShare.Platform_Info.APP_KEY, "wechat_app_key") map.set(mobShare.Platform_Info.APP_SECRET, "wechat_app_secret") let isSuccess = await mobShare.ShareSDK.getInstance().setPlatformDevInfoAsync(mobShare.Platform.Wechat, map)assets/generate_excel_template.py:42-57creates plaintext workbook fields for these credentials:python data = [ ["appKey", "MobTech ShareSDK 的 AppKey,从 MobTech 控制台获取", ""], ["appSecret", "MobTech ShareSDK 的 AppSecret,从 MobTech 控制台获取", ""], ["bundleName", "HarmonyOS 应用包名或项目标识,用于识别目标工程", ""], ["apiVersion", "HarmonyOS API 版本,官方文档要求 >= 12", "12"], ["enableHuaweiAuth", "是否启用华为授权:是/否", "否"], ["clientId", "华为授权的 Client ID;仅在启用华为授权时必填", ""], ["enableWeibo", "是否启用新浪微博授权/分享:是/否", "否"], ["weiboAppKey", "微博平台 AppKey;仅在启用微博时必填", ""], ["weiboRedirectUrl", "微博平台 RedirectURI;仅在启用微博时必填", ""], ["weiboCallbackAbilityName", "微博回呼 Ability 名称,例如 EntryAbility;仅在启用微博时必填", ""], ["weiboScope", ...[truncated 2552 chars]- Remediation
View remediation
Remediation Suggestions
- Do not collect long-lived secrets through a workbook stored in the application project.
- Never embed server-side secrets, including WeChat AppSecret, in ArkTS source or distributed application packages.
- Move operations that require confidential credentials to a trusted backend. The client should communicate with that backend using short-lived, narrowly scoped tokens.
- Distinguish public client identifiers from confidential credentials in the template and documentation.
- If temporary local secret input is unavoidable:
- Store it outside the project tree.
- Restrict filesystem permissions to the current user.
- Prevent logging or displaying secret values in generated diffs.
- Securely remove the temporary file immediately after processing.
- Add generated configuration workbooks and local secret files to
.gitignorebefore users enter credentials. - Use an approved secret manager or protected CI/CD variables for build-time values that legitimately must be supplied during a trusted build.
- Add automated secret scanning to pre-commit hooks and CI pipelines.
- Document an incident procedure requiring immediate revocation and rotation of credentials exposed in repositories, build artifacts, logs, or application packages.
