-
Notifications
You must be signed in to change notification settings - Fork 7
Safe redirect action #7695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release26.3-SNAPSHOT
Are you sure you want to change the base?
Safe redirect action #7695
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,7 +35,9 @@ | |
| import org.labkey.api.action.ExportAction; | ||
| import org.labkey.api.action.MutatingApiAction; | ||
| import org.labkey.api.action.ReadOnlyApiAction; | ||
| import org.labkey.api.action.ReturnUrlForm; | ||
| import org.labkey.api.action.SimpleApiJsonForm; | ||
| import org.labkey.api.action.SimpleRedirectAction; | ||
| import org.labkey.api.action.SimpleViewAction; | ||
| import org.labkey.api.action.SpringActionController; | ||
| import org.labkey.api.admin.AbstractFolderContext.ExportType; | ||
|
|
@@ -204,10 +206,6 @@ | |
|
|
||
| import static org.labkey.api.view.template.WarningService.SESSION_WARNINGS_BANNER_KEY; | ||
|
|
||
| /** | ||
| * User: jeckels | ||
| * Date: Jan 4, 2007 | ||
| */ | ||
| public class CoreController extends SpringActionController | ||
| { | ||
| private static final Map<Container, Content> _customStylesheetCache = new ConcurrentHashMap<>(); | ||
|
|
@@ -2908,4 +2906,16 @@ public void setProvider(String provider) | |
|
|
||
| } | ||
|
|
||
| // Called by various client components to ensure safe redirects, GitHub Issue #1023. This action redirects to | ||
| // local URLs only, never to an external site, even if the host is on the "Allowed External Redirect Hosts" list. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is it that assures this uses local URLs only? Doesn't seem to be codified here.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. First, |
||
| @SuppressWarnings("unused") | ||
| @RequiresNoPermission | ||
| public static class SafeRedirectAction extends SimpleRedirectAction<ReturnUrlForm> | ||
| { | ||
| @Override | ||
| public ActionURL getRedirectURL(ReturnUrlForm form) throws Exception | ||
| { | ||
| return form.getReturnActionURL(AppProps.getInstance().getHomePageActionURL()); | ||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as noted in the commit message, I'll wait until this gets merged to develop to address this TODO so that I don't need to bump @labkey/components for this branch (and have to handle the merge forward conflicts)