T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:78
- Finding
- Feishu application secret exposed through command-line arguments<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:78-80`, `quick-setup.js:58-60`, `quick-setup.mjs:57-59` **Vulnerability Type**: Sensitive credential exposure through process arguments **Risk Level**: Medium ### Vulnerable Code `SKILL.md:78-80`: ```bash node "{script_dir}/quick-setup.mjs" --save --app-id "APP_ID" --app-secret "APP_SECRET" --domain "feishu" ``` `quick-setup.mjs:57-59`: ```js case '--device-code': result.deviceCode = argv[++i]; break; case '--app-id': result.appId = argv[++i]; break; case '--app-secret': result.appSecret = argv[++i]; break; ``` The equivalent CommonJS implementation appears in `quick-setup.js:58-60`: ```js case '--device-code': result.deviceCode = argv[++i]; break; case '--app-id': result.appId = argv[++i]; break; case '--app-secret': result.appSecret = argv[++i]; break; ``` ### Technical Analysis The documented setup workflow instructs the agent to pass the newly issued Feishu application secret as a command-line argument. Both script variants then read that secret directly from `process.argv`. Command-line arguments are not an appropriate transport mechanism for long-lived credentials. Depending on the operating system and execution environment, arguments may be exposed through: - Process inspection interfaces and process-listing tools. - Agent command execution records. - Shell history or terminal session recording. - Audit, telemetry, debugging, and monitoring systems. - Error reports that capture the invoked command. - Other local users or processes with sufficient process-inspection access. Although the scripts do not transmit the app secret to an unrelated network destination, this local exposure is unnecessary. The secret is received from the official Feishu or Lark registration endpoint and should be transferred directly into protected storage without being interpolated into another command. ### Attack Path 1. A user authorizes creation of a new Feishu application. 2. The p ...[truncated 1449 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove `--app-secret` from the documented and implemented command-line interface. 2. Accept the secret through standard input or a dedicated inherited file descriptor. Ensure that the agent execution layer does not log the input. 3. Prefer a single operation that polls for the credentials and writes them directly to protected configuration, so the secret never needs to be returned to and reinserted by the agent. 4. If a temporary credential file is unavoidable: - Create it with mode `0o600`. - Place it in a private directory with mode `0o700`. - Open it using exclusive creation semantics. - Delete it immediately after use. 5. Add explicit redaction of `appSecret`, `client_secret`, and equivalent fields to command logs, error reports, and diagnostic output. 6. Update both `quick-setup.js` and `quick-setup.mjs` together to prevent the fallback implementation from retaining the vulnerable interface. 7. Rotate any application secret that may already have been captured in command or agent execution logs. ]]>
