@geogirafe/lib-geoportal 1.1.0-dev.2593857917 → 1.1.0-dev.2594292854
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.
- package/components/selectiongrid/tools/selectiontabulatormanager.js +2 -1
- package/components/selectionwindow/component.js +2 -9
- package/package.json +1 -1
- package/templates/public/about.json +1 -1
- package/tools/configuration/girafeconfig.d.ts +7 -0
- package/tools/configuration/girafeconfig.js +24 -3
- package/tools/configuration/sanitizeconfig.defaults.d.ts +4 -0
- package/tools/configuration/sanitizeconfig.defaults.js +12 -0
- package/tools/main.d.ts +2 -0
- package/tools/main.js +2 -0
- package/tools/url/permalinkmanager.js +1 -4
- package/tools/utils/selection.d.ts +2 -0
- package/tools/utils/selection.js +14 -0
|
@@ -5,6 +5,7 @@ import ColumnAliasHelper from '../../../tools/utils/aliases.js';
|
|
|
5
5
|
import { linkify } from '../../../tools/utils/utils.js';
|
|
6
6
|
import { noop } from '../../../tools/utils/async.js';
|
|
7
7
|
import tippy from 'tippy.js';
|
|
8
|
+
import { sanitize } from '../../../tools/utils/selection.js';
|
|
8
9
|
const geometryColumns = new Set(['geom', 'the_geom', 'geometry']);
|
|
9
10
|
export default class SelectionTabulatorManager {
|
|
10
11
|
featureToGridData;
|
|
@@ -228,7 +229,7 @@ export default class SelectionTabulatorManager {
|
|
|
228
229
|
delete row[key];
|
|
229
230
|
}
|
|
230
231
|
else if (typeof value === 'string') {
|
|
231
|
-
row[key] = linkify(value);
|
|
232
|
+
row[key] = sanitize(linkify(value), this.context.configManager.Config);
|
|
232
233
|
}
|
|
233
234
|
}
|
|
234
235
|
}
|
|
@@ -6,9 +6,9 @@ import FeatureToGridDataById from '../../tools/featuretogriddatabyid.js';
|
|
|
6
6
|
import { getValidIndex, linkify } from '../../tools/utils/utils.js';
|
|
7
7
|
import IconCenter from './images/center.svg';
|
|
8
8
|
import ResizeWindow from '../../tools/resizewindow.js';
|
|
9
|
-
import DOMPurify from 'dompurify';
|
|
10
9
|
import CsvManager from '../../tools/export/csvmanager.js';
|
|
11
10
|
import ColumnAliasHelper from '../../tools/utils/aliases.js';
|
|
11
|
+
import { sanitize } from '../../tools/utils/selection.js';
|
|
12
12
|
/**
|
|
13
13
|
* Represents a draggable and resizable selection window component.
|
|
14
14
|
* Display itself when it should be visible and have selected features.
|
|
@@ -174,16 +174,9 @@ table{border-collapse:collapse;table-layout:auto;width:100%}td.feature-id{text-a
|
|
|
174
174
|
return keyValue[1] !== undefined;
|
|
175
175
|
});
|
|
176
176
|
this.displayedProperties.forEach((keyValue) => {
|
|
177
|
-
let config = {};
|
|
178
|
-
if (this.context.configManager.Config.query.legacy) {
|
|
179
|
-
config = {
|
|
180
|
-
ADD_ATTR: ['onclick'],
|
|
181
|
-
ADD_URI_SAFE_ATTR: ['onclick']
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
177
|
keyValue[0] = this.context.i18nManager.getTranslation(this.columnAliasHelper.getColumnAlias(windowFeature.id, keyValue[0]));
|
|
185
178
|
keyValue[1] = linkify(keyValue[1]);
|
|
186
|
-
keyValue[1] =
|
|
179
|
+
keyValue[1] = sanitize(keyValue[1], this.context.configManager.Config);
|
|
187
180
|
});
|
|
188
181
|
// Render and translate data.
|
|
189
182
|
this.render();
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"1.1.0-dev.
|
|
1
|
+
{"version":"1.1.0-dev.2594292854", "build":"2594292854", "date":"11/06/2026"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Config as SanitizeConfig } from 'dompurify';
|
|
1
2
|
declare class GirafeConfig {
|
|
2
3
|
general: {
|
|
3
4
|
locale: string;
|
|
@@ -121,6 +122,7 @@ declare class GirafeConfig {
|
|
|
121
122
|
news?: {
|
|
122
123
|
urls: string[];
|
|
123
124
|
autoDisplay: boolean;
|
|
125
|
+
sanitizeConfig?: SanitizeConfig;
|
|
124
126
|
};
|
|
125
127
|
externalLayers?: {
|
|
126
128
|
predefinedSources: {
|
|
@@ -176,6 +178,7 @@ declare class GirafeConfig {
|
|
|
176
178
|
};
|
|
177
179
|
query: {
|
|
178
180
|
legacy: boolean;
|
|
181
|
+
sanitizeConfig?: SanitizeConfig;
|
|
179
182
|
};
|
|
180
183
|
gmfauth?: {
|
|
181
184
|
url: string;
|
|
@@ -241,6 +244,9 @@ declare class GirafeConfig {
|
|
|
241
244
|
filtering?: {
|
|
242
245
|
gmfLayerMetadataUrl?: string;
|
|
243
246
|
};
|
|
247
|
+
permalink?: {
|
|
248
|
+
sanitizeConfig?: SanitizeConfig;
|
|
249
|
+
};
|
|
244
250
|
extendedConfig?: Record<string, object>;
|
|
245
251
|
static readonly DEFAULT_LOCALE = "en-US";
|
|
246
252
|
/**
|
|
@@ -281,5 +287,6 @@ declare class GirafeConfig {
|
|
|
281
287
|
private initOnboarding;
|
|
282
288
|
private initApiConfig;
|
|
283
289
|
private initConfigFiltering;
|
|
290
|
+
private initPermalinkConfig;
|
|
284
291
|
}
|
|
285
292
|
export default GirafeConfig;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { defaultNewsSanitizeConfig, defaultPermalinkSanitizeConfig, defaultQuerySanitizeConfig } from './sanitizeconfig.defaults';
|
|
2
2
|
class GirafeConfig {
|
|
3
3
|
general;
|
|
4
4
|
languages;
|
|
@@ -30,6 +30,7 @@ class GirafeConfig {
|
|
|
30
30
|
onboarding;
|
|
31
31
|
api;
|
|
32
32
|
filtering;
|
|
33
|
+
permalink;
|
|
33
34
|
// The extended configuration can be used by third-party components or extensions
|
|
34
35
|
// to add custom attributes to the GirafeConfig.
|
|
35
36
|
extendedConfig;
|
|
@@ -70,6 +71,7 @@ class GirafeConfig {
|
|
|
70
71
|
this.onboarding = this.initOnboarding(config);
|
|
71
72
|
this.api = this.initApiConfig(config);
|
|
72
73
|
this.filtering = this.initConfigFiltering(config);
|
|
74
|
+
this.permalink = this.initPermalinkConfig(config);
|
|
73
75
|
try {
|
|
74
76
|
this.search = this.initConfigSearch(config);
|
|
75
77
|
}
|
|
@@ -151,7 +153,8 @@ class GirafeConfig {
|
|
|
151
153
|
}
|
|
152
154
|
initConfigQuery(config) {
|
|
153
155
|
return {
|
|
154
|
-
legacy: config.query?.legacy ?? false
|
|
156
|
+
legacy: config.query?.legacy ?? false,
|
|
157
|
+
sanitizeConfig: config.query?.sanitizeConfig ?? defaultQuerySanitizeConfig
|
|
155
158
|
};
|
|
156
159
|
}
|
|
157
160
|
initConfigDrawing(config) {
|
|
@@ -240,7 +243,20 @@ class GirafeConfig {
|
|
|
240
243
|
return config.lidar;
|
|
241
244
|
}
|
|
242
245
|
initConfigNews(config) {
|
|
243
|
-
|
|
246
|
+
if (config.news?.sanitizeConfig) {
|
|
247
|
+
return config.news;
|
|
248
|
+
}
|
|
249
|
+
else if (config.news) {
|
|
250
|
+
return {
|
|
251
|
+
...config.news,
|
|
252
|
+
sanitizeConfig: defaultNewsSanitizeConfig
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
return {
|
|
256
|
+
urls: [],
|
|
257
|
+
autoDisplay: false,
|
|
258
|
+
sanitizeConfig: defaultNewsSanitizeConfig
|
|
259
|
+
};
|
|
244
260
|
}
|
|
245
261
|
initConfigCsv(config) {
|
|
246
262
|
const defaultConfig = {
|
|
@@ -421,5 +437,10 @@ class GirafeConfig {
|
|
|
421
437
|
}
|
|
422
438
|
return config.filtering ?? undefined;
|
|
423
439
|
}
|
|
440
|
+
initPermalinkConfig(config) {
|
|
441
|
+
return config.permalink ?? {
|
|
442
|
+
sanitizeConfig: defaultPermalinkSanitizeConfig
|
|
443
|
+
};
|
|
444
|
+
}
|
|
424
445
|
}
|
|
425
446
|
export default GirafeConfig;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const defaultNewsSanitizeConfig = {
|
|
2
|
+
USE_PROFILES: { html: true },
|
|
3
|
+
FORBID_TAGS: ['style', 'script', 'iframe', 'object', 'embed'],
|
|
4
|
+
FORBID_ATTR: ['style', 'onerror', 'onload', 'onclick']
|
|
5
|
+
};
|
|
6
|
+
export const defaultPermalinkSanitizeConfig = {
|
|
7
|
+
ALLOWED_TAGS: ['br', 'b', 'div', 'em', 'i', 'p', 'strong'],
|
|
8
|
+
ALLOWED_ATTR: []
|
|
9
|
+
};
|
|
10
|
+
export const defaultQuerySanitizeConfig = {
|
|
11
|
+
ALLOWED_TAGS: ['iframe', 'a', 'img']
|
|
12
|
+
};
|
package/tools/main.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export { default as OpenIdConnectManager } from './auth/openidconnectmanager.js'
|
|
|
10
10
|
export { default as PluginManager } from './auth/pluginmanager.js';
|
|
11
11
|
export { default as ConfigManager } from './configuration/configmanager.js';
|
|
12
12
|
export { default as GirafeConfig } from './configuration/girafeconfig.js';
|
|
13
|
+
export { defaultNewsSanitizeConfig, defaultPermalinkSanitizeConfig, defaultQuerySanitizeConfig } from './configuration/sanitizeconfig.defaults';
|
|
13
14
|
export { default as GirafeContext } from './context/context.js';
|
|
14
15
|
export type { default as IGirafeContext } from './context/icontext.js';
|
|
15
16
|
export { default as CesiumDrawing } from './drawing/cesiumDrawing.js';
|
|
@@ -120,6 +121,7 @@ export { default as GirafeColorPicker } from './utils/girafecolorpicker.js';
|
|
|
120
121
|
export { unByKeyAll, getOlayerByName, removeUnwantedOlParams, polygonFromCircle, getDistance, getAreaOfPolygon, getAreaOfCircle, isCoordinateInDegrees, getSelectionBoxFromMapClick, reprojectGeometry, ensurePolygonIsProperlyClosed, getHalfPoint, getLabelStyle, getRadiusDataForCircle, getLengthAsMetricText, getAreaAsMetricText, getAzimuthAsText } from './utils/olutils.js';
|
|
121
122
|
export { getPropertyByPath, setPropertyByPath, createObjectFromPath, deletePropertyByPath, mergeObjects } from './utils/pathUtils.js';
|
|
122
123
|
export { generateQrCode } from './utils/qrcode.js';
|
|
124
|
+
export { sanitize } from './utils/selection.js';
|
|
123
125
|
export { default as ServiceWorkerHelper } from './utils/swhelper.js';
|
|
124
126
|
export { systemIsInDarkMode, isSafari, isFirefox, getValidIndex, minMax, hexToRgbaArray, rgbStrToRgbaArray, colorToRgbaArray, isValidEmail, applyOpacityToLayers, applyFeaturesToSelection, linkify, applyDefaultPrefixToUrl, splitTrimAndConvertToNumber } from './utils/utils.js';
|
|
125
127
|
export { default as VendorSpecificOgcServerManager } from './vendorspecificogcservermanager.js';
|
package/tools/main.js
CHANGED
|
@@ -10,6 +10,7 @@ export { default as OpenIdConnectManager } from './auth/openidconnectmanager.js'
|
|
|
10
10
|
export { default as PluginManager } from './auth/pluginmanager.js';
|
|
11
11
|
export { default as ConfigManager } from './configuration/configmanager.js';
|
|
12
12
|
export { default as GirafeConfig } from './configuration/girafeconfig.js';
|
|
13
|
+
export { defaultNewsSanitizeConfig, defaultPermalinkSanitizeConfig, defaultQuerySanitizeConfig } from './configuration/sanitizeconfig.defaults';
|
|
13
14
|
export { default as GirafeContext } from './context/context.js';
|
|
14
15
|
export { default as CesiumDrawing } from './drawing/cesiumDrawing.js';
|
|
15
16
|
export { default as DrawingFeature } from './drawing/drawingFeature.js';
|
|
@@ -93,6 +94,7 @@ export { default as GirafeColorPicker } from './utils/girafecolorpicker.js';
|
|
|
93
94
|
export { unByKeyAll, getOlayerByName, removeUnwantedOlParams, polygonFromCircle, getDistance, getAreaOfPolygon, getAreaOfCircle, isCoordinateInDegrees, getSelectionBoxFromMapClick, reprojectGeometry, ensurePolygonIsProperlyClosed, getHalfPoint, getLabelStyle, getRadiusDataForCircle, getLengthAsMetricText, getAreaAsMetricText, getAzimuthAsText } from './utils/olutils.js';
|
|
94
95
|
export { getPropertyByPath, setPropertyByPath, createObjectFromPath, deletePropertyByPath, mergeObjects } from './utils/pathUtils.js';
|
|
95
96
|
export { generateQrCode } from './utils/qrcode.js';
|
|
97
|
+
export { sanitize } from './utils/selection.js';
|
|
96
98
|
export { default as ServiceWorkerHelper } from './utils/swhelper.js';
|
|
97
99
|
export { systemIsInDarkMode, isSafari, isFirefox, getValidIndex, minMax, hexToRgbaArray, rgbStrToRgbaArray, colorToRgbaArray, isValidEmail, applyOpacityToLayers, applyFeaturesToSelection, linkify, applyDefaultPrefixToUrl, splitTrimAndConvertToNumber } from './utils/utils.js';
|
|
98
100
|
export { default as VendorSpecificOgcServerManager } from './vendorspecificogcservermanager.js';
|
|
@@ -122,10 +122,7 @@ export default class PermalinkManager extends GirafeSingleton {
|
|
|
122
122
|
}
|
|
123
123
|
addTooltip(position) {
|
|
124
124
|
if (this.hasToolTip()) {
|
|
125
|
-
const content = DOMPurify.sanitize(this.params['map_tooltip'],
|
|
126
|
-
ALLOWED_TAGS: ['br', 'b', 'div', 'em', 'i', 'p', 'strong'],
|
|
127
|
-
ALLOWED_ATTR: []
|
|
128
|
-
});
|
|
125
|
+
const content = DOMPurify.sanitize(this.params['map_tooltip'], this.context.configManager.Config.permalink?.sanitizeConfig);
|
|
129
126
|
position.tooltip = {
|
|
130
127
|
content: content,
|
|
131
128
|
position: position.center
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import DOMPurify from 'dompurify';
|
|
2
|
+
export const sanitize = (unsanitized, config) => {
|
|
3
|
+
let sanitizeConfig = {
|
|
4
|
+
...config.query.sanitizeConfig
|
|
5
|
+
};
|
|
6
|
+
if (config.query.legacy) {
|
|
7
|
+
sanitizeConfig = {
|
|
8
|
+
...sanitizeConfig,
|
|
9
|
+
ADD_ATTR: ['onclick'],
|
|
10
|
+
ADD_URI_SAFE_ATTR: ['onclick']
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
return DOMPurify.sanitize(unsanitized, sanitizeConfig);
|
|
14
|
+
};
|