Skip to content

Commit eafb04c

Browse files
authored
Merge pull request #33 from wet-boew/fix-redirect-v4
Fix redirect v4
2 parents 323a850 + 148e3e2 commit eafb04c

22 files changed

Lines changed: 39 additions & 109 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
[Download and/or Installation instructions](https://github.com/wet-boew/cdts-JavaTemplates/wiki/Installation)
44

5+
## v4.0.0
6+
7+
- **SECURITY FIX** Removal of default redirect handlers for "leaving secure site" feature. Leaving secure site feature now relies solely on WET functionality. Unless these redirect handlers were explicitely referenced by client application there should be no impact. (Spring version: removal of endpoint "/gocwebtemplate_leavesecuresiteredirect"; JSP version: removal of action "leavesecuresiteredirect.action")
8+
- Bug fixes
9+
510
## v3.0.0
611

712
- **IMPORTANT** ALL LAYOUT DEFINITIONS UPDATED - All inline scripts and occurences of `document.write` were removed.

builds/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
#
44
# DO NOT EDIT build.properties DIRECTLY!
55
#
6-
gocwebtemplate.build.version=3.0.0-SNAPSHOT
6+
gocwebtemplate.build.version=4.0.0-SNAPSHOT

gocwebtemplate-core/gocwebtemplate-core-base/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<parent>
1111
<groupId>ca.gc.gocwebtemplate</groupId>
1212
<artifactId>gocwebtemplate-core</artifactId>
13-
<version>3.0.0-SNAPSHOT</version>
13+
<version>4.0.0-SNAPSHOT</version>
1414
<relativePath>..</relativePath>
1515
</parent>
1616

gocwebtemplate-core/gocwebtemplate-core-base/src/main/java/goc/webtemplate/Constants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public abstract class Constants {
1313

1414
public static final String CACHE_KEY_STATICFILES_PREFIX = "GoC.Template.CacheKey";
1515

16-
public static final String WEB_TEMPLATE_DISTRIBUTION_VERSION = "3.0.0";
16+
public static final String WEB_TEMPLATE_DISTRIBUTION_VERSION = "4.0.0";
1717

1818
public static final String CDTS_DEFAULT_VERSION = "v4_1_0";
1919

gocwebtemplate-core/gocwebtemplate-core-base/src/main/java/goc/webtemplate/component/BaseUtil.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88
import goc.webtemplate.Constants;
99

1010
public final class BaseUtil {
11-
public static void doLeaveSecureSite(HttpServletRequest req, HttpServletResponse res) throws Exception {
12-
String redirectUrl = URLDecoder.decode(req.getParameter("targetUrl"), "UTF-8");
13-
res.sendRedirect(redirectUrl);
14-
}
15-
1611
public static void doLocaleSwitch(HttpServletRequest req, HttpServletResponse res) throws Exception {
1712
String currLang = req.getSession().getAttribute(Constants.CURRENT_LANG_SESSION_KEY) == null ?
1813
req.getLocale().getLanguage() :
@@ -24,6 +19,10 @@ public static void doLocaleSwitch(HttpServletRequest req, HttpServletResponse re
2419
}
2520

2621
String prevUrl = URLDecoder.decode(req.getParameter(Constants.QUERYSTRING_KEY), "UTF-8");
22+
23+
// Validate that the redirect link is relative to the host and NOT absolute or relative to scheme
24+
if ((!prevUrl.startsWith("/")) || prevUrl.startsWith("//")) throw new Exception("Unauthorized return URL specified for language switching.");
25+
2726
res.sendRedirect(prevUrl);
2827
}
2928

gocwebtemplate-core/gocwebtemplate-core-base/src/main/java/goc/webtemplate/component/jsonentities/SetupBase.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import java.util.List;
66

77
import goc.webtemplate.LeavingSecureSiteWarning;
8-
import goc.webtemplate.Utility;
98
import goc.webtemplate.WebAnalyticsInfo;
109

1110
/**
@@ -39,7 +38,7 @@ public SetupBase(String subTheme, String jqueryEnv, LeavingSecureSiteWarning lss
3938
this.subTheme = subTheme;
4039
this.jqueryEnv = jqueryEnv;
4140
this.exitSecureSite = null;
42-
if ((lssw != null) && lssw.isEnabled() && !Utility.isNullOrEmpty(lssw.getRedirectUrl())) {
41+
if ((lssw != null) && lssw.isEnabled()) {
4342
this.exitSecureSite = new ExitSecureSite(lssw);
4443
}
4544
this.webAnalytics = webAnalytics;

gocwebtemplate-core/gocwebtemplate-core-jsp/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<parent>
1111
<groupId>ca.gc.gocwebtemplate</groupId>
1212
<artifactId>gocwebtemplate-core</artifactId>
13-
<version>3.0.0-SNAPSHOT</version>
13+
<version>4.0.0-SNAPSHOT</version>
1414
<relativePath>..</relativePath>
1515
</parent>
1616

gocwebtemplate-core/gocwebtemplate-core-jsp/src/main/java/goc/webtemplate/component/jsp/BaseCoreBean.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ protected String getDefaultLanguageLinkUrl() {
3535

3636
@Override
3737
protected String getDefaultLeaveSecureSiteRedirectUrl() {
38-
return "leavesecuresiteredirect.action";
38+
return null;
3939
}
4040

4141
@Override

gocwebtemplate-core/gocwebtemplate-core-jsp/src/main/java/goc/webtemplate/component/jsp/LeaveSecureSiteAction.java

Lines changed: 0 additions & 11 deletions
This file was deleted.

gocwebtemplate-core/gocwebtemplate-core-spring/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<parent>
1111
<groupId>ca.gc.gocwebtemplate</groupId>
1212
<artifactId>gocwebtemplate-core</artifactId>
13-
<version>3.0.0-SNAPSHOT</version>
13+
<version>4.0.0-SNAPSHOT</version>
1414
<relativePath>..</relativePath>
1515
</parent>
1616

0 commit comments

Comments
 (0)