Преглед изворни кода

[editor] Sanitize contents when copying results to the clipboard

Johan Åhlén пре 2 година
родитељ
комит
24152239c7

+ 4 - 1
desktop/core/src/desktop/js/utils/html/html2text.ts

@@ -14,9 +14,12 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+import deXSS from './deXSS';
+
 const html2text = (value: string): string => {
   const element = document.createElement('div');
-  element.innerHTML = value;
+  const clean = deXSS(value);
+  element.innerHTML = clean;
   return element.innerText.replace(/\u00A0/g, ' ');
 };
 

+ 1 - 1
desktop/core/src/desktop/templates/common_notebook_ko_components.mako

@@ -414,7 +414,7 @@ else:
                 }
                 result += '</tr>';
               });
-              $('.clipboard-content').html(result);
+              $('.clipboard-content').html(hueUtils.deXSS(result));
             } else {
               $('.clipboard-content').html(window.I18n('Error while copying results.'));
             }