From 2675215f3e641e90e3fc1f7a284397b62f86f4c3 Mon Sep 17 00:00:00 2001 From: Net Wolf UK Date: Sun, 28 Apr 2019 10:14:45 +1200 Subject: [PATCH] Escape values when rendering to the page. --- .../buildServerResources/WebHook/adminTab.jsp | 4 +-- .../WebHook/endpointRequests.jsp | 6 ++--- .../buildServerResources/WebHook/index.jsp | 15 ++++++----- .../WebHook/js/editWebhook.js | 20 ++++++++------- .../WebHook/js/editWebhookTemplate.js | 25 +++++++++++++------ .../WebHook/templateEdit.jsp | 6 ++--- .../templateEditListBuildEventTemplates.jsp | 12 ++++----- .../WebHook/viewHistory.jsp | 14 +++++------ .../WebHook/webHookInclude.jsp | 5 ++-- .../WebHook/webHookProjectSettingsTab.jsp | 4 +-- .../WebHook/webHookTab.jsp | 10 ++++---- .../WebHook/webHookTabWithHistory.jsp | 22 ++++++++-------- .../WebHook/webhookEdit.jsp | 14 +++++------ 13 files changed, 83 insertions(+), 74 deletions(-) diff --git a/tcwebhooks-web-ui/src/main/resources/buildServerResources/WebHook/adminTab.jsp b/tcwebhooks-web-ui/src/main/resources/buildServerResources/WebHook/adminTab.jsp index 7763fdc8..5afbff0d 100644 --- a/tcwebhooks-web-ui/src/main/resources/buildServerResources/WebHook/adminTab.jsp +++ b/tcwebhooks-web-ui/src/main/resources/buildServerResources/WebHook/adminTab.jsp @@ -42,9 +42,9 @@ ${historyItem.webHookExecutionStats.initTimeStamp} - ${historyItem.webHookExecutionStats.url} + undefined - ${historyItem.webHookExecutionStats.statusCode} :: ${historyItem.webHookExecutionStats.statusReason} + ${historyItem.webHookExecutionStats.statusCode} :: diff --git a/tcwebhooks-web-ui/src/main/resources/buildServerResources/WebHook/endpointRequests.jsp b/tcwebhooks-web-ui/src/main/resources/buildServerResources/WebHook/endpointRequests.jsp index af227497..d99cbdf0 100644 --- a/tcwebhooks-web-ui/src/main/resources/buildServerResources/WebHook/endpointRequests.jsp +++ b/tcwebhooks-web-ui/src/main/resources/buildServerResources/WebHook/endpointRequests.jsp @@ -33,10 +33,10 @@ BS.Navigation.items = [ {title: "Projects", url: ''}, - {title: "${projectName}", url: ''}, + {title: "", url: ''}, - {title: "${buildName}", url: ''}, + {title: "", url: ''}, {title: "${title}", selected:true} ]; @@ -68,7 +68,7 @@ - +
HTTP Headers sent with this request
${headerThing.key}:${headerThing.value}
:
diff --git a/tcwebhooks-web-ui/src/main/resources/buildServerResources/WebHook/index.jsp b/tcwebhooks-web-ui/src/main/resources/buildServerResources/WebHook/index.jsp index 3faf37e5..fc367f09 100644 --- a/tcwebhooks-web-ui/src/main/resources/buildServerResources/WebHook/index.jsp +++ b/tcwebhooks-web-ui/src/main/resources/buildServerResources/WebHook/index.jsp @@ -32,10 +32,10 @@ BS.Navigation.items = [ {title: "Projects", url: ''}, - {title: "${projectName}", url: ''}, + {title: "", url: ''}, - {title: "${buildName}", url: ''}, + {title: "", url: ''}, {title: "${title}", selected:true} ]; @@ -51,7 +51,6 @@ - -
@@ -99,7 +98,7 @@ @@ -227,7 +226,7 @@ - + "/> diff --git a/tcwebhooks-web-ui/src/main/resources/buildServerResources/WebHook/webHookProjectSettingsTab.jsp b/tcwebhooks-web-ui/src/main/resources/buildServerResources/WebHook/webHookProjectSettingsTab.jsp index 0b60cb25..830a4223 100644 --- a/tcwebhooks-web-ui/src/main/resources/buildServerResources/WebHook/webHookProjectSettingsTab.jsp +++ b/tcwebhooks-web-ui/src/main/resources/buildServerResources/WebHook/webHookProjectSettingsTab.jsp @@ -11,7 +11,7 @@
- +
Project NameWebHook Count
${parent.sensibleProjectName}${fn:length(parent.webHookList)} webhooks configured
${fn:length(parent.webHookList)} webhooks configured

@@ -22,7 +22,7 @@

WebHooks configured for every TeamCity build (_Root project)

-

WebHooks configured for ${project.fullName}

+

WebHooks configured for

diff --git a/tcwebhooks-web-ui/src/main/resources/buildServerResources/WebHook/webHookTab.jsp b/tcwebhooks-web-ui/src/main/resources/buildServerResources/WebHook/webHookTab.jsp index f12060a7..9fa30805 100644 --- a/tcwebhooks-web-ui/src/main/resources/buildServerResources/WebHook/webHookTab.jsp +++ b/tcwebhooks-web-ui/src/main/resources/buildServerResources/WebHook/webHookTab.jsp @@ -10,7 +10,7 @@

WebHooks configured for every TeamCity build

-

WebHooks configured for ${project.project.fullName}

+

WebHooks configured for

@@ -27,7 +27,7 @@
WARNING: Webhook processing is currently disabled for this project

There are ${project.projectWebhookCount} WebHooks configured for all builds in this project. - Edit project WebHooks.

+ Edit project WebHooks.

@@ -41,19 +41,19 @@ -

WebHooks configured for ${projectName} > ${config.buildName}

+

WebHooks configured for >

There are no WebHooks configured for this specific build.

- Add build WebHooks. + Add build WebHooks.

There are ${config.buildCount} WebHooks for this specific build. - Edit build WebHooks.

+ Edit build WebHooks.

URLEnabled
diff --git a/tcwebhooks-web-ui/src/main/resources/buildServerResources/WebHook/webHookTabWithHistory.jsp b/tcwebhooks-web-ui/src/main/resources/buildServerResources/WebHook/webHookTabWithHistory.jsp index 26159bde..61cdcc58 100644 --- a/tcwebhooks-web-ui/src/main/resources/buildServerResources/WebHook/webHookTabWithHistory.jsp +++ b/tcwebhooks-web-ui/src/main/resources/buildServerResources/WebHook/webHookTabWithHistory.jsp @@ -13,7 +13,7 @@

WebHooks configured for every TeamCity build (_Root)

-

WebHooks configured for ${project.project.fullName}

+

WebHooks configured for

@@ -21,7 +21,7 @@

There are no WebHooks configured for this project.

- Add project WebHooks. + ">Add project WebHooks.
@@ -30,7 +30,7 @@
WARNING: Webhook processing is currently disabled for this project

There are ${project.projectWebhookCount} WebHooks configured for all builds in this project. - Edit project WebHooks.

+ ">Edit project WebHooks.

URLEnabled
@@ -51,18 +51,18 @@ -

WebHooks configured for ${projectName} > ${config.buildName}

+

WebHooks configured for >

There are no WebHooks configured for this specific build.

- Add build WebHooks. + ">Add build WebHooks.

There are ${config.buildCount} WebHooks for this specific build. - Edit build WebHooks.

+ ">Edit build WebHooks.

URLEnabled
@@ -94,22 +94,22 @@ - + - + - + - + - + diff --git a/tcwebhooks-web-ui/src/main/resources/buildServerResources/WebHook/webhookEdit.jsp b/tcwebhooks-web-ui/src/main/resources/buildServerResources/WebHook/webhookEdit.jsp index 98df86be..57fce926 100644 --- a/tcwebhooks-web-ui/src/main/resources/buildServerResources/WebHook/webhookEdit.jsp +++ b/tcwebhooks-web-ui/src/main/resources/buildServerResources/WebHook/webhookEdit.jsp @@ -33,10 +33,10 @@ BS.Navigation.items = [ {title: "Projects", url: ''}, - {title: "${projectName}", url: ''}, + {title: "", url: ''}, - {title: "${buildName}", url: ''}, + {title: "", url: ''}, {title: "${title}", selected:true} ]; @@ -106,7 +106,7 @@ function renderPreviewOnChange() { if ($j('#payloadFormatHolder').val()) { - $j('#currentTemplateName').html(lookupTemplateName($j('#payloadFormatHolder').val())); + $j('#currentTemplateName').html(htmlEscape(lookupTemplateName($j('#payloadFormatHolder').val()))); } else { $j('#currentTemplateName').html(" "); } @@ -182,11 +182,11 @@ -

WebHooks applicable to build ${buildName}

+

WebHooks applicable to build

To edit all webhooks for builds in the project edit Project webhooks.
-

WebHooks configured for project ${projectName}

+

WebHooks configured for project

@@ -262,10 +262,10 @@ $('systemParams').updateContainer = function() { - $j.get("settingsList.html?buildTypeId=${buildExternalId}", function(data) { + $j.get("settingsList.html?buildTypeId=", function(data) { - $j.get("settingsList.html?projectId=${projectId}", function(data) { + $j.get("settingsList.html?projectId=", function(data) { ProjectBuilds = data;
URLEnabled
${historyItem.webHookExecutionStats.initTimeStamp} ${historyItem.buildTypeName} #${historyItem.buildId}"> # ${historyItem.buildTypeName}"> ${historyItem.webHookExecutionStats.url}'"> ** ${historyItem.url}')">** undefined${historyItem.webHookExecutionStats.statusCode} :: ${historyItem.webHookExecutionStats.statusReason}${historyItem.webHookExecutionStats.statusCode} ::