Skip to content

Commit

Permalink
Drop the trust_x_forwarded_proto configuration option (#599)
Browse files Browse the repository at this point in the history
  • Loading branch information
ste93cry authored May 10, 2018
1 parent 8f04ade commit 3ccf56c
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 28 deletions.
2 changes: 0 additions & 2 deletions lib/Raven/ClientBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
*
* @method int getSendAttempts()
* @method setSendAttempts(int $attemptsCount)
* @method bool isTrustXForwardedProto()
* @method setIsTrustXForwardedProto(bool $value)
* @method string[] getPrefixes()
* @method setPrefixes(array $prefixes)
* @method bool getSerializeAllObjects()
Expand Down
24 changes: 0 additions & 24 deletions lib/Raven/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,28 +87,6 @@ public function setSendAttempts($attemptsCount)
$this->options = $this->resolver->resolve($options);
}

/**
* Checks whether the X-FORWARDED-PROTO header should be trusted.
*
* @return bool
*/
public function isTrustXForwardedProto()
{
return $this->options['trust_x_forwarded_proto'];
}

/**
* Sets whether the X-FORWARDED-PROTO header should be trusted.
*
* @param bool $value The value of the option
*/
public function setIsTrustXForwardedProto($value)
{
$options = array_merge($this->options, ['trust_x_forwarded_proto' => $value]);

$this->options = $this->resolver->resolve($options);
}

/**
* Gets the prefixes which should be stripped from filenames to create
* relative paths.
Expand Down Expand Up @@ -642,7 +620,6 @@ private function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'send_attempts' => 6,
'trust_x_forwarded_proto' => false,
'prefixes' => explode(PATH_SEPARATOR, get_include_path()),
'serialize_all_object' => false,
'sample_rate' => 1,
Expand All @@ -667,7 +644,6 @@ private function configureOptions(OptionsResolver $resolver)
]);

$resolver->setAllowedTypes('send_attempts', 'int');
$resolver->setAllowedTypes('trust_x_forwarded_proto', 'bool');
$resolver->setAllowedTypes('prefixes', 'array');
$resolver->setAllowedTypes('serialize_all_object', 'bool');
$resolver->setAllowedTypes('sample_rate', ['int', 'float']);
Expand Down
1 change: 0 additions & 1 deletion tests/ClientBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ public function testCallExistingMethodForwardsCallToConfiguration($setterMethod,
public function optionsDataProvider()
{
return [
['setIsTrustXForwardedProto', true],
['setPrefixes', ['foo', 'bar']],
['setSerializeAllObjects', false],
['setSampleRate', 0.5],
Expand Down
1 change: 0 additions & 1 deletion tests/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public function optionsDataProvider()
{
return [
['send_attempts', 1, 'getSendAttempts', 'setSendAttempts'],
['trust_x_forwarded_proto', false, 'isTrustXForwardedProto', 'setIsTrustXForwardedProto'],
['prefixes', ['foo', 'bar'], 'getPrefixes', 'setPrefixes'],
['serialize_all_object', false, 'getSerializeAllObjects', 'setSerializeAllObjects'],
['sample_rate', 0.5, 'getSampleRate', 'setSampleRate'],
Expand Down

2 comments on commit 3ccf56c

@hackel
Copy link

@hackel hackel commented on 3ccf56c Jul 31, 2019

Choose a reason for hiding this comment

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

Okay, so is X-Forwarded-Proto trusted by default now or what? Do I no longer need to worry about Sentry not working behind a reverse proxy?

@ste93cry
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No it's not, but as written in the issue referenced by this PR you can find the X-Forwarded-Proto header in the request context of the event, which of course is displayed in the Sentry GUI

Please sign in to comment.