From 66a4f85974e73de0b54bc004f6560cd86560b631 Mon Sep 17 00:00:00 2001 From: Christian Monch Date: Sat, 17 Oct 2026 12:04:31 +0200 Subject: [PATCH] sec: prevent blind SSRF-attacks Remove the `url`-parameter from the endpoint: `GET /management/reload/policy_info/{collection}` This will prevent SSRF-attacks through this endpoint. --- CHANGELOG.md | 4 ++++ docs/configuration.rst | 10 +++------- dump_things_service/endpoints/v0/base_endpoints.py | 7 ++----- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cdbd07e..7e02ad4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Security +- Remove the `url`-parameter from the endpoint + `GET /management/reload/policy_info/{collection}`. This prevents a + blind server side request forgery. + - Ensure that tokens are not leaked to clients or logs. - Return generic error messages for authentication failures to prevent diff --git a/docs/configuration.rst b/docs/configuration.rst index e01597a..774cb74 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -299,17 +299,13 @@ configured location or from the optional parameter `url`. .. code-block:: - GET /management/reload/policy_info/{collection}?url + GET /management/reload/policy_info/{collection} -The endpoint triggers an immediate reload of a policy configuration. The new +The endpoint triggers an immediate reload of a policy configuration from the +URL given in the ``policy_info_location``-value. The new configuration will become effective immediately, i.e., the next read request in the collection will use the new policy information. -The optional parameter `url` overwrites a configured `policy_info_location`-value. -It can also be used to "attach" policy information to a collection that did -not yet define policies. If the URL or the policy information file is invalid, -no changes are made to the current policy information of the collection. - The use of the endpoint requires a CURATOR token. in a collection configuration with ``policy_info_location``, which diff --git a/dump_things_service/endpoints/v0/base_endpoints.py b/dump_things_service/endpoints/v0/base_endpoints.py index 6815131..7ee5010 100644 --- a/dump_things_service/endpoints/v0/base_endpoints.py +++ b/dump_things_service/endpoints/v0/base_endpoints.py @@ -135,7 +135,6 @@ async def server() -> ServerResponse: async def reload_configured_policy( collection: str, api_key: Annotated[str | None, Depends(api_key_header_scheme)], - url: str | None = None, ): configuration = get_config() instance_state = get_instance_state() @@ -152,13 +151,11 @@ async def reload_configured_policy( detail=f'CURATOR token is required to reload policy information in collection {collection}.', ) - if not url: - url = configuration.collections[collection].policy_info_location - + url = configuration.collections[collection].policy_info_location if not url: raise HTTPException( status_code=HTTP_400_BAD_REQUEST, - detail=f"No policy_info_location configured for collection '{collection}' and no URL provided.", + detail=f"No policy_info_location configured for collection '{collection}'.", ) with wrap_http_exception(ConfigError): -- 2.54.1