Skip to content

Fix PR #166 review items: import placement and proxy credential redaction #169

@RichardAtCT

Description

@RichardAtCT

Follow-up from PR #166 (proxy fix)

Two review items from PR #166 that should be addressed after merge:

1. Move import os to module top-level

src/bot/core.pyimport os is inside a method body. Move to top-level imports (it may already be imported there).

2. Redact proxy credentials before logging

src/bot/core.py — The proxy URL is logged verbatim, which could expose credentials if the URL contains user:pass@host:port. Add redaction:

from urllib.parse import urlparse
parsed = urlparse(proxy_url)
safe = parsed._replace(password="***").geturl() if parsed.password else proxy_url
logger.info("Proxy configured", proxy=safe)

3. (Optional) Add test coverage

A unit test that mocks os.environ with HTTPS_PROXY set and asserts builder.proxy() is called.

Ref: #166 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions