T09 · Insecure Skill Coding Practices
- Location
scripts/memory_probe.py:33- Finding
Hardcoded Langfuse Secret Transmitted Using Basic Authentication over Plaintext HTTP
- Content
View full analysis
str | None: """Log probe result to Langfuse as a trace. Returns trace ID or None.""" import urllib.request import base64 creds = base64.b64encode(f"{LANGFUSE_PK}:{LANGFUSE_SK}".encode()).decode() headers = { "Authorization": f"Basic {creds}", "Content-Type": "application/json", } trace_id = f"memory-probe-{TODAY}" payload = { "id": trace_id, "name": "memory_probe_daily", "timestamp": datetime.now(timezone.utc).isoformat(), "metadata": { "probe_date": TODAY, "backend": "qmd", "qmd_version": "1.0.7", }, "input": {"query_count": len(QUERIES), "domains": list({q["domain"] for q in QUERIES})}, "output": probe_result, "tags": ["memory", "qmd", "telemetry"], } try: req = urllib.request.Request( f"{LANGFUSE_URL}/api/public/traces", data=json.dumps(payload).encode(), headers=headers, method="POST", ) with urllib.request.urlopen(req, timeout=10) as resp: return trace_id except Exception as e: print(f" ⚠ Langfuse log failed: {e}") return None ``` ```python def log_scores_to_langfuse(trace_id: str, scores: list[dict]): """Log per-metric scores to Langfuse.""" import urllib.request import base64 creds = base64.b64encode(f"{LANGFUSE_PK}:{LANGFUSE_SK}".encode()).decode() headers = { "Authorization": f"B ...[truncated 3415 chars]- Remediation
View remediation
