Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@filipecosta90
Copy link
Collaborator

@filipecosta90 filipecosta90 commented Jul 27, 2025

This PR adds support for the -u/--uri flag to memtier_benchmark, enabling URI-based connection strings similar to redis-benchmark and redis-cli.

Changes

  • URI parsing: Support for redis://[username[:password]@]host[:port][/db-number] and rediss:// (TLS) formats
  • Command line integration: Added -u/--uri option with proper help text and man page documentation
  • Configuration: URI components automatically populate existing config fields (server, port, authenticate, select_db, tls)
  • Conflict detection: Warnings when both URI and individual connection flags are specified, with URI taking precedence
  • Error handling: Proper validation and error messages for malformed or invalid URIs

Testing

Added python tests covering both positive cases (valid URI connections) and negative cases (invalid URIs that properly exit with error codes).

Usage

# Basic connection
memtier_benchmark -u redis://localhost:6379

# With authentication and database selection  
memtier_benchmark -u redis://user:pass@localhost:6380/2

# TLS connection
memtier_benchmark -u rediss://localhost:6380

Testing

## positive tests

TEST=tests_oss_simple_flow:test_uri_connection ./tests/run_tests.sh

## negative tests
TEST=tests_oss_simple_flow:test_uri_connection_negative ./tests/run_tests.sh

@kaplanben
Copy link

kaplanben commented Jul 27, 2025

Logo
Checkmarx One – Scan Summary & Details6f92353f-d335-45c5-8c8d-651f57c59e50

New Issues (4)

Checkmarx found the following issues in this Pull Request

Severity Issue Source File / Package Checkmarx Insight
MEDIUM Divide_By_Zero /deps/hdr_histogram/hdr_histogram.c: 1172
detailsThe application performs an illegal operation in hdr_percentiles_print, in /deps/hdr_histogram/hdr_histogram.c. In line 1172, the program att...
ID: vlKdJj9oJoWRzGqi0xHU8O7Zd98%3D
Attack Vector
MEDIUM Divide_By_Zero /obj_gen.cpp: 444
detailsThe application performs an illegal operation in zipf_distribution, in /obj_gen.cpp. In line 444, the program attempts to divide by k, which mi...
ID: y8zZkV%2Bs98Q2kms9CrPQVHobiDc%3D
Attack Vector
MEDIUM Plaintext_Storage_Of_A_Password /memtier_benchmark.cpp: 348
detailsThe password 348 did not used a secure scheme to store the password - this may allow attackers to retrieve it, and use it to access authenticated ...
ID: 60FxweoetY73B3XK42p9Ee0RU7Q%3D
Attack Vector
LOW Heap_Inspection /memtier_benchmark.cpp: 338
detailsMethod parse_uri at line 338 of /memtier_benchmark.cpp defines password, which is designated to contain user passwords. However, while plaintex...
ID: NdQPhV3M0QPoRgkYtBiNOqe%2FuuQ%3D
Attack Vector
Fixed Issues (5)

Great job! The following issues were fixed in this Pull Request

Severity Issue Source File / Package
MEDIUM Divide_By_Zero /obj_gen.cpp: 118
MEDIUM Divide_By_Zero /deps/hdr_histogram/hdr_histogram.c: 1169
MEDIUM Divide_By_Zero /deps/hdr_histogram/hdr_histogram.c: 1184
MEDIUM Divide_By_Zero /deps/hdr_histogram/hdr_histogram.c: 1185
MEDIUM Divide_By_Zero /deps/hdr_histogram/hdr_histogram.c: 1186

@filipecosta90 filipecosta90 merged commit 68fb953 into redis:master Aug 7, 2025
7 checks passed
@filipecosta90 filipecosta90 deleted the connection.string branch August 7, 2025 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants