From f5f6cab64681c16664a71e8c1374f8e9c34d4931 Mon Sep 17 00:00:00 2001 From: Scott Aslan Date: Tue, 16 May 2017 10:31:30 -0700 Subject: [PATCH] NIFI-3906 Added formatting to tables. Signed-off-by: Andy LoPresto --- .../propertytable/jquery.propertytable.js | 9 +- .../components/nf-ng-processor-component.js | 3 +- .../webapp/js/nf/canvas/nf-component-state.js | 9 +- .../js/nf/canvas/nf-controller-services.js | 24 ++- .../js/nf/canvas/nf-policy-management.js | 2 +- .../webapp/js/nf/canvas/nf-queue-listing.js | 12 +- .../main/webapp/js/nf/canvas/nf-settings.js | 7 +- .../webapp/js/nf/cluster/nf-cluster-table.js | 164 ++++++++++++++---- .../js/nf/counters/nf-counters-table.js | 9 +- .../src/main/webapp/js/nf/nf-common.js | 18 +- .../js/nf/provenance/nf-provenance-table.js | 18 +- .../webapp/js/nf/summary/nf-summary-table.js | 133 +++++++++++--- .../js/nf/templates/nf-templates-table.js | 8 +- .../main/webapp/js/nf/users/nf-users-table.js | 8 +- 14 files changed, 328 insertions(+), 96 deletions(-) diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js index 6ee9a2f575..7c27b3d03a 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js @@ -1289,7 +1289,14 @@ return markup; }; - propertyColumns.push({id: "actions", name: " ", minWidth: 20, width: 20, formatter: actionFormatter}); + propertyColumns.push( + { + id: "actions", + name: " ", + minWidth: 20, + width: 20, + formatter: actionFormatter + }); var propertyConfigurationOptions = { forceFitColumns: true, diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/header/components/nf-ng-processor-component.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/header/components/nf-ng-processor-component.js index bb42ee709e..c9f80f3862 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/header/components/nf-ng-processor-component.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/header/components/nf-ng-processor-component.js @@ -329,7 +329,8 @@ name: 'Tags', field: 'tags', sortable: true, - resizable: true + resizable: true, + formatter: nfCommon.genericValueFormatter } ]; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-component-state.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-component-state.js index ae9ebdc51e..8fb73a8036 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-component-state.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-component-state.js @@ -298,14 +298,16 @@ field: 'key', name: 'Key', sortable: true, - resizable: true + resizable: true, + formatter: nfCommon.genericValueFormatter }, { id: 'value', field: 'value', name: 'Value', sortable: true, - resizable: true + resizable: true, + formatter: nfCommon.genericValueFormatter } ]; @@ -316,7 +318,8 @@ field: 'scope', name: 'Scope', sortable: true, - resizable: true + resizable: true, + formatter: nfCommon.genericValueFormatter }); } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-services.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-services.js index 3c9726fc62..ef98d38f5c 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-services.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-services.js @@ -361,7 +361,8 @@ name: 'Tags', field: 'tags', sortable: true, - resizable: true + resizable: true, + formatter: nfCommon.genericValueFormatter } ]; @@ -624,10 +625,10 @@ */ var nameFormatter = function (row, cell, value, columnDef, dataContext) { if (!dataContext.permissions.canRead) { - return '' + dataContext.id + ''; + return '' + nfCommon.escapeHtml(dataContext.id) + ''; } - return dataContext.component.name; + return nfCommon.escapeHtml(dataContext.component.name); }; /** @@ -652,9 +653,9 @@ var selectedData = selection.datum(); if (selectedData.id === dataContext.component.parentGroupId) { if (selectedData.permissions.canRead) { - return selectedData.component.name; + return nfCommon.escapeHtml(selectedData.component.name); } else { - return selectedData.id; + return nfCommon.escapeHtml(selectedData.id); } } } @@ -670,7 +671,7 @@ } }); - return processGroupLabel; + return nfCommon.escapeHtml(processGroupLabel); } else { return 'Controller'; } @@ -938,7 +939,16 @@ ]; // action column should always be last - controllerServicesColumns.push({id: 'actions', name: ' ', resizable: false, formatter: controllerServiceActionFormatter, sortable: false, width: 90, maxWidth: 90}); + controllerServicesColumns.push( + { + id: 'actions', + name: ' ', + resizable: false, + formatter: controllerServiceActionFormatter, + sortable: false, + width: 90, + maxWidth: 90 + }); // initialize the dataview var controllerServicesData = new Slick.Data.DataView({ diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-policy-management.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-policy-management.js index 93cb9207a5..c4c3cd80f3 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-policy-management.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-policy-management.js @@ -540,7 +540,7 @@ markup += '
'; } - markup += dataContext.component.identity; + markup += nfCommon.escapeHtml(dataContext.component.identity); return markup; }; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-queue-listing.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-queue-listing.js index 98632dc742..b9714ef7b6 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-queue-listing.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-queue-listing.js @@ -534,21 +534,24 @@ sortable: false, resizable: false, width: 75, - maxWidth: 75 + maxWidth: 75, + formatter: nfCommon.genericValueFormatter }, { id: 'uuid', name: 'UUID', field: 'uuid', sortable: false, - resizable: true + resizable: true, + formatter: nfCommon.genericValueFormatter }, { id: 'filename', name: 'Filename', field: 'filename', sortable: false, - resizable: true + resizable: true, + formatter: nfCommon.genericValueFormatter }, { id: 'size', @@ -594,7 +597,8 @@ name: 'Node', field: 'clusterNodeAddress', sortable: false, - resizable: true + resizable: true, + formatter: nfCommon.genericValueFormatter }); } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js index 2574cbdea7..075f7128d3 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js @@ -229,10 +229,10 @@ */ var nameFormatter = function (row, cell, value, columnDef, dataContext) { if (!dataContext.permissions.canRead) { - return '' + dataContext.id + ''; + return '' + nfCommon.escapeHtml(dataContext.id) + ''; } - return dataContext.component.name; + return nfCommon.escapeHtml(dataContext.component.name); }; /** @@ -508,7 +508,8 @@ name: 'Tags', field: 'tags', sortable: true, - resizable: true + resizable: true, + formatter: nfCommon.genericValueFormatter } ]; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/cluster/nf-cluster-table.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/cluster/nf-cluster-table.js index cb4ed600a6..0192b49f2a 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/cluster/nf-cluster-table.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/cluster/nf-cluster-table.js @@ -134,7 +134,14 @@ tabContentId: 'cluster-system-tab-content', tableId: 'cluster-system-table', tableColumnModel: [ - {id: 'node', field: 'node', name: 'Node Address', sortable: true, resizable: true}, + { + id: 'node', + field: 'node', + name: 'Node Address', + sortable: true, + resizable: true, + formatter: nfCommon.genericValueFormatter + }, { id: 'processors', field: 'processors', @@ -142,7 +149,8 @@ sortable: true, resizable: true, cssClass: 'cell-right', - headerCssClass: 'header-right' + headerCssClass: 'header-right', + formatter: nfCommon.genericValueFormatter }, { id: 'processorLoadAverage', @@ -151,7 +159,8 @@ sortable: true, resizable: true, cssClass: 'cell-right', - headerCssClass: 'header-right' + headerCssClass: 'header-right', + formatter: nfCommon.genericValueFormatter }, { id: 'totalThreads', @@ -160,7 +169,8 @@ sortable: true, resizable: true, cssClass: 'cell-right', - headerCssClass: 'header-right' + headerCssClass: 'header-right', + formatter: nfCommon.genericValueFormatter }, { id: 'daemonThreads', @@ -169,7 +179,8 @@ sortable: true, resizable: true, cssClass: 'cell-right', - headerCssClass: 'header-right' + headerCssClass: 'header-right', + formatter: nfCommon.genericValueFormatter } ], tableIdColumn: 'id', @@ -195,7 +206,14 @@ tabContentId: 'cluster-flowfile-tab-content', tableId: 'cluster-flowfile-table', tableColumnModel: [ - {id: 'node', field: 'node', name: 'Node Address', sortable: true, resizable: true}, + { + id: 'node', + field: 'node', + name: 'Node Address', + sortable: true, + resizable: true, + formatter: nfCommon.genericValueFormatter + }, { id: 'ffRepoTotal', field: 'ffRepoTotal', @@ -203,7 +221,8 @@ sortable: true, resizable: true, cssClass: 'cell-right', - headerCssClass: 'header-right' + headerCssClass: 'header-right', + formatter: nfCommon.genericValueFormatter }, { id: 'ffRepoUsed', @@ -212,7 +231,8 @@ sortable: true, resizable: true, cssClass: 'cell-right', - headerCssClass: 'header-right' + headerCssClass: 'header-right', + formatter: nfCommon.genericValueFormatter }, { id: 'ffRepoFree', @@ -221,7 +241,8 @@ sortable: true, resizable: true, cssClass: 'cell-right', - headerCssClass: 'header-right' + headerCssClass: 'header-right', + formatter: nfCommon.genericValueFormatter }, { id: 'ffStoreUtil', @@ -230,7 +251,8 @@ sortable: true, resizable: true, cssClass: 'cell-right', - headerCssClass: 'header-right' + headerCssClass: 'header-right', + formatter: nfCommon.genericValueFormatter } ], tableIdColumn: 'id', @@ -256,8 +278,22 @@ tabContentId: 'cluster-content-tab-content', tableId: 'cluster-content-table', tableColumnModel: [ - {id: 'node', field: 'node', name: 'Node Address', sortable: true, resizable: true}, - {id: 'contentRepoId', field: 'contentRepoId', name: 'Content Repository', sortable: true, resizable: true}, + { + id: 'node', + field: 'node', + name: 'Node Address', + sortable: true, + resizable: true, + formatter: nfCommon.genericValueFormatter + }, + { + id: 'contentRepoId', + field: 'contentRepoId', + name: 'Content Repository', + sortable: true, + resizable: true, + formatter: nfCommon.genericValueFormatter + }, { id: 'contentRepoTotal', field: 'contentRepoTotal', @@ -265,7 +301,8 @@ sortable: true, resizable: true, cssClass: 'cell-right', - headerCssClass: 'header-right' + headerCssClass: 'header-right', + formatter: nfCommon.genericValueFormatter }, { id: 'contentRepoUsed', @@ -274,7 +311,8 @@ sortable: true, resizable: true, cssClass: 'cell-right', - headerCssClass: 'header-right' + headerCssClass: 'header-right', + formatter: nfCommon.genericValueFormatter }, { id: 'contentRepoFree', @@ -283,7 +321,8 @@ sortable: true, resizable: true, cssClass: 'cell-right', - headerCssClass: 'header-right' + headerCssClass: 'header-right', + formatter: nfCommon.genericValueFormatter }, { id: 'contentRepoUtil', @@ -292,7 +331,8 @@ sortable: true, resizable: true, cssClass: 'cell-right', - headerCssClass: 'header-right' + headerCssClass: 'header-right', + formatter: nfCommon.genericValueFormatter } ], tableIdColumn: 'id', @@ -321,13 +361,62 @@ tabContentId: 'cluster-version-tab-content', tableId: 'cluster-version-table', tableColumnModel: [ - {id: 'node', field: 'node', name: 'Node Address', sortable: true, resizable: true}, - {id: 'version', field: 'version', name: 'NiFi Version', sortable: true, resizable: true}, - {id: 'javavendor', field: 'javaVendor', name: 'Java Vendor', sortable: true, resizable: true}, - {id: 'javaversion', field: 'javaVersion', name: 'Java Version', sortable: true, resizable: true}, - {id: 'osname', field: 'osName', name: 'OS Name', sortable: true, resizable: true}, - {id: 'osversion', field: 'osVersion', name: 'OS Version', sortable: true, resizable: true}, - {id: 'osarch', field: 'osArchitecture', name: 'OS Architecture', sortable: true, resizable: true} + { + id: 'node', + field: 'node', + name: 'Node Address', + sortable: true, + resizable: true, + formatter: nfCommon.genericValueFormatter + }, + { + id: 'version', + field: 'version', + name: 'NiFi Version', + sortable: true, + resizable: true, + formatter: nfCommon.genericValueFormatter + }, + { + id: 'javavendor', + field: 'javaVendor', + name: 'Java Vendor', + sortable: true, + resizable: true, + formatter: nfCommon.genericValueFormatter + }, + { + id: 'javaversion', + field: 'javaVersion', + name: 'Java Version', + sortable: true, + resizable: true, + formatter: nfCommon.genericValueFormatter + }, + { + id: 'osname', + field: 'osName', + name: 'OS Name', + sortable: true, + resizable: true, + formatter: nfCommon.genericValueFormatter + }, + { + id: 'osversion', + field: 'osVersion', + name: 'OS Version', + sortable: true, + resizable: true, + formatter: nfCommon.genericValueFormatter + }, + { + id: 'osarch', + field: 'osArchitecture', + name: 'OS Architecture', + sortable: true, + resizable: true, + formatter: nfCommon.genericValueFormatter + } ], tableIdColumn: 'id', tableOptions: commonTableOptions, @@ -413,7 +502,8 @@ name: 'Active Thread Count', resizable: true, sortable: true, - defaultSortAsc: false + defaultSortAsc: false, + formatter: nfCommon.genericValueFormatter }, { id: 'queued', @@ -421,7 +511,8 @@ name: 'Queue / Size', resizable: true, sortable: true, - defaultSortAsc: false + defaultSortAsc: false, + formatter: nfCommon.genericValueFormatter }, { id: 'status', @@ -540,7 +631,8 @@ field: 'node', name: 'Node Address', sortable: true, - resizable: true + resizable: true, + formatter: nfCommon.genericValueFormatter }, { id: 'heapMax', @@ -549,7 +641,8 @@ sortable: true, resizable: true, cssClass: 'cell-right', - headerCssClass: 'header-right' + headerCssClass: 'header-right', + formatter: nfCommon.genericValueFormatter }, { id: 'heapTotal', @@ -558,7 +651,8 @@ sortable: true, resizable: true, cssClass: 'cell-right', - headerCssClass: 'header-right' + headerCssClass: 'header-right', + formatter: nfCommon.genericValueFormatter }, { id: 'heapUsed', @@ -567,7 +661,8 @@ sortable: true, resizable: true, cssClass: 'cell-right', - headerCssClass: 'header-right' + headerCssClass: 'header-right', + formatter: nfCommon.genericValueFormatter }, { id: 'heapUtilPct', @@ -576,7 +671,8 @@ sortable: true, resizable: true, cssClass: 'cell-right', - headerCssClass: 'header-right' + headerCssClass: 'header-right', + formatter: nfCommon.genericValueFormatter }, { id: 'nonHeapTotal', @@ -594,7 +690,8 @@ sortable: true, resizable: true, cssClass: 'cell-right', - headerCssClass: 'header-right' + headerCssClass: 'header-right', + formatter: nfCommon.genericValueFormatter }, { id: 'gc', @@ -612,7 +709,8 @@ sortable: true, resizable: true, cssClass: 'cell-right', - headerCssClass: 'header-right' + headerCssClass: 'header-right', + formatter: nfCommon.genericValueFormatter } ]; } @@ -717,7 +815,7 @@ if (node.roles.includes(config.clusterCoordinator)) { markup += ', COORDINATOR'; } - return markup; + return nfCommon.escapeHtml(markup); } /** diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/counters/nf-counters-table.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/counters/nf-counters-table.js index 8cd04c7c62..b76b4dfefa 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/counters/nf-counters-table.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/counters/nf-counters-table.js @@ -178,14 +178,16 @@ name: 'Context', field: 'context', sortable: true, - resizable: true + resizable: true, + formatter: nfCommon.genericValueFormatter }, { id: 'name', name: 'Name', field: 'name', sortable: true, - resizable: true + resizable: true, + formatter: nfCommon.genericValueFormatter }, { id: 'value', @@ -193,7 +195,8 @@ field: 'value', sortable: true, resizable: true, - defaultSortAsc: false + defaultSortAsc: false, + formatter: nfCommon.genericValueFormatter } ]; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js index 52a50f6723..5afe253a20 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js @@ -328,6 +328,20 @@ return markup; }, + /** + * Escapes any malicious HTML characters from the value. + * + * @param row + * @param cell + * @param value + * @param columnDef + * @param dataContext + * @returns {string} + */ + genericValueFormatter: function (row, cell, value, columnDef, dataContext) { + return nfCommon.escapeHtml(value); + }, + /** * Formats the bundle of a component type for the new instance dialog. * @@ -1184,11 +1198,11 @@ while (regex.test(string)) { string = string.replace(regex, '$1' + ',' + '$2'); } - return string; + return nfCommon.escapeHtml(string); }, /** - * Formats the specified float using two demical places. + * Formats the specified float using two decimal places. * * @param {float} f */ diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/provenance/nf-provenance-table.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/provenance/nf-provenance-table.js index 1ae4c1d01c..1076ccaf3a 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/provenance/nf-provenance-table.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/provenance/nf-provenance-table.js @@ -664,21 +664,24 @@ field: 'eventTime', sortable: true, defaultSortAsc: false, - resizable: true + resizable: true, + formatter: nfCommon.genericValueFormatter }, { id: 'eventType', name: 'Type', field: 'eventType', sortable: true, - resizable: true + resizable: true, + formatter: nfCommon.genericValueFormatter }, { id: 'flowFileUuid', name: 'FlowFile Uuid', field: 'flowFileUuid', sortable: true, - resizable: true + resizable: true, + formatter: nfCommon.genericValueFormatter }, { id: 'fileSize', @@ -686,7 +689,8 @@ field: 'fileSize', sortable: true, defaultSortAsc: false, - resizable: true + resizable: true, + formatter: nfCommon.genericValueFormatter }, { id: 'componentName', @@ -701,7 +705,8 @@ name: 'Component Type', field: 'componentType', sortable: true, - resizable: true + resizable: true, + formatter: nfCommon.genericValueFormatter } ]; @@ -712,7 +717,8 @@ name: 'Node', field: 'clusterNodeAddress', sortable: true, - resizable: true + resizable: true, + formatter: nfCommon.genericValueFormatter }); } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-summary-table.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-summary-table.js index 4f83691efb..92b622b6f9 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-summary-table.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-summary-table.js @@ -278,12 +278,12 @@ // formatter for io var ioFormatter = function (row, cell, value, columnDef, dataContext) { - return dataContext.read + ' / ' + dataContext.written; + return nfCommon.escapeHtml(dataContext.read) + ' / ' + nfCommon.escapeHtml(dataContext.written); }; // formatter for tasks var taskTimeFormatter = function (row, cell, value, columnDef, dataContext) { - return nfCommon.formatInteger(dataContext.tasks) + ' / ' + dataContext.tasksDuration; + return nfCommon.formatInteger(dataContext.tasks) + ' / ' + nfCommon.escapeHtml(dataContext.tasksDuration); }; // function for formatting the last accessed time @@ -295,7 +295,7 @@ var runStatusFormatter = function (row, cell, value, columnDef, dataContext) { var activeThreadCount = ''; if (nfCommon.isDefinedAndNotNull(dataContext.activeThreadCount) && dataContext.activeThreadCount > 0) { - activeThreadCount = '(' + dataContext.activeThreadCount + ')'; + activeThreadCount = '(' + nfCommon.escapeHtml(dataContext.activeThreadCount) + ')'; } var classes = nfCommon.escapeHtml(value.toLowerCase()); switch (nfCommon.escapeHtml(value.toLowerCase())) { @@ -322,7 +322,14 @@ }; // define the input, read, written, and output columns (reused between both tables) - var nameColumn = {id: 'name', field: 'name', name: 'Name', sortable: true, resizable: true}; + var nameColumn = { + id: 'name', + field: 'name', + name: 'Name', + sortable: true, + resizable: true, + formatter: nfCommon.genericValueFormatter + }; var runStatusColumn = { id: 'runStatus', field: 'runStatus', @@ -337,7 +344,8 @@ toolTip: 'Count / data size in the last 5 min', sortable: true, defaultSortAsc: false, - resizable: true + resizable: true, + formatter: nfCommon.genericValueFormatter }; var ioColumn = { id: 'io', @@ -356,7 +364,8 @@ toolTip: 'Count / data size in the last 5 min', sortable: true, defaultSortAsc: false, - resizable: true + resizable: true, + formatter: nfCommon.genericValueFormatter }; var tasksTimeColumn = { id: 'tasks', @@ -383,7 +392,14 @@ toolTip: 'Sorts based on presence of bulletins' }, nameColumn, - {id: 'type', field: 'type', name: 'Type', sortable: true, resizable: true}, + { + id: 'type', + field: 'type', + name: 'Type', + sortable: true, + resizable: true, + formatter: nfCommon.genericValueFormatter + }, runStatusColumn, inputColumn, ioColumn, @@ -583,7 +599,14 @@ // initialize the cluster processor column model var clusterProcessorsColumnModel = [ - {id: 'node', field: 'node', name: 'Node', sortable: true, resizable: true}, + { + id: 'node', + field: 'node', + name: 'Node', + sortable: true, + resizable: true, + formatter: nfCommon.genericValueFormatter + }, runStatusColumn, inputColumn, ioColumn, @@ -653,7 +676,7 @@ if (nfCommon.isDefinedAndNotNull(dataContext.percentUseBytes)) { percentUseBytes = dataContext.percentUseBytes + '%'; } - return percentUseCount + ' / ' + percentUseBytes; + return nfCommon.escapeHtml(percentUseCount) + ' / ' + nfCommon.escapeHtml(percentUseBytes); }; // define the input, read, written, and output columns (reused between both tables) @@ -663,7 +686,8 @@ name: 'Queue / Size', sortable: true, defaultSortAsc: false, - resize: true + resize: true, + formatter: nfCommon.genericValueFormatter }; // define the backpressure column (reused between both tables) @@ -688,14 +712,29 @@ width: 50, maxWidth: 50 }, - {id: 'sourceName', field: 'sourceName', name: 'Source Name', sortable: true, resizable: true}, - {id: 'name', field: 'name', name: 'Name', sortable: true, resizable: true, formatter: valueFormatter}, + { + id: 'sourceName', + field: 'sourceName', + name: 'Source Name', + sortable: true, + resizable: true, + formatter: nfCommon.genericValueFormatter + }, + { + id: 'name', + field: 'name', + name: 'Name', + sortable: true, + resizable: true, + formatter: valueFormatter + }, { id: 'destinationName', field: 'destinationName', name: 'Destination Name', sortable: true, - resizable: true + resizable: true, + formatter: nfCommon.genericValueFormatter }, inputColumn, queueColumn, @@ -864,7 +903,14 @@ // initialize the cluster processor column model var clusterConnectionsColumnModel = [ - {id: 'node', field: 'node', name: 'Node', sortable: true, resizable: true}, + { + id: 'node', + field: 'node', + name: 'Node', + sortable: true, + resizable: true, + formatter: nfCommon.genericValueFormatter + }, inputColumn, queueColumn, backpressureColumn, @@ -949,7 +995,8 @@ toolTip: 'Count / data size transferred to and from connections in the last 5 min', resizable: true, defaultSortAsc: false, - sortable: true + sortable: true, + formatter: nfCommon.genericValueFormatter }; var sentColumn = { id: 'sent', @@ -958,7 +1005,8 @@ toolTip: 'Count / data size in the last 5 min', sortable: true, defaultSortAsc: false, - resizable: true + resizable: true, + formatter: nfCommon.genericValueFormatter }; var receivedColumn = { id: 'received', @@ -967,13 +1015,21 @@ toolTip: 'Count / data size in the last 5 min', sortable: true, defaultSortAsc: false, - resizable: true + resizable: true, + formatter: nfCommon.genericValueFormatter }; // define the column model for the summary table var processGroupsColumnModel = [ moreDetailsColumn, - {id: 'name', field: 'name', name: 'Name', sortable: true, resizable: true, formatter: valueFormatter}, + { + id: 'name', + field: 'name', + name: 'Name', + sortable: true, + resizable: true, + formatter: valueFormatter + }, transferredColumn, inputColumn, ioColumn, @@ -1170,7 +1226,14 @@ // initialize the cluster process groups column model var clusterProcessGroupsColumnModel = [ - {id: 'node', field: 'node', name: 'Node', sortable: true, resizable: true}, + { + id: 'node', + field: 'node', + name: 'Node', + sortable: true, + resizable: true, + formatter: nfCommon.genericValueFormatter + }, transferredColumn, inputColumn, ioColumn, @@ -1414,7 +1477,14 @@ // initialize the cluster input port column model var clusterInputPortsColumnModel = [ - {id: 'node', field: 'node', name: 'Node', sortable: true, resizable: true}, + { + id: 'node', + field: 'node', + name: 'Node', + sortable: true, + resizable: true, + formatter: nfCommon.genericValueFormatter + }, runStatusColumn, outputColumn ]; @@ -1654,7 +1724,14 @@ // initialize the cluster output port column model var clusterOutputPortsColumnModel = [ - {id: 'node', field: 'node', name: 'Node', sortable: true, resizable: true}, + { + id: 'node', + field: 'node', + name: 'Node', + sortable: true, + resizable: true, + formatter: nfCommon.genericValueFormatter + }, runStatusColumn, inputColumn ]; @@ -1711,7 +1788,7 @@ var transmissionStatusFormatter = function (row, cell, value, columnDef, dataContext) { var activeThreadCount = ''; if (nfCommon.isDefinedAndNotNull(dataContext.activeThreadCount) && dataContext.activeThreadCount > 0) { - activeThreadCount = '(' + dataContext.activeThreadCount + ')'; + activeThreadCount = '(' + nfCommon.escapeHtml(dataContext.activeThreadCount) + ')'; } // determine what to put in the mark up @@ -1743,7 +1820,8 @@ field: 'targetUri', name: 'Target URI', sortable: true, - resizable: true + resizable: true, + formatter: nfCommon.genericValueFormatter }; // define the column model for the summary table @@ -1951,7 +2029,14 @@ // initialize the cluster remote process group column model var clusterRemoteProcessGroupsColumnModel = [ - {id: 'node', field: 'node', name: 'Node', sortable: true, resizable: true}, + { + id: 'node', + field: 'node', + name: 'Node', + sortable: true, + resizable: true, + formatter: nfCommon.genericValueFormatter + }, targetUriColumn, transmissionStatusColumn, sentColumn, diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/templates/nf-templates-table.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/templates/nf-templates-table.js index 8c5e4debfd..c942bdb6c0 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/templates/nf-templates-table.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/templates/nf-templates-table.js @@ -251,15 +251,15 @@ return ''; } - return dataContext.template.timestamp; + return nfCommon.escapeHtml(dataContext.template.timestamp); }; var nameFormatter = function (row, cell, value, columnDef, dataContext) { if (!dataContext.permissions.canRead) { - return '' + dataContext.id + ''; + return '' + nfCommon.escapeHtml(dataContext.id) + ''; } - return dataContext.template.name; + return nfCommon.escapeHtml(dataContext.template.name); }; var descriptionFormatter = function (row, cell, value, columnDef, dataContext) { @@ -275,7 +275,7 @@ return ''; } - return dataContext.template.groupId; + return nfCommon.escapeHtml(dataContext.template.groupId); }; // function for formatting the actions column diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/users/nf-users-table.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/users/nf-users-table.js index 73a8125679..503be4270d 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/users/nf-users-table.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/users/nf-users-table.js @@ -598,7 +598,7 @@ // not a global policy... check if user has access to the component reference return componentResourceParser(dataContext); } else { - return '' + dataContext.id + ''; + return '' + nfCommon.escapeHtml(dataContext.id) + ''; } }; @@ -774,7 +774,7 @@ markup += '
'; } - markup += dataContext.component.identity; + markup += nfCommon.escapeHtml(dataContext.component.identity); return markup; }; @@ -783,11 +783,11 @@ var membersGroupsFormatter = function (row, cell, value, columnDef, dataContext) { if (dataContext.type === 'group') { return 'Members: ' + dataContext.component.users.map(function (user) { - return user.component.identity; + return nfCommon.escapeHtml(user.component.identity); }).join(', ') + ''; } else { return 'Member of: ' + dataContext.component.userGroups.map(function (group) { - return group.component.identity; + return nfCommon.escapeHtml(group.component.identity); }).join(', ') + ''; } };