Conversation
Revised resource permission check based on IP addresses.
afabiani
left a comment
There was a problem hiding this comment.
Other than the other inline comments, can we add tests both direct and rest, demonstrating that it is not possible to inject invalid ip ranges on the security rules? Put particular attention to SQL injection.
doc/sql/migration/postgresql/postgresql-migration-from-v.2.3.0-to-v2.4.0.sql
Outdated
Show resolved
Hide resolved
src/core/model/src/main/java/it/geosolutions/geostore/core/model/IPRange.java
Show resolved
Hide resolved
src/core/model/src/main/java/it/geosolutions/geostore/core/model/IPRange.java
Outdated
Show resolved
Hide resolved
src/core/model/src/main/java/it/geosolutions/geostore/core/model/IPRange.java
Outdated
Show resolved
Hide resolved
src/core/model/src/main/java/it/geosolutions/geostore/core/model/IPRange.java
Show resolved
Hide resolved
src/core/model/src/main/java/it/geosolutions/geostore/core/model/User.java
Show resolved
Hide resolved
src/core/model/src/main/java/it/geosolutions/geostore/core/model/UserGroup.java
Show resolved
Hide resolved
src/core/model/src/main/java/it/geosolutions/geostore/core/model/User.java
Show resolved
Hide resolved
src/core/model/src/main/java/it/geosolutions/geostore/core/model/UserGroup.java
Show resolved
Hide resolved
The CIDR validation is performed during the conversion of the ReST DAO from the incoming request. Additionally, an extra CIDR validation has been added inside the security rule update logic in the There is no SQL injection risk here because the DAO’s |
These changes implements the functionality nedeed on MapStore to limit read/write permission on resources by reqesting user's IP address.
The endpoint that permits to specify the new constraint on resources is
/rest/resources/resource/{resourceId}/permissions, that now is capable to handle a permission model like the following:As per the example, an user with an IP address like
127.1.2.3would have complete access to the resource, since thecanReadandcanWritevalues aretrue.Conversely, an user with IP
192.168.1.2, even with the read and write permissions, would not be able to access the resource, so a call toGET rest/extjs/resource/{resourceId}?includePermissions=truewill return403error.Documentation updated to describe this new functionality: