Skip to main content

Posts

Showing posts with the label Backend

Preventing XML External Entity (XXE) Attacks: A Developer's Guide

  XML is often viewed as a legacy format, yet it remains the backbone of enterprise data exchange, SOAP web services, and configuration files. While modern development has shifted toward JSON, many backend systems still rely on XML parsers that carry a decade-old security debt:   XML External Entity (XXE) injection. The vulnerability lies not in your application logic, but in the default configurations of the XML parsers you use. A standard parser configuration often allows the XML document to define its own structure and pull data from external sources. If left unchecked, an attacker can coerce your server into opening local system files (like  /etc/passwd ), scanning internal ports (SSRF), or executing denial-of-service attacks. This guide breaks down the root cause of XXE and provides copy-paste, production-ready remediation for Java, Python, and Node.js. The Root Cause: Why Defaults Are Dangerous To fix XXE, you must understand the  Document Type Definition (DTD)...

Handling Claude API 'overloaded_error' and Rate Limits in Production

  Nothing breaks a production release faster than a third-party dependency failing under load. If you are integrating Anthropic’s Claude 3.5 Sonnet or Opus into your backend, you have likely encountered the infamous   overloaded_error   (HTTP 529) or the   rate_limit_error   (HTTP 429). These errors are not standard crashes; they are signals of congestion. When handled poorly, they cause cascading failures in your application. When handled correctly, they are mere latency hiccups that your users never notice. This guide provides a production-grade strategy for stabilizing your Python backend against Anthropic API volatility using exponential backoff, jitter, and the  tenacity  library. The Root Cause: Why 529 and 429 Errors Occur Before applying the fix, we must understand the mechanics of the failure. This ensures we treat the disease, not just the symptoms. The 529 Overloaded Error An HTTP 529 error means Anthropic's compute clusters are temporarily ...