diff --git a/apps/i2ptunnel/java/build.xml b/apps/i2ptunnel/java/build.xml index c9a3a74c106a198fdac8e358f00eda2ed5434a4c..95f99b014dece9d7192690ebf4ce217da4f63ab2 100644 --- a/apps/i2ptunnel/java/build.xml +++ b/apps/i2ptunnel/java/build.xml @@ -238,7 +238,7 @@ <copy file="build/obj/net/i2p/i2ptunnel/web/EditBean.class" todir="../jsp/WEB-INF/classes/net/i2p/i2ptunnel/web" /> <copy file="build/obj/net/i2p/i2ptunnel/web/IndexBean.class" todir="../jsp/WEB-INF/classes/net/i2p/i2ptunnel/web" /> <war destfile="build/i2ptunnel.war" webxml="../jsp/web-out.xml" - basedir="../jsp/" excludes="web.xml, web-fragment.xml, web-out.xml, **/*.java, *.jsp"> + basedir="../jsp/" excludes="web.xml, web-fragment.xml, web-out.xml, **/*.java, *.jsp, *.jsi"> <manifest> <attribute name="Implementation-Version" value="${full.version}" /> <attribute name="Built-By" value="${build.built-by}" /> @@ -253,7 +253,7 @@ <target name="warUpToDate"> <uptodate property="war.uptodate" targetfile="build/i2ptunnel.war" > - <srcfiles dir= "../jsp" excludes="web.xml, web-fragment.xml, **/*.java, *.jsp" /> + <srcfiles dir= "../jsp" excludes="web.xml, web-fragment.xml, **/*.java, *.jsp, *.jsi" /> <srcfiles dir= "build/obj" includes="**/ui/*.class **/web/*.class" /> </uptodate> <condition property="shouldListChanges2" > @@ -337,7 +337,7 @@ </target> <uptodate property="precompilejsp.uptodate" targetfile="../jsp/web-out.xml"> - <srcfiles dir= "../jsp" includes="*.jsp, *.html, web.xml"/> + <srcfiles dir= "../jsp" includes="*.jsp, *.jsi, *.html, web.xml"/> <srcfiles dir= "src/net/i2p/i2ptunnel/web" includes="*.java"/> </uptodate> diff --git a/apps/i2ptunnel/jsp/edit.jsp b/apps/i2ptunnel/jsp/edit.jsp index c1030a5c7c93fada3177f9fc657ff85ad92454c6..c6c0b1af582ea367df55dd573abdae818c92a1a9 100644 --- a/apps/i2ptunnel/jsp/edit.jsp +++ b/apps/i2ptunnel/jsp/edit.jsp @@ -12,25 +12,56 @@ %><%@page trimDirectiveWhitespaces="true" %><%@page contentType="text/html" import="net.i2p.i2ptunnel.web.EditBean" %><% +boolean __isClient = false; +boolean __invalid = false; +int curTunnel = -1; String tun = request.getParameter("tunnel"); if (tun != null) { try { - int curTunnel = Integer.parseInt(tun); - if (EditBean.staticIsClient(curTunnel)) { - %><jsp:include page="editClient.jsp" /><% - } else { - %><jsp:include page="editServer.jsp" /><% - } + curTunnel = Integer.parseInt(tun); + __isClient = EditBean.staticIsClient(curTunnel); } catch (NumberFormatException nfe) { - %>Invalid tunnel parameter<% + __invalid = true; } } else { String type = request.getParameter("type"); - int curTunnel = -1; - if (EditBean.isClient(type)) { - %><jsp:include page="editClient.jsp" /><% - } else { - %><jsp:include page="editServer.jsp" /><% - } + __isClient = EditBean.isClient(type); +} +%><?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<jsp:useBean class="net.i2p.i2ptunnel.web.EditBean" id="editBean" scope="request" /> +<jsp:useBean class="net.i2p.i2ptunnel.web.Messages" id="intl" scope="request" /> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title><%=intl._t("Hidden Services Manager")%> - <%=intl._t("Edit Client Tunnel")%></title> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <link href="/themes/console/images/favicon.ico" type="image/x-icon" rel="shortcut icon" /> + + <% if (editBean.allowCSS()) { + %><link rel="icon" href="<%=editBean.getTheme()%>images/favicon.ico" /> + <link href="<%=editBean.getTheme()%>i2ptunnel.css?<%=net.i2p.CoreVersion.VERSION%>" rel="stylesheet" type="text/css" /> + <% } + %> +<style type='text/css'> +input.default { width: 1px; height: 1px; visibility: hidden; } +</style> +<script src="/js/resetScroll.js" type="text/javascript"></script> +</head> +<body id="tunnelEditPage"> +<% +if (__invalid) { + %>Invalid tunnel parameter<% +} else { + if (editBean.isInitialized()) { + if (__isClient) { + %><%@include file="editClient.jsi" %><% + } else { + %><%@include file="editServer.jsi" %><% + } + } else { + %><div id="notReady"><%=intl._t("Tunnels not initialized yet; please retry in a few moments.")%></div><% + } // isInitialized() } %> +</body> +</html> diff --git a/apps/i2ptunnel/jsp/editClient.jsp b/apps/i2ptunnel/jsp/editClient.jsi similarity index 94% rename from apps/i2ptunnel/jsp/editClient.jsp rename to apps/i2ptunnel/jsp/editClient.jsi index a0f0d40d112be65f7133c16c7f16403780cc68d2..d4a1472e6bc85dd209f8084b0119ea64fd51e5a5 100644 --- a/apps/i2ptunnel/jsp/editClient.jsp +++ b/apps/i2ptunnel/jsp/editClient.jsi @@ -1,48 +1,3 @@ -<%@page contentType="text/html" import="net.i2p.i2ptunnel.web.EditBean" -%><%@page trimDirectiveWhitespaces="true" -%><?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<jsp:useBean class="net.i2p.i2ptunnel.web.EditBean" id="editBean" scope="request" /> -<jsp:useBean class="net.i2p.i2ptunnel.web.Messages" id="intl" scope="request" /> -<% String tun = request.getParameter("tunnel"); - int curTunnel = -1; - if (tun != null) { - try { - curTunnel = Integer.parseInt(tun); - } catch (NumberFormatException nfe) { - curTunnel = -1; - } - } -%> - -<% - response.setHeader("Content-Security-Policy", "default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline'"); -%> - -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head> - <title><%=intl._t("Hidden Services Manager")%> - <%=intl._t("Edit Client Tunnel")%></title> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> - <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" /> - <link href="/themes/console/images/favicon.ico" type="image/x-icon" rel="shortcut icon" /> - - <% if (editBean.allowCSS()) { - %><link rel="icon" href="<%=editBean.getTheme()%>images/favicon.ico" /> - <link href="<%=editBean.getTheme()%>i2ptunnel.css?<%=net.i2p.CoreVersion.VERSION%>" rel="stylesheet" type="text/css" /> - <% } - %> -<style type='text/css'> -input.default { width: 1px; height: 1px; visibility: hidden; } -</style> -<script src="/js/resetScroll.js" type="text/javascript"></script> -</head> -<body id="tunnelEditPage"> - -<% - - if (editBean.isInitialized()) { - -%> <form method="post" action="list"> <div class="panel"> @@ -731,13 +686,3 @@ input.default { width: 1px; height: 1px; visibility: hidden; } </table> </div> </form> - -<% - - } else { - %><div id="notReady"><%=intl._t("Tunnels not initialized yet; please retry in a few moments.")%></div><% - } // isInitialized() - -%> - </body> -</html> diff --git a/apps/i2ptunnel/jsp/editServer.jsp b/apps/i2ptunnel/jsp/editServer.jsi similarity index 96% rename from apps/i2ptunnel/jsp/editServer.jsp rename to apps/i2ptunnel/jsp/editServer.jsi index 7a39d7555ce70775e0d5eb74498e2b6698462c6a..f1c45cef9dee2ee621bf812d152318ecf30a4d50 100644 --- a/apps/i2ptunnel/jsp/editServer.jsp +++ b/apps/i2ptunnel/jsp/editServer.jsi @@ -1,48 +1,3 @@ -<%@page contentType="text/html" import="net.i2p.i2ptunnel.web.EditBean" -%><%@page trimDirectiveWhitespaces="true" -%><?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<jsp:useBean class="net.i2p.i2ptunnel.web.EditBean" id="editBean" scope="request" /> -<jsp:useBean class="net.i2p.i2ptunnel.web.Messages" id="intl" scope="request" /> -<% String tun = request.getParameter("tunnel"); - int curTunnel = -1; - if (tun != null) { - try { - curTunnel = Integer.parseInt(tun); - } catch (NumberFormatException nfe) { - curTunnel = -1; - } - } -%> - -<% - response.setHeader("Content-Security-Policy", "default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline'"); -%> - -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head> - <title><%=intl._t("Hidden Services Manager")%> - <%=intl._t("Edit Hidden Service")%></title> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> - <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" /> - <link href="/themes/console/images/favicon.ico" type="image/x-icon" rel="shortcut icon" /> - - <% if (editBean.allowCSS()) { - %><link rel="icon" href="<%=editBean.getTheme()%>images/favicon.ico" /> - <link href="<%=editBean.getTheme()%>i2ptunnel.css?<%=net.i2p.CoreVersion.VERSION%>" rel="stylesheet" type="text/css" /> - <% } - %> -<style type='text/css'> -input.default { width: 1px; height: 1px; visibility: hidden; } -</style> -<script src="/js/resetScroll.js" type="text/javascript"></script> -</head> -<body id="tunnelEditPage"> - -<% - - if (editBean.isInitialized()) { - -%> <form method="post" action="list"> <div class="panel"> @@ -977,13 +932,3 @@ input.default { width: 1px; height: 1px; visibility: hidden; } </table> </div> </form> - -<% - - } else { - %><div id="notReady"><%=intl._t("Tunnels not initialized yet; please retry in a few moments.")%></div><% - } // isInitialized() - -%> -</body> -</html> diff --git a/apps/i2ptunnel/jsp/index.jsp b/apps/i2ptunnel/jsp/index.jsp index eddee67026936c62210ee518e0d6dbeea4c79fce..b0b1f5f6ee870d1fb48467227dbbf01af764646f 100644 --- a/apps/i2ptunnel/jsp/index.jsp +++ b/apps/i2ptunnel/jsp/index.jsp @@ -24,7 +24,6 @@ <title><%=intl._t("Hidden Services Manager")%></title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> - <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" /> <link href="/themes/console/images/favicon.ico" type="image/x-icon" rel="shortcut icon" /> <% if (indexBean.allowCSS()) { diff --git a/apps/i2ptunnel/jsp/register.jsp b/apps/i2ptunnel/jsp/register.jsp index 7f0e3a1a208e63f87fe9737adeb3e2a57e2ddbce..4f928464ce6b5db020499b2435da10262d8f95d8 100644 --- a/apps/i2ptunnel/jsp/register.jsp +++ b/apps/i2ptunnel/jsp/register.jsp @@ -1,4 +1,15 @@ -<%@page contentType="text/html" import="java.io.InputStream,net.i2p.i2ptunnel.web.EditBean,net.i2p.servlet.RequestWrapper,net.i2p.client.I2PSessionException,net.i2p.client.naming.HostTxtEntry,net.i2p.data.PrivateKeyFile,net.i2p.data.SigningPrivateKey,net.i2p.util.OrderedProperties" +<% + // NOTE: Do the header carefully so there is no whitespace before the <?xml... line + + response.setHeader("X-Frame-Options", "SAMEORIGIN"); + // edit pages need script for the delete button 'are you sure' + response.setHeader("Content-Security-Policy", "default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline'"); + response.setHeader("X-XSS-Protection", "1; mode=block"); + response.setHeader("X-Content-Type-Options", "nosniff"); + response.setHeader("Referrer-Policy", "no-referrer"); + +%><%@page pageEncoding="UTF-8" +%><%@page contentType="text/html" import="java.io.InputStream,net.i2p.i2ptunnel.web.EditBean,net.i2p.servlet.RequestWrapper,net.i2p.client.I2PSessionException,net.i2p.client.naming.HostTxtEntry,net.i2p.data.PrivateKeyFile,net.i2p.data.SigningPrivateKey,net.i2p.util.OrderedProperties" %><%@page %><?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> @@ -24,7 +35,6 @@ <head> <title><%=intl._t("Hidden Services Manager")%> - <%=intl._t("Registration Helper")%></title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> - <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" /> <link href="/themes/console/images/favicon.ico" type="image/x-icon" rel="shortcut icon" /> <% if (editBean.allowCSS()) { diff --git a/apps/i2ptunnel/jsp/wizard.jsp b/apps/i2ptunnel/jsp/wizard.jsp index 74d8d91e8248e03ab433d71f601fcdf07f46561c..a641b069161e5336714abf05ead775e7fc60917d 100644 --- a/apps/i2ptunnel/jsp/wizard.jsp +++ b/apps/i2ptunnel/jsp/wizard.jsp @@ -58,7 +58,6 @@ <title><%=intl._t("I2P Tunnel Manager - Tunnel Creation Wizard")%></title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> - <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" /> <link href="/themes/console/images/favicon.ico" type="image/x-icon" rel="shortcut icon" /> <% if (editBean.allowCSS()) { diff --git a/history.txt b/history.txt index 1e229ee63676cc4e2d5324c847a76b5ea37bf100..e4b89638927059173c5e2fe1b2e187394afb0731 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,11 @@ +2018-01-17 zzz + * i2ptunnel: + - Set defaults for limits + - Change include style for edit jsps + +2018-01-16 zzz + * i2ptunnel: Fix NPE stopping TCG + 2018-01-14 zzz * Keyring (ticket #2108): - Separate local and remote dests on /configkeyring diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 43dca92409f4dc28e87e8883417efa05045ec22f..9319fc01c919050d6e37a985b498a0942594c8e1 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -18,7 +18,7 @@ public class RouterVersion { /** deprecated */ public final static String ID = "Monotone"; public final static String VERSION = CoreVersion.VERSION; - public final static long BUILD = 21; + public final static long BUILD = 22; /** for example "-test" */ public final static String EXTRA = "";