adminforth 4.12.3 → 4.12.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -335,6 +335,32 @@ export function verySimpleHash(str: string): string {
335
335
 
336
336
  export { humanifySize } from '../afcl/fileSize';
337
337
 
338
+ const PROTECT_AGAINST_XSS_MOVED = `protectAgainstXSS is no longer exported from '@/utils'. It moved to its own module, so DOMPurify is loaded only by the components which sanitize HTML and not on the first screen of every page.
339
+
340
+ Until you change the import, the HTML is shown as plain text with its tags escaped, not rendered.
341
+
342
+ In your custom component replace
343
+ import { protectAgainstXSS } from '@/utils';
344
+ with
345
+ import { protectAgainstXSS } from '@/utils/protectAgainstXSS';
346
+
347
+ If the same import also brings other helpers, keep them in the '@/utils' import and move only protectAgainstXSS, e.g.
348
+ import { callApi, protectAgainstXSS } from '@/utils';
349
+ becomes
350
+ import { callApi } from '@/utils';
351
+ import { protectAgainstXSS } from '@/utils/protectAgainstXSS';`;
352
+
353
+ /**
354
+ * @deprecated import it from '@/utils/protectAgainstXSS'. Re-exporting the real one here would put DOMPurify back into the
355
+ * first screen, its module runs code when it loads. TODO next major: remove this stub.
356
+ */
357
+ export function protectAgainstXSS(value: string): string {
358
+ console.error(PROTECT_AGAINST_XSS_MOVED);
359
+ // never hand the unsanitized HTML back, show it as text instead
360
+ const el = document.createElement('div');
361
+ el.textContent = value;
362
+ return el.innerHTML;
363
+ }
338
364
 
339
365
  export function isPolymorphicColumn(column: any): boolean {
340
366
  return !!(column.foreignResource?.polymorphicResources && column.foreignResource.polymorphicResources.length > 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "4.12.3",
3
+ "version": "4.12.4",
4
4
  "description": "OpenSource Agent-Native forth-generation admin panel",
5
5
  "keywords": [
6
6
  "adminforth",