T09 · Insecure Skill Coding Practices
- Location
scripts/jms_runtime.py:286- Finding
Arbitrary Command Execution When Generated Environment Configuration Is Sourced
- Content
View full analysis
str: return f"{key}={json.dumps(str(value), ensure_ascii=False)}" def write_local_env_config(payload: dict[str, Any]) -> dict[str, Any]: merged = _merge_config_values(payload) address_values = _resolve_address_values(merged) auth_mode, auth_values = _resolve_auth_values(payload, merged) final_values: dict[str, str] = {} final_values.update(address_values) final_values["JMS_VERSION"] = str(merged.get("JMS_VERSION") or "4") final_values["JMS_ORG_ID"] = str(merged.get("JMS_ORG_ID", "")) final_values.update(auth_values) timeout = merged.get("JMS_TIMEOUT") if _value_is_set(timeout): final_values["JMS_TIMEOUT"] = str(timeout) module_name = merged.get("JMS_SDK_MODULE") if _value_is_set(module_name): final_values["JMS_SDK_MODULE"] = str(module_name) attr_name = merged.get("JMS_SDK_GET_CLIENT") if _value_is_set(attr_name): final_values["JMS_SDK_GET_CLIENT"] = str(attr_name) lines = [ "# Generated by scripts/jms_diagnose.py config-write", "# Keep this file local. It may contain secrets.", "", ] for key in ( "JMS_API_URL", "JMS_VERSION", "JMS_ORG_ID", "JMS_ACCESS_KEY_ID", "JMS_ACCESS_KEY_SECRET", "JMS_USERNAME", "JMS_PASSWORD", "JMS_TIMEOUT", "JMS_SDK_MODULE", "JMS_SDK_GET_CLIENT", ): if key in final_values: lines.append(_format_env_assignment(key, final_values[key])) LOCAL_ENV_FILE.write_text("\n".join(lines) + "\n", encoding="utf-8") if os.name != "nt": LOCAL_ENV_FILE.chmod(0o600) ``` From `env.sh`: ...[truncated 2282 chars]- Remediation
View remediation
