forked from I2P_Developers/i2p.i2p
* HTTP Proxy: Limit proxy.i2p to /themes/ directory
This commit is contained in:
@@ -811,11 +811,14 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
|
|||||||
* but inproxy/gateway ops would be wise to block proxy.i2p to prevent
|
* but inproxy/gateway ops would be wise to block proxy.i2p to prevent
|
||||||
* exposing the docs/ directory or perhaps other issues through
|
* exposing the docs/ directory or perhaps other issues through
|
||||||
* uncaught vulnerabilities.
|
* uncaught vulnerabilities.
|
||||||
|
* Restrict to the /themes/ directory for now.
|
||||||
*
|
*
|
||||||
* @param targetRequest "proxy.i2p/foo.png HTTP/1.1"
|
* @param targetRequest "proxy.i2p/themes/foo.png HTTP/1.1"
|
||||||
*/
|
*/
|
||||||
private static void serveLocalFile(OutputStream out, String method, String targetRequest) {
|
private static void serveLocalFile(OutputStream out, String method, String targetRequest) {
|
||||||
if (method.equals("GET") || method.equals("HEAD")) {
|
if ((method.equals("GET") || method.equals("HEAD")) &&
|
||||||
|
targetRequest.startsWith("proxy.i2p/themes/") &&
|
||||||
|
!targetRequest.contains("..")) {
|
||||||
int space = targetRequest.indexOf(' ');
|
int space = targetRequest.indexOf(' ');
|
||||||
String filename = null;
|
String filename = null;
|
||||||
try {
|
try {
|
||||||
|
Reference in New Issue
Block a user