Skip to content

restricted frame url redirect #575

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 76 additions & 17 deletions dev-workflow-ui/webContent/view/frame.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -85,34 +85,93 @@
attachUnload();
}

const authorizedXhtml = [
'/faces/home.xhtml',
'/faces/tasks.xhtml',
'/faces/starts.xhtml',
'/faces/#.xhtml',
'/faces/#Table.xhtml',
'/app/home.xhtml',
'/app/tasks.xhtml',
'/app/starts.xhtml',
'/app/#.xhtml'
];

const authorizedIvp = new Map([
['DefaultApplicationHomePage.ivp', 'home.xhtml'],
['DefaultTaskListPage.ivp', 'tasks.xhtml'],
['DefaultProcessStartListPage.ivp', 'starts.xhtml'],
['DefaultLoginPage.ivp', 'login.xhtml']
]);

function checkAndReturnUrl(newURL, originPage) {
if (newURL.includes('task.xhtml')){
return newURL.substring(newURL.indexOf('task.xhtml'));
}
if (newURL.includes('?endedTaskId=')) {
return originPage;
}
if (newURL.endsWith('/faces/home.xhtml') || newURL.includes('DefaultApplicationHomePage.ivp') || newURL.endsWith('/app/home.xhtml')) {
return 'home.xhtml';
}
if (newURL.endsWith('/faces/tasks.xhtml') || newURL.includes('DefaultTaskListPage.ivp') || newURL.endsWith('/app/tasks.xhtml')) {
return 'tasks.xhtml';
for (let url of authorizedXhtml) {
if (newURL.endsWith(url)) {
return newURL.substring(newURL.indexOf(url));
}
}
if (newURL.endsWith('/faces/starts.xhtml') || newURL.includes('DefaultProcessStartListPage.ivp') || newURL.endsWith('/app/starts.xhtml')) {
return 'starts.xhtml';

for (let url of authorizedIvp) {
if (newURL.includes(url[0])) {
alert("found "+ url[0]+ " : "+ url[1])
return url[1];
}
}
if (newURL.endsWith('/faces/#.xhtml') || newURL.includes('DefaultLoginPage.ivp') || newURL.endsWith('/app/#.xhtml')) {
return 'login.xhtml';
if (newURL.includes('?endedTaskId=')) {
if (originPage == 'home.xhtml'){
return originPage;
}
if (originPage == 'case.xhtml'){
return 'cases.xhtml';
}
if (originPage.includes('task.xhtml?id=')){
var id = originPage.split("id=");
if(id[1].length == 36){
return originPage;
}
return undefined;
}
}
if (newURL.endsWith('/faces/#Table.xhtml')) {
return 'loginTable.xhtml';

if (newURL.includes('?endedTaskId=')) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ivy-cst i never get to this, which was the usecase for this?

i could reach login.xhtml with creating links in my dialog, is this the only way to test (product from jenkins)?
is it possible to create a testsuite for this?

alert("1: " + "newUrl: "+newURL + " | originPage: "+ originPage);
return originPage;
}
if (newURL.endsWith('/faces/end.xhtml') || newURL.includes('DefaultEndPage.ivp') || newURL.endsWith('/app/end.xhtml')) {
alert("2: " + "newUrl: "+newURL + " | originPage: "+ originPage);
return originPage;
}
return undefined;
}

// function checkAndReturnUrl(newURL, originPage) {
// if (newURL.includes('task.xhtml')){
// return newURL.substring(newURL.indexOf('task.xhtml'));
// }
// if (newURL.includes('?endedTaskId=')) {
// return originPage;
// }
// if (newURL.endsWith('/faces/home.xhtml') || newURL.includes('DefaultApplicationHomePage.ivp') || newURL.endsWith('/app/home.xhtml')) {
// return 'home.xhtml';
// }
// if (newURL.endsWith('/faces/tasks.xhtml') || newURL.includes('DefaultTaskListPage.ivp') || newURL.endsWith('/app/tasks.xhtml')) {
// return 'tasks.xhtml';
// }
// if (newURL.endsWith('/faces/starts.xhtml') || newURL.includes('DefaultProcessStartListPage.ivp') || newURL.endsWith('/app/starts.xhtml')) {
// return 'starts.xhtml';
// }
// if (newURL.endsWith('/faces/#.xhtml') || newURL.includes('DefaultLoginPage.ivp') || newURL.endsWith('/app/#.xhtml')) {
// return 'login.xhtml';
// }
// if (newURL.endsWith('/faces/#Table.xhtml')) {
// return 'loginTable.xhtml';
// }
// if (newURL.endsWith('/faces/end.xhtml') || newURL.includes('DefaultEndPage.ivp') || newURL.endsWith('/app/end.xhtml')) {
// return originPage;
// }
// return undefined;
// }

iframeURLChange(document.getElementById("iFrame"), function(newURL, iframe) {
var originPage = new URLSearchParams(window.location.search).get('originalUrl');
if (iframe.contentWindow.location.pathname.match("/default/redirect.xhtml")) {
Expand Down