T09 · Insecure Skill Coding Practices
- Location
scripts/feynman_api.py:539- Finding
Unauthenticated Wildcard-CORS API Exposes Private Workspace Data
- Content
View full analysis
None: data = json.dumps(payload, ensure_ascii=False).encode("utf-8") self.send_response(code) self.send_header("Content-Type", "application/json; charset=utf-8") self.send_header("Content-Length", str(len(data))) self.send_header("Cache-Control", "no-store") self.send_header("Access-Control-Allow-Origin", "*") self.send_header("Access-Control-Allow-Methods", "GET,OPTIONS") self.send_header("Access-Control-Allow-Headers", "Content-Type,Authorization") self.end_headers() self.wfile.write(data) def do_OPTIONS(self) -> None: self.send_response(204) self.send_header("Access-Control-Allow-Origin", "*") self.send_header("Access-Control-Allow-Methods", "GET,OPTIONS") self.send_header("Access-Control-Allow-Headers", "Content-Type,Authorization") self.end_headers() ``` The following unauthenticated routes return workspace data: ```python if path == "/api/feynman/contracts": contracts = self.store.contracts() self._send_json({"contracts": contracts, "total": len(contracts)}) return if path == "/api/feynman/profile": self._send_json({"profile": {"markdown": self.store.user_profile()}}) return if len(parts) == 2 and parts[1] == "conversations": q = parse_qs(parsed.query) try: limit = int((q.get("limit") or ["5"])[0]) except ValueError: limit = 5 clause_id = (q.get("clause_id") or [""])[0].strip() or None limit = max(1, min(limit, 50)) convs = self.store.conversations(parts[0], limit, clause_id=clause_id) self._send_json({"conversations": convs, "total": len(convs)}) return if len(parts) == 2 and parts[1] == "memory": memory_text = self.store.contract_memory(parts[0 ...[truncated 2160 chars]- Remediation
View remediation
