[Mapbender-commits] r10206 - in trunk/mapbender/http: javascripts plugins

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Aug 12 22:57:52 PDT 2019


Author: hollsandre
Date: 2019-08-12 22:57:52 -0700 (Mon, 12 Aug 2019)
New Revision: 10206

Modified:
   trunk/mapbender/http/javascripts/mod_savewmc.js
   trunk/mapbender/http/plugins/kmlTree.php
Log:
added javascript input validation for mapviewer

Modified: trunk/mapbender/http/javascripts/mod_savewmc.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_savewmc.js	2019-08-13 03:27:58 UTC (rev 10205)
+++ trunk/mapbender/http/javascripts/mod_savewmc.js	2019-08-13 05:57:52 UTC (rev 10206)
@@ -360,6 +360,12 @@
 			attributes.abstract = $("#" + options.id + "_wmcabstract").val();
 			attributes.keywords = $("#" + options.id + "_wmckeywords").val();
 			attributes.isoTopicCat = isoTopicCat;
+
+			if(!attributes.title.match(/^[a-zA-Z0-9]+$/) || !attributes.abstract.match(/^[a-zA-Z0-9]+$/) || !attributes.keywords.match(/^[a-zA-Z0-9]+$/)){
+                               alert("Allowed characters are: A-Z, a-z, 0-9, -, _");
+                               return;
+                        }
+
 			if (!!attributes.title) {
 				sendMapDataToServer(attributes, 0, (function(result, status, message) {
 					alert(message);

Modified: trunk/mapbender/http/plugins/kmlTree.php
===================================================================
--- trunk/mapbender/http/plugins/kmlTree.php	2019-08-13 03:27:58 UTC (rev 10205)
+++ trunk/mapbender/http/plugins/kmlTree.php	2019-08-13 05:57:52 UTC (rev 10206)
@@ -569,7 +569,10 @@
                 var version = 'v1'
                 if (title == '') {
                     return;
-                }
+                } else if (!title.match(/^[a-zA-Z0-9-_]+$/)){
+			alert("Allowed characters are: A-Z, a-z, 0-9, -, _");
+			return;
+		}
                 kml.addLayer(title, {
                     uuid: UUID.genV4().toString(),
                     created: new Date().toISOString(),



More information about the Mapbender_commits mailing list