Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

v2 room deletion API relies on middleboxes not being confused by DELETE-with-body - suggesting an alternative that doesn't have that risk #11698

Closed
@shadowcat-mst

Description

@shadowcat-mst

Note my comments here are based on https://matrix-org.github.io/synapse/develop/admin_api/rooms.html#version-2-new-version as of 2022-06-01 - if things have changed since then and/or I'm looking at the wrong place, my apologies.

Initial worry that led to me filing this: DELETE-with-a-body, while -allowed- by the HTTP spec, worries me reliability wise because given it's basically also -undefined- by the spec I am willing to bet that at least some proxies and other types of middlebox will do something counterproductive with it.

Idea that I think might solve that -and- look more elegant:

There's already a 'delete_status' endpoint that provides all currently-in-flight deletions for a room and additionally a 'delete_status/$deletion_id' endpoint that allows checking a specific one.

It seems to me that this would be a perfect case for a RESTy collection style API - i.e.

Step 1: rename 'delete_status' to 'deletions', otherwise maintaining current semantics

Step 2: switch the current DELETE call to being a POST to 'deletions' (with, otherwise, the same basic structure) to indicate that its goal is to create a new deletion.

Step 2a: Make the POST response be a 'Created' status and provide a Location: header to the 'deletions/$deletion_id' resource that is currently being served as 'delete_status/$deletion_id' (without changing the { deletion_id: $deletion_id } JSON return, mind, that's useful too)

I'm far from a REST zealot, but this seems like both a slightly more elegant API and also one that's more robust against unfortunate middleboxes.

(no reason you couldn't also keep the current DELETE for a while (and delete_status as a URL) to allow clients already using that to switch across, though simply for the reliability reason I'd suggest that if this suggestion if accepted it should be removed before v2 goes gold so everybody these the less-likely-to-break POST .../deletions approach instead)

Metadata

Metadata

Assignees

No one assigned

    Labels

    S-MinorBlocks non-critical functionality, workarounds exist.T-DefectBugs, crashes, hangs, security vulnerabilities, or other reported issues.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions