Generate Local Swagger Documentation Security Note Missing #1996
Description
This issue is a:
- Bug on the website
- New topic request
- Topic clarification request
- New DevDocs feature request
- Other
Description:
The current documentation fails to mention that on a production system the /swagger
path should be considered for mitigation (either via webserver configuration or M2 Admin URL Rewrite rule). Even though this path only lists the API endpoints available to anonymous users, it can also publish information about a Magento installation, such as it being Open Source vs Commerce ... or potentially show 3rd party extensions that publish API endpoints ... allowing a potential attacker to gain information about a target.
Steps to reproduce
Simply go to a known M2 installation and update the path in the url to /swagger
Expected result:
A suggestion in the documentation that on a production system, this path should be ignored ... or at least knowledge of the fact that without any action being taken, a list of anonymous API endpoints is available to anyone requesting the /swagger
path.
Possible solutions:
A simple note added to the page about a production consideration being to prevent access to this path, and adding a link to this note on a security page and production configuration page in the documentation. That way if someone is looking into suggested security configurations for M2 or if someone is looking at suggested production configurations for M2, that a link to this information is present.
Additional information:
Basically without this issue being highlighted, many M2 installations have been, and will continue to be, installed leaving a vulnerability for information gathering from a potential attacker. If a potential attacker was trying to fingerprint a site or try to identify what the underlying framework is, at the very least the /swagger
path will disclose if an installation is M2 Open Source or Commerce.
If this is something that is agreed to be taken into consideration, I am happy to go about creating a PR to publish a note about this and potential steps of mitigation.