Skip to content

Commit 4008697

Browse files
authored
Merge pull request #34 from wet-boew/fix-redirect-v2
Fix redirect v2
2 parents 0b51e2f + 76bcba2 commit 4008697

22 files changed

Lines changed: 55 additions & 127 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+
## v2.7.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
## v2.6.0
611

712
- **IMPORTANT** The GCWeb site footer has been updated to reflect the changes introduced in WET footer version 4. These changes will be applied automatically. For more information, please visit the WET documentation: https://wet-boew.github.io/GCWeb/sites/footers/footers-en.html

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=2.6.0-SNAPSHOT
6+
gocwebtemplate.build.version=2.7.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>2.6.0-SNAPSHOT</version>
13+
<version>2.7.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 = "2.6.0";
16+
public static final String WEB_TEMPLATE_DISTRIBUTION_VERSION = "2.7.0";
1717

1818
public static final String CDTS_DEFAULT_VERSION = "v4_0_47";
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/RefFooter.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@
44

55
import goc.webtemplate.LeavingSecureSiteWarning;
66

7-
import goc.webtemplate.Utility;
87
import goc.webtemplate.WebAnalyticsInfo;
98

10-
import goc.webtemplate.component.JsonValueUtils;
11-
129
/**
1310
* Objects of this class are meant to be serialized to a JSON object to be passed
1411
* as parameter to the 'wet.builder.refFooter' JavaScript function in the template
@@ -39,7 +36,7 @@ public RefFooter(String cdnEnv, ExitSecureSite exitSecureSite, String jqueryEnv,
3936
public RefFooter(String cdnEnv, LeavingSecureSiteWarning lssw, String jqueryEnv, String localPath, WebAnalyticsInfo webAnalyticsInfo, boolean isApplication) {
4037
this.cdnEnv = cdnEnv;
4138
this.exitSecureSite = null;
42-
if ((lssw != null) && lssw.isEnabled() && !Utility.isNullOrEmpty(lssw.getRedirectUrl())) {
39+
if ((lssw != null) && lssw.isEnabled()) {
4340
this.exitSecureSite = new ExitSecureSite(lssw);
4441
}
4542
this.jqueryEnv = jqueryEnv;

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>2.6.0-SNAPSHOT</version>
13+
<version>2.7.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>2.6.0-SNAPSHOT</version>
13+
<version>2.7.0-SNAPSHOT</version>
1414
<relativePath>..</relativePath>
1515
</parent>
1616

0 commit comments

Comments
 (0)