T09 · Insecure Skill Coding Practices
- Location
scripts/set_credential.py:45- Finding
Credentials Are Supplied Through Process Command-Line Arguments
- Content
View full analysis
") print(f"平台: {', '.join(VALID_PLATFORMS)}") print("字段示例: api_key, access_key, secret_key, cookie, app_id, app_secret") print("\n示例:") print(" python3 set_credential.py tavily api_key tvly-xxxxx") print(" python3 set_credential.py stepfun api_key sk-xxxxx") print(" python3 set_credential.py wechat app_id wx_xxxxx") sys.exit(1) platform = sys.argv[1] field = sys.argv[2] value = sys.argv[3] ``` The documented invocation reinforces this behavior: ```bash python3 skills/content-credential-manager/scripts/set_credential.py ``` ### Technical Analysis The credential value is accepted directly through `sys.argv[3]`. Command-line arguments are not an appropriate transport for API keys, application secrets, or authenticated browser cookies. Depending on the operating system and process-isolation configuration, command-line arguments may be exposed through: - Process inspection tools such as `ps`. - Process metadata interfaces such as `/proc//cmdline`. - Shell command history. - Terminal session logging or audit tooling. - Process-monitoring and endpoint-management agents. - Agent execution logs that record commands before invocation. Masking the value after it has been processed does not protect it from these channels. The masking function only affects the script's final output, while the original value remains present in the process argument vector for the process lifetime. The risk is especially significant for `xiaohongshu.cookie`, because an authenticated session cookie may enable direct account impersonation withou ...[truncated 1737 chars]- Remediation
View remediation
