Skip to content

security: redact authentication tokens from tracing logs - #76

Merged
mrizzi merged 1 commit into
mainfrom
minor-fixes
Sep 9, 2026
Merged

mrizzi merged 1 commit into
mainfrom
minor-fixes

Conversation

@rh-jfuller

@rh-jfuller rh-jfuller commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary by Sourcery

Protect authentication credentials in tracing logs while standardizing service logging verbosity.

Bug Fixes:

  • Prevent authentication credentials from appearing in tracing output by redacting sensitive fields such as authorization, token, access_token, and bearer values.

Enhancements:

  • Apply consistent field redaction to both stdio and streaming HTTP logging.
  • Reduce the default tracing verbosity for the stdio and streaming HTTP services from debug to info.

Tests:

  • Add coverage verifying sensitive tracing fields are redacted while non-sensitive fields remain visible.

@rh-jfuller
rh-jfuller requested a review from mrizzi September 9, 2026 08:55
@sourcery-ai

sourcery-ai Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Adds a shared tracing formatter that redacts common authentication fields, wires it into both server binaries, and lowers their default log verbosity from DEBUG to INFO while retaining environment-based filtering.

File-Level Changes

Change Details Files
Introduce a reusable tracing field formatter that masks common authentication field names before values reach log output.
  • Intercept debug-formatted fields and replace authorization, token, access_token, and bearer values with a fixed redaction marker.
  • Preserve default tracing formatting and span field accumulation behavior.
  • Add coverage verifying sensitive values are absent while non-sensitive fields remain visible.
src/logging.rs
src/lib.rs
Apply sensitive-field redaction and safer default verbosity to both executable tracing configurations.
  • Use the redacting formatter for stdio and streamable HTTP logs.
  • Lower fallback/default verbosity from DEBUG to INFO.
  • Keep environment filters available to override the baseline level.
src/bin/stdio.rs
src/bin/streamhttp.rs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.30769% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 37.90%. Comparing base (f06742d) to head (768539f).

Files with missing lines Patch % Lines
src/logging.rs 72.30% 18 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##            main      #76       +/-   ##
==========================================
+ Coverage   0.00%   37.90%   +37.90%     
==========================================
  Files          1        2        +1     
  Lines         59      124       +65     
  Branches      59      124       +65     
==========================================
+ Hits           0       47       +47     
- Misses        59       77       +18     
Flag Coverage Δ
unit-tests 37.90% <72.30%> (+37.90%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/logging.rs 72.30% <72.30%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mrizzi mrizzi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rh-jfuller thanks a lot for the improvement 👍

@mrizzi
mrizzi merged commit 76ba49b into main Sep 9, 2026
2 checks passed
@mrizzi
mrizzi deleted the minor-fixes branch September 9, 2026 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants