Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[HttpClient] Replaceescapeshellarg to prevent overpassingARG_MAX#52429

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

alexandre-daubois
Copy link
Member

@alexandre-dauboisalexandre-daubois commentedNov 2, 2023
edited
Loading

QA
Branch?6.3
Bug fix?yes
New feature?no
Deprecations?no
IssuesFix#49693
LicenseMIT

I'm not 100% sure if it is a bugfix or a feature.

I used Nicolas' suggestion in the issue to sanitize the input and used--data-raw to avoid any automatic formatting.

Removing the use ofescapeshellarg() also allows to removeHttpClientDataCollectorTest::testItDoesNotGeneratesCurlCommandsForNotEncodableBody(). Indeed, the body can now be encoded and will result on the following cURL command:

curl \\n      --compressed \\n      --request POST \\n      --url 'http://localhost:8057/json' \\n      --header 'Accept: */*' \\n      --header 'Content-Length: 1' \\n      --header 'Content-Type: application/x-www-form-urlencoded' \\n      --header 'Accept-Encoding: gzip' \\n      --header 'User-Agent: Symfony HttpClient (Native)' \\n      --data-raw '\x00'

sjerdo reacted with hooray emoji
@alexandre-dauboisalexandre-dauboisforce-pushed thehttpclientdatadecorator-argmax branch 3 times, most recently from88259df tod8be8f5CompareNovember 3, 2023 09:16
@alexandre-daubois
Copy link
MemberAuthor

alexandre-daubois commentedNov 3, 2023
edited
Loading

@nicolas-grekas I really like your idea of leveraging Process. I updated the code to use it first if it exists.

Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

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

LGTM after minor changes

{
return \strlen($payload) < ('\\' === \DIRECTORY_SEPARATOR ? 8100 : 256000);
if (class_exists(Process::class)) {

Choose a reason for hiding this comment

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

Suggested change
if (class_exists(Process::class)) {
static$useProcess;
if ($useProcess ??=class_exists(Process::class)) {

Copy link
MemberAuthor

@alexandre-dauboisalexandre-dauboisNov 3, 2023
edited
Loading

Choose a reason for hiding this comment

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

I addressed your comments, thanks 🙂

return null;
}
$dataArg[] = '--data '.escapeshellarg($payload);
$dataArg[] = '--data-raw '.$this->sanitizeArg(self::jsonEncode($json));

Choose a reason for hiding this comment

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

we don't sanitize, we escape

alexandre-daubois reacted with thumbs up emoji
return (new Process([$payload]))->getCommandLine();
}

if (\DIRECTORY_SEPARATOR === '\\') {

Choose a reason for hiding this comment

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

Suggested change
if (\DIRECTORY_SEPARATOR ==='\\') {
if ('\\' ===\DIRECTORY_SEPARATOR) {

alexandre-daubois reacted with thumbs up emoji
@alexandre-dauboisalexandre-dauboisforce-pushed thehttpclientdatadecorator-argmax branch fromd8be8f5 to3b0bb11CompareNovember 3, 2023 13:24
@fabpot
Copy link
Member

Thank you@alexandre-daubois.

@fabpotfabpot merged commite8ce12a intosymfony:6.3Nov 3, 2023
@alexandre-dauboisalexandre-daubois deleted the httpclientdatadecorator-argmax branchNovember 3, 2023 19:04
nicolas-grekas added a commit that referenced this pull requestNov 6, 2023
…nd when files are uploaded (MatTheCat)This PR was merged into the 6.3 branch.Discussion----------[HttpClient][WebProfilerBundle] Do not generate cURL command when files are uploaded| Q             | A| ------------- | ---| Branch?       | 6.3| Bug fix?      | yes| New feature?  | no| Deprecations? | no| Issues        |Fix#51366| License       | MITI also removed ``@requires` extension openssl` annotations since that does not seem to be the case since#45729.Failures in AppVeyor occur because double quotes are missing around `--data-raw` values. Possibly related to#52429.Commits-------4503f94 [HttpClient][WebProfilerBundle] Do not generate cURL command when files are uploaded
This was referencedNov 10, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@stofstofstof requested changes

@fabpotfabpotfabpot approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
6.3
Development

Successfully merging this pull request may close these issues.

5 participants
@alexandre-daubois@fabpot@nicolas-grekas@stof@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp