不要怂,就是干,撸起袖子干!

Commit 1b4af001 by Sushant Committed by Mick Hansen

mysql GEOMETRY / GEOGRAPHY injection case (#6305)

1 parent c592dc72
...@@ -882,8 +882,8 @@ inherits(GEOMETRY, ABSTRACT); ...@@ -882,8 +882,8 @@ inherits(GEOMETRY, ABSTRACT);
GEOMETRY.prototype.key = GEOMETRY.key = 'GEOMETRY'; GEOMETRY.prototype.key = GEOMETRY.key = 'GEOMETRY';
GEOMETRY.prototype.escape = false; GEOMETRY.prototype.escape = false;
GEOMETRY.prototype._stringify = function _stringify(value) { GEOMETRY.prototype._stringify = function _stringify(value, options) {
return 'GeomFromText(\'' + Wkt.convert(value) + '\')'; return 'GeomFromText(' + options.escape(Wkt.convert(value)) + ')';
}; };
/** /**
...@@ -905,8 +905,8 @@ inherits(GEOGRAPHY, ABSTRACT); ...@@ -905,8 +905,8 @@ inherits(GEOGRAPHY, ABSTRACT);
GEOGRAPHY.prototype.key = GEOGRAPHY.key = 'GEOGRAPHY'; GEOGRAPHY.prototype.key = GEOGRAPHY.key = 'GEOGRAPHY';
GEOGRAPHY.prototype.escape = false; GEOGRAPHY.prototype.escape = false;
GEOGRAPHY.prototype._stringify = function _stringify(value) { GEOGRAPHY.prototype._stringify = function _stringify(value, options) {
return 'GeomFromText(\'' + Wkt.convert(value) + '\')'; return 'GeomFromText(' + options.escape(Wkt.convert(value)) + ')';
}; };
for (const helper of Object.keys(helpers)) { for (const helper of Object.keys(helpers)) {
......
...@@ -197,6 +197,18 @@ describe(Support.getTestDialectTeaser('Model'), function() { ...@@ -197,6 +197,18 @@ describe(Support.getTestDialectTeaser('Model'), function() {
} }
}); });
}); });
it('should properly escape the single quotes in coordinates', function () {
return this.Model.create({
location: {
type: "Point",
properties: {
exploit: "'); DELETE YOLO INJECTIONS; -- "
},
coordinates: [39.807222,"'); DELETE YOLO INJECTIONS; --"]
}
});
});
}); });
} }
}); });
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!