-
Notifications
You must be signed in to change notification settings - Fork 15
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
Connection must originate on localhost #20
Comments
OK, so it looks like we're talking about canary.php -- which is generated by TestCommand and installed on the test site as part of an end-to-end test: https://github.com/totten/amp/blob/30aaa0f94/src/Amp/Command/TestCommand.php#L103 The script does some incautious things -- e.g. it accepts a MySQL DSN from $_POST and connects to it -- and that could be abused (e.g to launch DoS) if some bug or accident caused the file to show up on a public httpd. So the script includes the localhost check to prevent abuse by third-parties. We could change the mechanism for passing DSN (e.g. pass it the same way we pass $dataDir or $autoloader)... Do you think the script would be secure enough that it would be OK if (through bug or accident) it got exposed on a public URL? If so, we could remove the REMOTE_ADDR check entirely. Aside: I'm kind of curious what use-case you have in which REMOTE_ADDR is not localhost... |
Hi totten. Sorry, I may have misidentified the issue. I'm done some more testing this morning and I'm getting an access denied even before it manages to get into the script, so I expect this is a boreader permissions issue on my server. The REMOTE_ADDR is only set if you're accessing from localhost, but not using the command line. Since I was debugging the file using the command line, the REMOTE_ADDR wasn't set, so it was hitting this error. That sent me off course a bit. Thanks for the comments though. I think the localhost check should probably stay in place for security, as you mention. |
Silly me, I was trying to include the file before the |
When I run 'amp test' I receive the error in the title.
It seems that this is because the script is checking the REMOTE_ADDR for 'localhost'. Expect because the request is coming from the command line the REMOTE_ADDR is not being set?
Unless there is something else that might be causing the 403 response at this point.
Any help debugging this would be great. Thanks.
The text was updated successfully, but these errors were encountered: