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

Move auth check to the front #1475

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

Conversation

enjoy-binbin
Copy link
Member

@enjoy-binbin enjoy-binbin commented Dec 23, 2024

When requirepass is enabled, we want command calls to return NOAUTH
instead of ERR with the error message.

Previously, these checks were all before the auth check:

  • command existence exist
  • command arity check
  • command protected check

This may expose information such as whether the server supports the
command, whether the configuration item is enabled, etc. This is more
of a consistency issue as the same error message is returned when
requirepass is enabled, not a security issue.

This is a behavior change, though perhaps not a breaking one.

When requirepass is enabled, we want command calls to return NOAUTH
instead of ERR with the error message. Otherwise this reveals that
we have disabled the configuration in the server side.

Signed-off-by: Binbin <[email protected]>
Copy link

codecov bot commented Dec 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.94%. Comparing base (d00c856) to head (bbdba23).
Report is 51 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #1475      +/-   ##
============================================
+ Coverage     70.86%   70.94%   +0.08%     
============================================
  Files           119      120       +1     
  Lines         64852    65004     +152     
============================================
+ Hits          45958    46120     +162     
+ Misses        18894    18884      -10     
Files with missing lines Coverage Δ
src/networking.c 88.44% <100.00%> (+0.08%) ⬆️
src/server.c 87.58% <100.00%> (+0.11%) ⬆️

... and 56 files with indirect coverage changes

src/server.c Outdated Show resolved Hide resolved
@enjoy-binbin enjoy-binbin changed the title Move the CMD_PROTECTED check to after the auth check Move auth check to the front Dec 24, 2024
@PingXie PingXie added the release-notes This issue should get a line item in the release notes label Jan 6, 2025
@madolson
Copy link
Member

madolson commented Jan 9, 2025

BTW, this is a behavior change, though perhaps not a breaking one.

I don't think it's a breaking change since it is moving from error -> error case. I would just list it as a release.

I'm also OK with the change atm, but it looks like there are still some tests that need to get fixed.

@zuiderkwast zuiderkwast added the run-extra-tests Run extra tests on this PR (Runs all tests from daily except valgrind and RESP) label Jan 9, 2025
@madolson
Copy link
Member

Maybe we should leave this until 9.0 though, just so that we have the safer boundary of the major version to claim we are making a behavior change. I agree that it makes sense to raise the security bar, but I don't think it's all that important if it's in 8.1 or 9.0.

@enjoy-binbin
Copy link
Member Author

ok, let move it to 9.0

@madolson madolson added the breaking-change Indicates a possible backwards incompatible change label Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Indicates a possible backwards incompatible change release-notes This issue should get a line item in the release notes run-extra-tests Run extra tests on this PR (Runs all tests from daily except valgrind and RESP)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants