Details
Description
I created a view in the database and created a feature type for that view.
After that I deleted the view.
When performing a WFS request on that feature type, instead of getting a (generic) error, I get an error with the precise SQL query that was being performed!
Why does an error in the backend result in the backend being exposed in the front-end!
This is a serious security bug and should never have allowed to happen!
When an error occurs on the backend, it should be logged and the requester (client) should be notified with an (nice) error message of geoserver (a code with/out a description) that briefly describes the kind of error that has occured, but not the actual error.
So I would like to see this:
<?xml version="1.0" ?>
<ServiceExceptionReport
version="1.2.0"
xmlns="http://www.opengis.net/ogc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/wfs/1.0.0/OGC-exception
.xsd">
<ServiceException>
error:GEOS12345: Could not request the data from the system
</ServiceException></ServiceExceptionReport>
Instead of the current response:
<?xml version="1.0" ?>
<ServiceExceptionReport
version="1.2.0"
xmlns="http://www.opengis.net/ogc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/wfs/1.0.0/OGC-exception
.xsd">
<ServiceException>
error:Translator error
Translator error
Error reading Features
Could not aquire feature:org.geotools.data.DataSourceException: Error Performing SQL query: SELECT "
;NAME", "CENTRE" FROM "VIEW" WHERE "NAME" = &apos
;GEM_CENTRE'
Error Performing SQL query: SELECT "NAME", "CENTRE" FROM "VIEW
" WHERE "NAME" = 'GEM_CENTRE'
ORA-00942: Tabel of view bestaat niet.
</ServiceException></ServiceExceptionReport>
This cannot be critical for the project as a whole, since you're the only one that reported it in years, and error reporting has always been like this.
I understand it's critical for you, in that case if you need a swift fix either provide it, or have someone code a fix for you. I won't be easy, since there is no way to tell, given an exception, what the contents of the message might be. An easy solution would be to raise a flag that just reports back a generic error message, without telling the user what was wrong (invalid query, uknown feature type, and so on).
A slightly better patch could check the chain of causes in the exception and avoid reporting the problem if a SQLException is in the mix.