-
Notifications
You must be signed in to change notification settings - Fork 730
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
Sanitize host name for AWS requests before signing in AWSAuthV4 trans… #2090
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -205,4 +205,35 @@ public function testSignsWithEnvironmentalCredentials(): void | |
); | ||
} | ||
} | ||
|
||
/** | ||
* @group unit | ||
* @depends testSignsWithProvidedCredentials | ||
*/ | ||
public function testStripsTrailingDotInHost(): void | ||
{ | ||
$host = $this->_getHost(); | ||
$hostWithTrailingDot = $host.'.'; | ||
|
||
$config = [ | ||
'persistent' => false, | ||
'transport' => 'AwsAuthV4', | ||
'aws_access_key_id' => 'foo', | ||
'aws_secret_access_key' => 'bar', | ||
'aws_session_token' => 'baz', | ||
'aws_region' => 'us-east-1', | ||
'host' => $hostWithTrailingDot, | ||
]; | ||
$client = $this->_getClient($config); | ||
|
||
try { | ||
$client->request('_stats'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this executing all the new code? Maybe that is the issue? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We're able to have a look later on today or tomorrow. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} catch (GuzzleException $e) { | ||
$guzzleException = $e->getGuzzleException(); | ||
thePanz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
$this->assertInstanceOf(ConnectException::class, $guzzleException); | ||
$request = $guzzleException->getRequest(); | ||
$this->assertSame($host, $request->getHeader('host')[0]); | ||
$this->assertSame($hostWithTrailingDot, $request->getUri()->getHost()); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is the right indentation level
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I'll check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, basically I copied lines 28-31 and did not change indentation at all 🤔
It's the same like in the whole file, four spaces everywhere..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thePanz anything I can do here?