T09 · Insecure Skill Coding Practices
- Location
skills/smyx_common/scripts/util.py:410- Finding
Workspace identity or credential value is silently transmitted to a remote authentication service
- Content
View full analysis
Vulnerability Details
File Location:
skills/smyx_common/scripts/util.py:410-418,skills/smyx_common/scripts/util.py:450-465, andskills/smyx_common/scripts/util.py:543-558
Vulnerability Type: Unvalidated sensitive-data transmission
Risk Level: MediumVulnerable Code
python @classmethod def get_api_key_file_open_id(cls): """Read the internal identity value from data/smyx-api-key.txt.""" api_key_path = os.path.join(cls.get_workspace_data_dir(), "smyx-api-key.txt") try: if not os.path.exists(api_key_path): return None with open(api_key_path, "r", encoding="utf-8") as f: value = f.read().strip() return value or None except Exception as e: CommonUtil.trace_exception_stack(e) return Nonepython @classmethod def resolve_current_open_id(cls, open_id=None, use_current=True): """Resolve and initialize the current open-id.""" resolved_open_id = (open_id or "").strip() if isinstance(open_id, str) else open_id if not resolved_open_id and use_current: resolved_open_id = ConstantEnum.CURRENT__OPEN_ID or ConstantEnum.CURRENT__USER_NAME if not resolved_open_id: resolved_open_id = cls.get_api_key_file_open_id() if not resolved_open_id: resolved_open_id = cls.get_or_create_default_open_id() ConstantEnum.CURRENT__OPEN_ID = resolved_open_id if not ConstantEnum.CURRENT__USER_NAME: ConstantEnum.CURRENT__USER_NAME = resolved_open_id return resolved_open_idpython def _get_or_create_user(username): _url = ApiEnum.BASE_URL_HEALTH + "/sys/phoneLogin" open_id = username _data = { "silent": 1, "register": 1, "openId": open_id, "mobile": username, "source": ConstantEnum.DEFAULT__SKILL_HUB_NAME } try: _response = requests.post(_url, json=_data) ...[truncated 2377 chars]- Remediation
View remediation
Remediation Suggestions
- Do not use a file named
smyx-api-key.txtas an identity source. - Store the pseudonymous identity in a clearly named Skill-specific file, such as
smyx-user-id.txt. - Validate imported identifiers against a strict format, character set, and maximum length before use.
- Reject values resembling API keys, bearer tokens, phone numbers, or other credentials.
- Do not populate the
mobilefield unless the value is an explicitly supplied and verified telephone number. - Prefer generating a random, Skill-scoped identifier locally when no identity has been supplied.
- Clearly disclose remote identity registration and obtain appropriate consent before transmitting an existing workspace identifier.
- Minimize remote logging and define a documented retention and deletion policy for identity values.
- Do not use a file named
