Commit Graph

5 Commits

Author SHA1 Message Date
RuiChen_01 9e718f59d3 fix(skill): enforce SA caller and skill permission checks
CheckSkillPermission previously only verified system-app status when
callerTokenId was 0, leaving the CliToolMgr-proxied path (non-zero
callerTokenId) without any verification. Add two layers of checks:

- Direct IPC caller must be a system ability (IsSACall)
- Indirect caller must hold every permission declared by the skill
  (AccessTokenKit::VerifyAccessToken)

Also drop the callerTokenId=0 default and thread callerTokenId through
the ExecuteInAppSkill path so the direct-call variant is also covered.

Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>

🤖‍ AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
2026-06-18 16:33:36 +08:00
RuiChen_01 797ad0dc8c feat: use caller identity for skill target permission verification
When launching target ServiceExtension or UIAbility through skill
execution, use the real caller's tokenId for permission verification
instead of aimgr's SA identity. This avoids bypassing all permission
checks and eliminates the need to grant extra permissions to aimgr.

- Add SKILL_EXECUTE_PARAM_CALLER_TOKEN_ID Want parameter key
- Pass callerTokenId via Want from ExecuteInAppSkill(withTokenId)
- CheckStaticCfgPermission: detect skill path, skip SA shortcut,
  verify permissions using caller's tokenId
- Derive callerUid from callerTokenId inside launch functions
  via GetHapTokenInfo, no extra function parameters needed

Change-Id: I0f871ce89953afc3cf69548b75d125cee3ede5d1
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
2026-05-21 14:15:03 +08:00
RuiChen_01 d4bd50c012 add support cli exec skill
Co-Authored-By: Agent
Change-Id: Idb644d4dc783549382aae1546a1dde63209b0fb8
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>

update: 更新文件 config.json

Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
2026-05-11 07:16:23 +08:00
RuiChen_01 6d2edfe428 feat: add skill execute timeout mechanism and fix ServiceExtension context
Reuse AMS EventHandler timeout framework to protect SkillExecuteManager
from stale EXECUTING records. When the target app never calls
completeArkTSScriptInApp, the record is automatically cleaned up after
timeout and the caller receives ERR_TIMED_OUT via callback.

Timeout = GetAppStartTimeoutTime() * SKILL_EXECUTE_TIMEOUT_MULTIPLE
(10s in production, 150s under ASAN), aligned with InsightIntent.

Also fix VerifyContext property name: ServiceExtension context uses
"extensionAbilityInfo" not "extensionInfo", which caused
completeArkTSScriptInApp to silently fail for ServiceExtension targets.

Co-Authored-By: Agent
Change-Id: I4e02afc0a75c069b1c5cb677fa81b469ef566f34
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
2026-05-07 15:45:11 +08:00
RuiChen_01 f0aec2c731 support skill execute
Co-Authored-By: Agent
Change-Id: If269cf2bf97f5bc1f671b528d9d648a5b69fedb3
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>

new cmd

Change-Id: Id9b3d5f48412705c544602e4124d39e9d06f1cb1
Signed-off-by: zexin_c <chenzexin14@huawei.com>
2026-05-05 20:47:30 +08:00