Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit 1b4af001
authored
Jul 20, 2016
by
Sushant
Committed by
Mick Hansen
Jul 20, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mysql GEOMETRY / GEOGRAPHY injection case (#6305)
1 parent
c592dc72
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
5 deletions
lib/data-types.js
test/integration/model/geometry.test.js
lib/data-types.js
View file @
1b4af00
...
...
@@ -882,8 +882,8 @@ inherits(GEOMETRY, ABSTRACT);
GEOMETRY
.
prototype
.
key
=
GEOMETRY
.
key
=
'GEOMETRY'
;
GEOMETRY
.
prototype
.
escape
=
false
;
GEOMETRY
.
prototype
.
_stringify
=
function
_stringify
(
value
)
{
return
'GeomFromText(
\''
+
Wkt
.
convert
(
value
)
+
'\
')'
;
GEOMETRY
.
prototype
.
_stringify
=
function
_stringify
(
value
,
options
)
{
return
'GeomFromText(
'
+
options
.
escape
(
Wkt
.
convert
(
value
))
+
')'
;
};
/**
...
...
@@ -905,8 +905,8 @@ inherits(GEOGRAPHY, ABSTRACT);
GEOGRAPHY
.
prototype
.
key
=
GEOGRAPHY
.
key
=
'GEOGRAPHY'
;
GEOGRAPHY
.
prototype
.
escape
=
false
;
GEOGRAPHY
.
prototype
.
_stringify
=
function
_stringify
(
value
)
{
return
'GeomFromText(
\''
+
Wkt
.
convert
(
value
)
+
'\
')'
;
GEOGRAPHY
.
prototype
.
_stringify
=
function
_stringify
(
value
,
options
)
{
return
'GeomFromText(
'
+
options
.
escape
(
Wkt
.
convert
(
value
))
+
')'
;
};
for
(
const
helper
of
Object
.
keys
(
helpers
))
{
...
...
test/integration/model/geometry.test.js
View file @
1b4af00
...
...
@@ -177,7 +177,7 @@ describe(Support.getTestDialectTeaser('Model'), function() {
});
});
});
describe
(
'sql injection attacks'
,
function
()
{
beforeEach
(
function
()
{
this
.
Model
=
this
.
sequelize
.
define
(
'Model'
,
{
...
...
@@ -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; --"
]
}
});
});
});
}
});
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment