Security: prevent blind SSRF-attacks #295
3 changed files with 9 additions and 12 deletions
|
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
## Security
|
## 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.
|
- Ensure that tokens are not leaked to clients or logs.
|
||||||
|
|
||||||
- Return generic error messages for authentication failures to prevent
|
- Return generic error messages for authentication failures to prevent
|
||||||
|
|
|
||||||
|
|
@ -299,17 +299,13 @@ configured location or from the optional parameter `url`.
|
||||||
|
|
||||||
.. code-block::
|
.. 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.,
|
configuration will become effective immediately, i.e.,
|
||||||
the next read request in the collection will use the new policy information.
|
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.
|
The use of the endpoint requires a CURATOR token.
|
||||||
|
|
||||||
in a collection configuration with ``policy_info_location``, which
|
in a collection configuration with ``policy_info_location``, which
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,6 @@ async def server() -> ServerResponse:
|
||||||
async def reload_configured_policy(
|
async def reload_configured_policy(
|
||||||
collection: str,
|
collection: str,
|
||||||
api_key: Annotated[str | None, Depends(api_key_header_scheme)],
|
api_key: Annotated[str | None, Depends(api_key_header_scheme)],
|
||||||
url: str | None = None,
|
|
||||||
):
|
):
|
||||||
configuration = get_config()
|
configuration = get_config()
|
||||||
instance_state = get_instance_state()
|
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}.',
|
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:
|
if not url:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=HTTP_400_BAD_REQUEST,
|
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):
|
with wrap_http_exception(ConfigError):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue