other
- Location
scripts/image_generator.py:54- Finding
Undisclosed Persistent Host Identifier Transmitted to a Third-Party Service
- Content
View full analysis
Vulnerability Details
File Location:
scripts/image_generator.py, lines 22–23, 54–67, and 112–114
Vulnerability Type: Undisclosed environment reconnaissance and persistent activity tracking
Risk Level: MediumComplete Code Snippet
python SETTINGS_PATH = Path.home() / '.deepcode-plus' / 'settings.json' MACHINE_ID_PATH = Path.home() / '.deepcode' / 'machine-id'python def get_machine_id() -> str | None: try: if MACHINE_ID_PATH.exists(): machine_id = MACHINE_ID_PATH.read_text(encoding='utf-8').strip() if machine_id: return machine_id random_part = secrets.token_hex(8) timestamp = int(time.time() * 1000) machine_id = f'{socket.gethostname()}-{random_part}-{timestamp}' MACHINE_ID_PATH.parent.mkdir(parents=True, exist_ok=True) MACHINE_ID_PATH.write_text(machine_id, encoding='utf-8') return machine_id except OSError: return Nonepython headers = {'Content-Type': 'application/json'} if api_key: headers['PLUS-API-KEY'] = api_key if machine_id := get_machine_id(): headers['Token'] = machine_idTechnical Analysis
The script obtains the local hostname through
socket.gethostname(), combines it with a random value and timestamp, and writes the resulting identifier to~/.deepcode/machine-id. On subsequent executions, the same value is read from disk and transmitted in theTokenHTTP header todeepcode.vegamo.cn.This behavior occurs inside the common
request_json()function, meaning the identifier is sent during both anonymous cost calculations and authenticated image-generation requests. Consequently, the remote service can correlate pre-authentication and authenticated activity across separate executions.The hostname collection is a limited form of environment reconnaissance. A hostname may reveal a username, employee identi ...[truncated 2795 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove
get_machine_id()and theTokenheader if device identification is not strictly required by the service. - Do not include
socket.gethostname()or other local environment information in any identifier sent over the network. - If a client identifier is operationally necessary, generate a cryptographically random identifier containing no hostname, username, timestamp, path, or other device metadata.
- Make persistent identification opt-in and clearly document:
- The exact information collected.
- Its purpose.
- The destination service.
- How long it persists.
- How users can inspect, reset, or disable it.
- Do not transmit a persistent identifier during anonymous cost calculations unless it is demonstrably required.
- Prefer short-lived, request-scoped identifiers over values stored across sessions.
- Store any approved persistent identifier in the Skill's documented configuration directory with restrictive file permissions.
- Add tests confirming that cost and generation requests contain only documented headers and do not disclose hostname or other local environment metadata.
- Update
SKILL.mdwith an accurate privacy and network-data disclosure if any telemetry remains after remediation.
- Remove
