T09 · Insecure Skill Coding Practices
- Location
scripts/komodo.py:54- Finding
Komodo credentials and deployment secrets can be transmitted to an insecure or untrusted endpoint
- Content
View full analysis
Vulnerability Details
File Location:
scripts/komodo.py:54-70; additional sensitive-file transmission atscripts/komodo.py:379-410
Vulnerability Type: Unrestricted transmission of authentication credentials and environment secrets
Risk Level: HighVulnerable Code
python KOMODO_ADDRESS = os.environ.get("KOMODO_ADDRESS", "").rstrip("/") KOMODO_API_KEY = os.environ.get("KOMODO_API_KEY", "") KOMODO_API_SECRET = os.environ.get("KOMODO_API_SECRET", "") def api_call(endpoint: str, payload: dict | None = None, method: str = "POST") -> Any: """Make an API call to Komodo Core.""" if not KOMODO_ADDRESS: print("Error: KOMODO_ADDRESS not set", file=sys.stderr) sys.exit(1) if not KOMODO_API_KEY or not KOMODO_API_SECRET: print("Error: KOMODO_API_KEY or KOMODO_API_SECRET not set", file=sys.stderr) sys.exit(1) url = f"{KOMODO_ADDRESS}/{endpoint}" headers = { "Content-Type": "application/json", "X-Api-Key": KOMODO_API_KEY, "X-Api-Secret": KOMODO_API_SECRET, } data = json.dumps(payload or {}).encode("utf-8") req = urllib.request.Request(url, data=data, headers=headers, method=method) try: with urllib.request.urlopen(req, timeout=30) as response: return json.loads(response.read().decode("utf-8"))The
create-stackoperation also reads a caller-selected environment file and incorporates every parsed value into the network request:python def cmd_create_stack(name: str, server: str, compose_file: str, env_file: str | None = None): """Create a new stack from compose file.""" # Read compose file try: with open(compose_file, "r") as f: compose_contents = f.read() except FileNotFoundError: print(f"Error: Compose file '{compose_file}' not found.") sys.exit(1) # Read env file if provide ...[truncated 4088 chars]- Remediation
View remediation
Remediation Suggestions
- Parse
KOMODO_ADDRESSwithurllib.parse.urlparseand reject every scheme excepthttps. - Require the hostname to match an explicit operator-configured allowlist or a securely stored expected Komodo Core origin.
- Reject URLs containing unexpected user information, fragments, or malformed host components.
- Disable automatic redirects for authenticated requests, or only follow redirects after verifying that the scheme, hostname, and port exactly match the original trusted origin.
- Never forward
X-Api-KeyorX-Api-Secretacross an origin change. - Validate TLS certificates using the system trust store and do not introduce certificate-verification bypasses.
- Before
create-stackuploads an environment file, clearly display the destination host and request explicit confirmation. - Support an allowlist of environment-variable names so only values required by the stack are transmitted.
- Prefer secret references managed by Komodo or an external secret manager instead of embedding plaintext secret values in the stack payload.
- Use a dedicated, least-privileged Komodo API identity and separate read-only credentials from credentials authorized for deployment or deletion.
- Replace credentials immediately if they may previously have been sent over HTTP or to an untrusted endpoint.
- Parse
