-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HTML-escape inputs before templating (#155)
* Jinja filter * Sanitize values before templating into map page There was an XSS vulnerability allowing script tags to be injected via the item or collection parameters, causing client side execution. Both values are sanitized to avoid this vulnerability. * Remove unused template An unused template from the previous hard-coded mosaic era. Removing as it does contain an XSS vulnerability were it to be reused.
- Loading branch information
1 parent
26a67e1
commit 7dec823
Showing
5 changed files
with
81 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,63 @@ | ||
<html lang="en"> | ||
<head> | ||
<head> | ||
<title>Planetary Computer STAC Item Preview</title> | ||
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" | ||
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A==" | ||
crossorigin="" /> | ||
</head> | ||
|
||
<body> | ||
<div id="map" style="position:fixed;right:0px;left:0px;height:100%;"> | ||
</div> | ||
<script src="https://unpkg.com/[email protected]/dist/leaflet.js" | ||
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA==" | ||
crossorigin=""> | ||
</script> | ||
<link | ||
rel="stylesheet" | ||
href="https://unpkg.com/[email protected]/dist/leaflet.css" | ||
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A==" | ||
crossorigin="" | ||
/> | ||
</head> | ||
|
||
<body> | ||
<div | ||
id="map" | ||
style="position: fixed; right: 0px; left: 0px; height: 100%" | ||
></div> | ||
<script | ||
src="https://unpkg.com/[email protected]/dist/leaflet.js" | ||
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA==" | ||
crossorigin="" | ||
></script> | ||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> | ||
<script> | ||
|
||
$.ajax({ | ||
url: '{{ tileJson|safe }}', | ||
success: function (tileJson) { | ||
var map = L.map('map', { | ||
center: [tileJson.center[1], tileJson.center[0]], | ||
zoom: 13, | ||
}); | ||
var baseLayer = L.tileLayer( | ||
'https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}.png' | ||
).addTo(map); | ||
|
||
var tiles = tileJson.tiles[0]; | ||
|
||
var tileLayer = L.tileLayer(tiles, { | ||
minZoom: tileJson.minzoon, | ||
maxZoom: tileJson.maxzoom | ||
$.ajax({ | ||
url: "{{ tileJson | safe }}", | ||
success: function (tileJson) { | ||
var map = L.map("map", { | ||
center: [tileJson.center[1], tileJson.center[0]], | ||
zoom: 13, | ||
}); | ||
var baseLayer = L.tileLayer( | ||
"https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}.png" | ||
).addTo(map); | ||
|
||
var tiles = tileJson.tiles[0]; | ||
|
||
var tileLayer = L.tileLayer(tiles, { | ||
minZoom: tileJson.minzoon, | ||
maxZoom: tileJson.maxzoom, | ||
}).addTo(map); | ||
|
||
$.ajax({ | ||
url: "{{ itemUrl }}", | ||
success: function (item) { | ||
map.whenReady(function () { | ||
footprint = new L.GeoJSON(item); | ||
L.geoJSON(item, { | ||
style: { | ||
color: "#05a6f0", | ||
opacity: 0.7, | ||
fillOpacity: 0, | ||
}, | ||
}).addTo(map); | ||
|
||
$.ajax({ | ||
url: '{{ itemUrl }}', | ||
success: function (item) { | ||
map.whenReady(function () { | ||
footprint = new L.GeoJSON(item); | ||
L.geoJSON(item, { | ||
"style": { | ||
"color": "#05a6f0", | ||
"opacity": 0.7, | ||
"fillOpacity": 0, | ||
|
||
} | ||
}).addTo(map); | ||
|
||
map.fitBounds(footprint.getBounds()); | ||
}); | ||
} | ||
}); | ||
} | ||
}); | ||
map.fitBounds(footprint.getBounds()); | ||
}); | ||
}, | ||
}); | ||
}, | ||
}); | ||
</script> | ||
</body> | ||
|
||
</body> | ||
</html> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters