WFS ignores disabling of stores

Description

WFS service URLs for PostGIS and shapefiles data stores (and presumably others) continue to work even when these stores are disabled.

WMS service requests for a feature type from a disabled store fail with: java.io.IOException: featureType: test:bugsites does not have a properly configured datastore at org.geoserver.wms.MapLayerInfo.getFeatureSource(MapLayerInfo.java:311)

Looks quite similar to (for disabled layers):

WFS/WCS ignores disabling of layers
https://osgeo-org.atlassian.net/browse/GEOS-6538
https://github.com/geoserver/geoserver/commit/8eb8c6b1eec9c70d0c50fd74e628f0cbc7a12ae0

See original user report:
http://osgeo-org.1560.x6.nabble.com/Re-Null-namespace-in-WFS-response-for-layer-based-on-disabled-PostGIS-store-SEC-UNCLASSIFIED-td5290112.html

Environment

None

Activity

Ben Caradoc-Davies 
October 18, 2016 at 11:05 PM

Cherry-picked on to 2.10.x and 2.9.x for inclusion in 2.10.0 and 2.9.3 respectively.

Ben Caradoc-Davies 
October 18, 2016 at 10:12 PM

Merged on master:
https://github.com/geoserver/geoserver/pull/1885

Note that the updated fix:
(1) adds a finally block to ensure that the test fixture state is restored, and
(2) changes the getSecurityFilter logic to apply the shouldApplyFilter test to both layers and resources.

Ben Caradoc-Davies 
October 17, 2016 at 12:34 AM
(edited)

Manual testing on master (GeoServer running under Jetty from Eclipse) indicates that this change fixes the bug, for shapefiles and PostGIS, for WFS 1.0, 1.1, and 2.0.

Ben Caradoc-Davies 
October 17, 2016 at 12:10 AM

Pull request for master:
https://github.com/geoserver/geoserver/pull/1885

This PR implements both the simple and getSecurityFilter changes proposed by Andrea (or rather, my understanding of them!). Note that the getSecurityFilter change does not fix the bug by itself. I would also like some feedback on the shouldApplyFilter logic; see the Jira comment above for details. This PR leaves the shouldApplyFilter logic as-is. I am happy to change it based on feedback.

This PR also fixes WFS 2.0 GetFeatureJoinTest and GetFeaturePagingTest, which were running with disabled stores.

Ben Caradoc-Davies 
October 16, 2016 at 11:30 PM

Andrea,

I have a question about your intent in DisabledResourceFilter.getSecurityFilter which contains:

Should this be:

or are you trying to apply the security filter to resources unconditionally? I do not know whether this is a logic error or because OGC services only access layers and not resources and so you do not want shouldApplyFilter to control access to resources.

Kind regards,
Ben.

Fixed

Details

Assignee

Reporter

Affects versions

Components

Priority

Created October 11, 2016 at 3:15 AM
Updated October 18, 2016 at 11:06 PM
Resolved October 18, 2016 at 11:06 PM