Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redact protocol error log when hide-user-data-from-log enabled #1889

Open
wants to merge 2 commits into
base: unstable
Choose a base branch
from

Conversation

YueTang-Vanessa
Copy link

In this code logic: https://github.com/valkey-io/valkey/blob/unstable/src/networking.c#L2767-L2773, c->querybuf + c->qb_pos may also include user data.
Update the log message when config hide-user-data-from-log is enabled.

@zuiderkwast
Copy link
Contributor

When exactly is this triggered? Only when the client sends some incorrectly encoded RESP?

Copy link

codecov bot commented Mar 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.00%. Comparing base (06990c2) to head (1b77cf5).
Report is 4 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #1889      +/-   ##
============================================
- Coverage     71.00%   71.00%   -0.01%     
============================================
  Files           123      123              
  Lines         65671    65675       +4     
============================================
+ Hits          46631    46632       +1     
- Misses        19040    19043       +3     
Files with missing lines Coverage Δ
src/networking.c 88.78% <100.00%> (+0.12%) ⬆️

... and 15 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Collaborator

@hpatro hpatro left a comment

Choose a reason for hiding this comment

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

Could you add a test case and assert *redacted* on it ?.

@YueTang-Vanessa YueTang-Vanessa force-pushed the unstable branch 2 times, most recently from 74ff2b0 to addd428 Compare March 28, 2025 00:36
@QuChen88
Copy link
Contributor

Looks good to me

@QuChen88
Copy link
Contributor

QuChen88 commented Mar 28, 2025

@zuiderkwast Basically any sort of protocol parsing error from the primary to the replica can lead to this condition to get triggered and the query buffer containing potential user data/commands would get logged. This can happen for various reasons including data corruption over the wire etc. i.e. we saw this in a couple of our redis clusters in the past.

3524:S 26 Mar 2025 17:49:50.755 # WARNING: Receiving inline protocol from master, master stream corruption? Closing the master connection and discarding the cached master.
3524:S 26 Mar 2025 17:49:50.755 # Protocol error (Master using the inline protocol. Desync?) from client: ... Query buffer during protocol error: '293..$4..hdel..$31.. <key-name>...

The chances of this happening is pretty low, but still non zero.

@YueTang-Vanessa YueTang-Vanessa force-pushed the unstable branch 3 times, most recently from ffde5c4 to 6d8099b Compare March 29, 2025 03:41
Signed-off-by: VanessaTang <yuetan@amazon.com>
1. print the query buffer info in case hide-user-data-from-log is disabled
2. fix tests to wait for the information in the log

Signed-off-by: Ran Shidlansik <ranshid@amazon.com>
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.

6 participants