T09 · Insecure Skill Coding Practices
- Location
scripts/sync_to_bitable.py:44- Finding
Feishu Application Secret Exposed Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
scripts/sync_to_bitable.py:44-52; usage is documented inSKILL.md:74-78
Vulnerability Type: Sensitive credential exposure through process arguments
Risk Level: MediumVulnerable Code
python def main(): parser = argparse.ArgumentParser(description="条文写入飞书多维表格") parser.add_argument("json", help="提取结果JSON路径") parser.add_argument("--app_token", required=True, help="飞书多维表格app_token") parser.add_argument("--table_id", required=True, help="表格table_id") parser.add_argument("--app_id", required=True, help="飞书App ID") parser.add_argument("--app_secret", required=True, help="飞书App Secret") parser.add_argument("--dry_run", action="store_true", help="仅检查,不写入") parser.add_argument("--delete_dupes", action="store_true", help="删除重复记录(保留最早的)") args = parser.parse_args()The documented invocation also explicitly places the secret in the command line:
bash python scripts/sync_to_bitable.py <output.json> \ --app_token <APP_TOKEN> --table_id <TABLE_ID> \ --app_id <APP_ID> --app_secret <APP_SECRET> \ --delete_dupesTechnical Analysis
The Feishu application secret is accepted as a normal command-line argument. Process arguments may be visible through operating-system process inspection facilities, shell history, terminal recording, CI/CD logs, job metadata, crash reports, and endpoint monitoring products.
The secret is legitimately required to request a Feishu tenant access token, and the reviewed code sends it only to the official
open.feishu.cnauthentication endpoint. The vulnerability is therefore not an undeclared network exfiltration path; it is an unsafe local credential-delivery mechanism.Attack Path
- A user follows the documented command and supplies the Feishu application secret through
--app_secret. - The command is retained in shell history, captur ...[truncated 743 chars]
- A user follows the documented command and supplies the Feishu application secret through
- Remediation
View remediation
Remediation Suggestions
- Remove the
--app_secretcommand-line option. - Read the secret from a protected environment variable or operating-system secret store.
- For interactive execution, use
getpass.getpass()so the secret is not echoed or stored in shell history. - For automated execution, integrate with a managed secret service and inject the secret only into the target process.
- Ensure the secret is never printed, included in exception messages, or written to logs.
- Restrict the Feishu application to the minimum Bitable scopes required by this workflow.
- Rotate the existing application secret if it has already been used through documented command lines or CI jobs.
- Remove the
