Skip to content

Limit the extra options of jemalloc profiler#3101

Merged
chenBright merged 2 commits into
apache:masterfrom
chenBright:fix_jemalloc_profiler
Sep 26, 2025
Merged

Limit the extra options of jemalloc profiler#3101
chenBright merged 2 commits into
apache:masterfrom
chenBright:fix_jemalloc_profiler

Conversation

@chenBright

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number:

Problem Summary:

Limit the extra options of jemalloc profiler to one of inuse_space, inuse_objects, alloc_space, alloc_objects, show_bytes, drop_negative, total_delay, contentions or mean_delay.

What is changed and the side effects?

Changed:

Side effects:

  • Performance effects:

  • Breaking backward compatibility:


Check List:

@wwbmmm

wwbmmm commented Sep 23, 2025

Copy link
Copy Markdown
Contributor

LGTM

@wwbmmm wwbmmm requested a review from Copilot September 23, 2025 02:53

Copilot AI 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.

Pull Request Overview

This PR adds validation for the extra_options query parameter in the jemalloc profiler to prevent arbitrary command injection. It ensures only valid jemalloc profiler options are accepted and refactors string concatenation to use safer string formatting functions.

  • Introduces a whitelist of valid extra options for jemalloc profiler
  • Adds validation to only accept predefined extra options
  • Refactors string concatenation to use butil::string_printf and butil::string_appendf

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/brpc/details/jemalloc_profiler.cpp Outdated
Comment thread src/brpc/details/jemalloc_profiler.cpp Outdated
@chenBright chenBright merged commit 54c6570 into apache:master Sep 26, 2025
16 checks passed
@chenBright chenBright deleted the fix_jemalloc_profiler branch September 26, 2025 11:46
chenBright added a commit to chenBright/brpc that referenced this pull request Sep 28, 2025
* Limit the extra options of jemalloc profiler

* Add warning log
chenBright added a commit to chenBright/brpc that referenced this pull request Sep 28, 2025
* Limit the extra options of jemalloc profiler

* Add warning log
chenBright added a commit to chenBright/brpc that referenced this pull request Sep 28, 2025
* Limit the extra options of jemalloc profiler

* Add warning log
chenBright added a commit to chenBright/brpc that referenced this pull request Sep 28, 2025
* Limit the extra options of jemalloc profiler

* Add warning log
chenBright added a commit to chenBright/brpc that referenced this pull request Sep 28, 2025
* Limit the extra options of jemalloc profiler

* Add warning log
chenBright added a commit to chenBright/brpc that referenced this pull request Sep 28, 2025
* Limit the extra options of jemalloc profiler

* Add warning log
chenBright added a commit to chenBright/brpc that referenced this pull request Sep 28, 2025
* Limit the extra options of jemalloc profiler

* Add warning log
chenBright added a commit to chenBright/brpc that referenced this pull request Sep 28, 2025
* Limit the extra options of jemalloc profiler

* Add warning log
chenBright added a commit to chenBright/brpc that referenced this pull request Sep 28, 2025
* Limit the extra options of jemalloc profiler

* Add warning log
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