Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace escapeSql with pg built-in escaping #22

Merged
merged 1 commit into from Feb 7, 2018
Merged

Replace escapeSql with pg built-in escaping #22

merged 1 commit into from Feb 7, 2018

Conversation

@c-w
Copy link
Contributor

@c-w c-w commented Feb 6, 2018

In CatalystCode/project-fortis-pipeline#222 we discovered another set of SQL-injection attack vectors for the feature service. This commit fixes potential injection vulnerabilities once and for all by switching all queries to using the postgres built-in parameter interpolation mechanism instead of using string queries.

The changes were validated by calling the following routes which should be roughly representative of the entire functionality space of the featureService:

curl 'localhost:8080/features/name/paris'
curl 'localhost:8080/features/name/bogota,paris'
curl 'localhost:8080/features/id/wof-85971971'
curl 'localhost:8080/features/id/wof-404477281,wof-85971971'
curl 'localhost:8080/features/point/40.71/74.0'
curl 'localhost:8080/features/bbox/47/5/35/10'
curl 'localhost:8080/features/bbox/47/5/35/10?filter_name=Saint&filter_layer=campus'
In CatalystCode/project-fortis-pipeline#222 we
discovered another set of SQL-injection attack vectors for the feature
service. This commit fixes potential injection vulnerabilities once and
for all by switching all queries to using the postgres built-in
parameter interpolation mechanism instead of using string queries.

The changes were validated by calling the following routes which should
be roughly representative of the entire functionality space of the
featureService:

```sh
curl 'localhost:8080/features/name/paris'
curl 'localhost:8080/features/name/bogota,paris'
curl 'localhost:8080/features/id/wof-85971971'
curl 'localhost:8080/features/id/wof-404477281,wof-85971971'
curl 'localhost:8080/features/point/40.71/74.0'
curl 'localhost:8080/features/bbox/47/5/35/10'
curl 'localhost:8080/features/bbox/47/5/35/10?filter_name=Saint&filter_layer=campus'
```
@c-w
Copy link
Contributor Author

@c-w c-w commented Feb 6, 2018

Bringing this to the attention of @stewartadam who found the vulnerability.

@timfpark
Copy link
Contributor

@timfpark timfpark commented Feb 7, 2018

Thanks Clemens - looks great.

@c-w c-w merged commit 4bc15ac into master Feb 7, 2018
@c-w c-w deleted the escapesql branch Feb 7, 2018
@c-w
Copy link
Contributor Author

@c-w c-w commented Feb 7, 2018

Changes merged and deployed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants