Skip to content

Conversation

@chenBright
Copy link
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
Copy link
Contributor

wwbmmm commented Sep 23, 2025

LGTM

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

Copilot AI left a comment

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.

@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.

2 participants