mpfaffenberger / mpfaffenberger/code_puppy

http_utils.py: CODE_PUPPY_DISABLE_RETRY_TRANSPORT silently disables TLS verification; SSL_CERT_FILE misconfig ignored; retry loop duplicated with claude_cache_client

Open
#407 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
814
Forks
278
Avg merge
2d 5h
Merged PRs (30d)
76

Description

Problem

code_puppy/http_utils.py::get_cert_bundle_path (lines ~200-204):

def get_cert_bundle_path() -> str | None:
    # First check if SSL_CERT_FILE environment variable is set
    ssl_cert_file = os.environ.get(\"SSL_CERT_FILE\")
    if ssl_cert_file and os.path.exists(ssl_cert_file):
        return ssl_cert_file
  1. The comment says "First check" — implying more checks were planned — but the function silently falls off the end and returns None. If SSL_CERT_FILE is set but points to a missing file, the misconfiguration is silently ignored (errors passing silently) and httpx falls back to default verification with no warning.

  2. _resolve_proxy_config() (lines ~32-70): when CODE_PUPPY_DISABLE_RETRY_TRANSPORT is set, it silently disables all TLS verification (verify = False). The env var name says "disable retry transport"; nothing about it suggests it also turns off certificate checking for every model API call. A user setting it to work around retry behavior unknowingly downgrades transport security. Explicit is better than implicit — couple verify=False to its own clearly named variable (e.g. CODE_PUPPY_INSECURE_SKIP_VERIFY) and emit a warning when active.

  3. RetryingAsyncClient.send() and ClaudeCacheAsyncClient._send_with_retries() (claude_cache_client.py lines ~478-565) are two near-identical ~90-line retry loops (exponential backoff, Retry-After parsing incl. http-date, cap 0.5-60s, ConnectError/ReadTimeout/PoolTimeout handling). Differences are cosmetic (status tuples, Cerebras special-case, logging channel). Extract a shared _retry_send(send_fn, request, *, status_codes, max_retries, ignore_retry_after) helper so the inevitable bug fixes land in one place. Related: open issue #210 proposes a retry engine — consolidation is a prerequisite.

Suggested fix

  • Warn when SSL_CERT_FILE is set but missing.
  • Split insecure-verify off the retry-disable env var, with a loud warning.
  • One shared retry helper for both clients.

Filed by Zen Reviewer A (code-puppy-60635a)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with code_puppy/http_utils.py, reading get_cert_bundle_path, _resolve_proxy_config(), and RetryingAsyncClient.send(), then compare claude_cache_client.py::_send_with_retries() and issue #210. Done means missing SSL_CERT_FILE is surfaced, insecure verification requires its own explicit setting and warning, and both clients use one shared retry helper without changing the stated retry behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, networking, security
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.