-
-
Notifications
You must be signed in to change notification settings - Fork 436
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
Allow to rename api.php #2132
Allow to rename api.php #2132
Conversation
What's kevin's attack? Can you provide a related link? |
Yes, at my office, we have a problem with some "developers" that we call Kévin, that copy/paste stackoverflow, and who don't understand that they are doing. This change will prevent brute force attacks on API if you rename your file, because only you and your providers know API url. |
Not only in your office, unfortunately. I literally googled that before asking thinking it was some known vulnerability 🤣. |
should we document somewhere how to use a different url for /api? |
Yes, in my to do list. |
This appears in .htaccess ############################################
## rewrite API2 calls to api.php (by now it is REST only)
RewriteRule ^api/rest api.php?type=rest [QSA,L] If you rename the api.php file what do we do with the .htaccess setting? |
Yes you do (at htaccess level, or web server config 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.
There's a typo: "Don't forgot to also update server configuration" should be " Don't forget to also update server configuration"
I propose the following message:
|
Thank you for taking my suggestion into account, but you had to make the change in the other paragraph as well to keep the same addressing mode. I allowed myself to do it. I personally have no other comments. We can merge this PR. |
@elidrissidev - I only commented on the existing paragraphs. If new changes are needed please make a proposal and we implement it immediately. This PR allows us editing. |
Sorry deleted my last comment by accident. This is what it said:
|
Actually I retract what I said 😅, it is indeed possible to use ## uncomment next line to enable light API calls processing
-# RewriteRule ^api/([a-z][0-9a-z_]+)/?$ api.php?type=$1 [QSA,L]
+ RewriteRule ^api/([a-z][0-9a-z_]+)/?$ api.php?type=$1 [QSA,L]
############################################
## rewrite API2 calls to api.php (by now it is REST only)
- RewriteRule ^api/rest api.php?type=rest [QSA,L]
+# RewriteRule ^api/rest api.php?type=rest [QSA,L] So this PR looks good to me. |
Another discovery I made is that updating the filename alone is not enough because you'll get "Request does not match type route." 404 error with the REST Api. To fix this you'll also need to update the URL in ############################################
## rewrite API2 calls to api.php (by now it is REST only)
- RewriteRule ^api/rest api.php?type=rest [QSA,L]
+ RewriteRule ^ipa/rest ipa.php?type=rest [QSA,L] |
In the OpenMage documentation the author mentioned the following:
He practically requested a mandatory change for the two webservers. |
Description
This PR allow you to rename your api.php to something else to avoid kevin's attack on it.
Like you didn't use /admin for backend.
Contribution checklist