Back to skill

Security audit

Harmonyos Sharesdk Integretion

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent ShareSDK integration guide, but it asks users to place app secrets in project files without adequate secret-handling safeguards.

Review this skill before installing. Use it only in a test project or after adapting the workflow so secrets are kept out of source code and project-root files, ignored by version control, and rotated if exposed. Pin and review the ohpm dependencies before running the install commands.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:130
Finding

Plaintext Credential Storage and Client-Side Secret Embedding

Content
View full analysis

Vulnerability Details

File Locations:

  • SKILL.md:130-174
  • SKILL.md:253
  • SKILL.md:446-453
  • assets/generate_excel_template.py:42-57

Vulnerability Type: Plaintext sensitive-data storage and hardcoded client-side secrets
Risk Level: High

Vulnerable Code Snippets

SKILL.md:130-174 directs 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:253 instructs the Agent to embed MobTech credentials directly into ArkTS source code:

ts
ZztSDK.init(context, "您的AppKey", "您的AppSecret")

SKILL.md:446-453 similarly 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-57 creates 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

  1. Do not collect long-lived secrets through a workbook stored in the application project.
  2. Never embed server-side secrets, including WeChat AppSecret, in ArkTS source or distributed application packages.
  3. Move operations that require confidential credentials to a trusted backend. The client should communicate with that backend using short-lived, narrowly scoped tokens.
  4. Distinguish public client identifiers from confidential credentials in the template and documentation.
  5. 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.
  6. Add generated configuration workbooks and local secret files to .gitignore before users enter credentials.
  7. Use an approved secret manager or protected CI/CD variables for build-time values that legitimately must be supplied during a trusted build.
  8. Add automated secret scanning to pre-commit hooks and CI pipelines.
  9. Document an incident procedure requiring immediate revocation and rotation of credentials exposed in repositories, build artifacts, logs, or application packages.

T08 · Insecure Dependencies

Warning
Location
SKILL.md:194
Finding

Unpinned Third-Party Package Installation

Content
View full analysis

Vulnerability Details

File Locations:

  • SKILL.md:46-47
  • SKILL.md:194-195
  • README.md:53-54

Vulnerability Type: Unpinned third-party dependencies
Risk Level: Medium

Vulnerable Code Snippet

SKILL.md:194-195 supplies package installation commands without reviewed version constraints:

bash
ohpm install @zztsdk/zztcore
ohpm install @zztsdk/sharesdk

The same unpinned commands are also documented in SKILL.md:46-47 and README.md:53-54.

Technical Analysis

The commands allow the package manager to resolve whatever package versions satisfy its default behavior at execution time. Therefore, two users invoking the same Skill at different times may install different code.

The audited project contains no version pins, expected integrity hashes, publisher-verification procedure, or requirement to review the resolved dependency tree. A future compromised, malicious, vulnerable, or incompatible package release could consequently be installed after the Skill itself has already passed review.

The available evidence does not establish that either named package is currently malicious or typosquatted. The confirmed weakness is the absence of reproducible and verified dependency resolution.

Attack Path

  1. A developer authorizes the Skill to run the documented ohpm install commands.
  2. The package manager resolves the current registry versions rather than a specifically reviewed release.
  3. A compromised publisher account, registry incident, unsafe transitive dependency, or vulnerable future release supplies unreviewed code.
  4. The package is downloaded into the development environment and incorporated into the project.
  5. Depending on package-manager lifecycle behavior and package functionality, the unsafe code may affect the build environment or become part of the distributed application.

Impact Assessment

The exact privileges depend on package-manager behavior and the i ...[truncated 423 chars]

Remediation
View remediation

Remediation Suggestions

  1. Pin both direct dependencies to exact versions that have been reviewed and tested.
  2. Commit and enforce the package manager's lockfile so direct and transitive versions remain reproducible.
  3. Verify that packages resolve from the intended official registry and publisher namespace.
  4. Where supported, verify package integrity hashes or signatures before installation.
  5. Inspect the complete resolved dependency tree and review installation or lifecycle scripts.
  6. Run dependency installation in a restricted build environment with minimal credentials and filesystem access.
  7. Use automated vulnerability and supply-chain scanning in CI.
  8. Treat upgrades as explicit security-review events rather than automatically accepting the newest available release.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (4)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The README explicitly instructs the agent to execute a workflow that reads a project, validates templates, and generates or modifies project documentation and integration-related files, but it does not require explicit user confirmation before making changes. In an agentic context, missing change-safety guidance increases the risk of unauthorized or surprising edits to application configuration and docs, especially when integration steps may later touch sensitive files like module.json5 or initialization code.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The natural-language instructions throughout the file are exclusively in Chinese, and the document does not indicate that this language choice is optional or limited to a justified region-specific audience. The policy category calls for flagging language/locale constraints when a specific language is effectively forced without user opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

This code file contains user-facing natural-language content in the module docstring, spreadsheet headers, instructions, and console output, all forced to Chinese. Under the stated policy, a skill should not impose a specific language or locale without user opt-in or a documented justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file presents all user-facing example prompts exclusively in Chinese, which can amount to a language/locale policy violation when no user choice or opt-in is provided. There is no accompanying note that the skill is intended only for Chinese-speaking users or a region-specific audience.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.