-
Notifications
You must be signed in to change notification settings - Fork 1
2 new endpoints and a solved bug #29
base: master
Are you sure you want to change the base?
Conversation
bartverhaar
commented
May 6, 2020
- Endpoint for OIV data
- Endpoint for authorized connection with geoserver
- Solved bug loosing password after chaning user
- solved bug password loss after changing a user - add endpoint for authorized connection with geoserver
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR contains 3 changes, split these into 3 PR's.
I don't think adding a generic proxy for securing WMS'es like this is a good idea, especially not implemented as simple as this and that with two glaring security problems.
} | ||
|
||
private static JSONArray objectsJson (Connection c) throws Exception { | ||
List<Map<String,Object>> rows = DB.oivQr().query("select id " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Connection c
is not used
"from objecten.view_objectgegevens" | ||
, new MapListHandler()); | ||
|
||
Set<Integer> layerIds = new HashSet(DB.oivQr().query("select object_id " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Connection c
is not used
Integer object_id = (Integer)row.get("id"); | ||
JSONObject object = rowToJson(row, true, true); | ||
if(layerIds.contains(object_id)) { | ||
object.put("heeft_verdiepingen", true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just do this in SQL?
} | ||
|
||
private static JSONObject objectJson (Connection c, int id) throws Exception { | ||
List<Map<String,Object>> rows = DB.oivQr().query("select basic.id " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Connection c
is not used
|
||
private static JSONObject objectJson (Connection c, int id) throws Exception { | ||
List<Map<String,Object>> rows = DB.oivQr().query("select basic.id " + | ||
" , '' as oms_nummer " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This huge SQL string is ugly, move to SQL
} | ||
|
||
out.flush(); | ||
out.close(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be in finally
@@ -0,0 +1,2 @@ | |||
ALTER TABLE organisation.wms ADD auth varchar NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Security: this is leaked to the client in /viewer/api/organisation.json
out += "&" + paramName + "="; | ||
for (int i = 0; i < paramValues.length; i++) { | ||
String paramValue = paramValues[i]; | ||
out += paramValue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concatenating multiple parameter values is not how it works. This turns ?a=1&a=2&a=3 into a=123
out += "&" + paramName + "="; | ||
for (int i = 0; i < paramValues.length; i++) { | ||
String paramValue = paramValues[i]; | ||
out += paramValue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not URL encode parameter values
if(path != null) { | ||
String geoserverUrl = handleParams(getContext().getRequest()).replace("&path=" + path + "&url=", ""); | ||
URL url = new URL (geoserverUrl); | ||
HttpURLConnection connection = (HttpURLConnection) url.openConnection(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Security: this is an open proxy: /viewer/api/geoserver/get?url=https://www.google.com/