Skip to content

Race condition on map validation leads to invalid map creation #544

@rochoa

Description

@rochoa

It's possible to create a valid Layergroup id with an invalid MapConfig.

Give a MapConfig like:

{"layers":[{"options":{"sql":"SELECT null::geometry the_geom_webmercator"}}]}

The map backend will try store the configuration in Redis. If the configuration was not already in Redis, it will validate the MapConfig creating some renderers. However, if another request arrives before the validation has ended, it will found the Layergroup id in Redis and it will return it without any kind of validation.

I was able to reproduce the issue using GNU Parallel using:

parallel curl ::: -s -s ::: http://development.localhost.lan:8181/api/v1/map?config=%7B%22layers%22%3A%5B%7B%22options%22%3A%7B%22sql%22%3A%22SELECT+null%3A%3Ageometry+the_geom_webmercator%22%7D%7D%5D%7D http://development.localhost.lan:8181/api/v1/map?config=%7B%22layers%22%3A%5B%7B%22options%22%3A%7B%22sql%22%3A%22SELECT+null%3A%3Ageometry+the_geom_webmercator%22%7D%7D%5D%7D

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions