Skip to content

Make sure we do not proxify our own proxy URL #44

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

Closed
wants to merge 8 commits into from

Conversation

webaddicto
Copy link
Contributor

@webaddicto webaddicto commented Jan 26, 2017

Inside function proxify_url($url, $base_url = '') we make sure that:

  1. The proxy cannot proxify "itself".
  2. Allow only http, https, ftp in scheme on $url.
  3. Not proxify localhost and internal IP addresses.

Good improvements for security reasons.

	// Make sure we do not proxy ourself
        if(stripos($url, app_url()) === 0){
		return $base_url;
        }
return $url; instead of return $base_url;
Extract PHP_URL_HOST from both URLs, remove "www.", and compare both including subdomain.
So this way we don't proxy our own proxy.
Tested and working perfectly.
Make sure the schema is only http and https (for security reasons).
Fixed if(!in_array(strtolower(parse_url($url, PHP_URL_SCHEME)), array('http', 'https'), true)){
@webaddicto
Copy link
Contributor Author

This can be closed, I made a simple SecurityPlugin and submitted the PR here:
Athlon1600/php-proxy-plugin-bundle#2

@webaddicto webaddicto closed this Feb 6, 2017
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.

1 participant