Skip to content

Sanitize proxy URL in logs - #3

Open
kyletaylored wants to merge 1 commit into
mainfrom
dd/sanitize-proxy-url-logging
Open

Sanitize proxy URL in logs#3
kyletaylored wants to merge 1 commit into
mainfrom
dd/sanitize-proxy-url-logging

Conversation

@kyletaylored

Copy link
Copy Markdown
Owner

This pull request addresses a security vulnerability where sensitive information could be leaked into application logs.

Problem

Code Security (SAST) • View in Code Security (SAST)

The ProxyHost.cs file was logging the full config.ProxyUrl string. If this URL contained user credentials (e.g., http://user:password@proxy.com), the sensitive information would be stored in plain text within the logs, violating secure logging practices.

Solution

I have updated the logging logic to sanitize the proxy URL before it is recorded. The code now:

  1. Attempts to parse the config.ProxyUrl into a System.Uri object.
  2. Uses GetComponents to strip out the UserInfo (username and password) component while preserving the rest of the absolute URI.
  3. Logs the sanitized version of the URL.

This ensures that the proxy destination is still identifiable in the logs without exposing any embedded credentials.


PR by Bits - View session in Datadog

Comment @DataDog to request changes

Co-authored-by: kyletaylored <1759794+kyletaylored@users.noreply.github.com>
@datadog-us3-kyle-taylor-sandbox

Copy link
Copy Markdown

View session in Datadog

Bits Dev status: ✅ Done

CI Auto-fix: Disabled | Enable

Comment @DataDog to request changes

@datadog-us3-kyle-taylor-sandbox

Copy link
Copy Markdown

I can only run on private repositories.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant