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

Conversation

Projects
None yet
2 participants
@c-w
Copy link
Member

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'
Replace escapeSql with pg built-in escaping
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 c-w requested review from anthturner and timfpark Feb 6, 2018

@c-w c-w referenced this pull request Feb 6, 2018

Closed

Reminder: Security Review #222

@c-w

This comment has been minimized.

Copy link
Member Author

commented Feb 6, 2018

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

@timfpark

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Member Author

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
You can’t perform that action at this time.