T09 · Insecure Skill Coding Practices
- Location
scripts/onedrive_photo_batch.py:338- Finding
Private OneDrive Photos and API Credentials Can Be Sent to an Unrestricted OCR Endpoint
- Content
View full analysis
str: if not self.endpoint or not self.api_key: raise RuntimeError("OCR endpoint/api_key 未配置") raw = image_path.read_bytes() b64 = base64.b64encode(raw).decode("utf-8") url = f"{self.endpoint}/chat/completions" payload = { "model": model, "messages": [ { "role": "user", "content": [ {"type": "text", "text": prompt or self.prompt}, {"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{b64}"}}, ], } ], "max_tokens": self.max_tokens, "temperature": 0.1, } resp = requests.post( url, headers={"Authorization": f"Bearer {self.api_key}", "Content-Type": "application/json"}, json=payload, timeout=self.timeout, ) ``` ### Technical Analysis The OCR client reads each downloaded OneDrive photo in full, Base64-encodes it, and places the encoded image in a JSON request sent to a configuration-controlled endpoint. Base64 is only a transport representation and provides no confidentiality. Sending photos to an OCR service is related to ...[truncated 1740 chars]- Remediation
View remediation
