Skip to content

CopyHandler and MoveHandler do not check if the source and destination resources are the same resource #220

@expuss2000

Description

@expuss2000

According to RFC 4918, 403 Forbidden should be responded for a COPY/MOVE operation in case the source and destination resources are the same resource.

Section 9.8.5 about COPY Status Codes:

403 (Forbidden) - The operation is forbidden. A special case for COPY could be that the source and destination resources are the same resource.

Section 9.9.4 about MOVE Status Codes:

403 (Forbidden) - Among many possible reasons for forbidding a MOVE operation, this status code is recommended for use when the source and destination resources are the same.

This logic seems to be missing in CopyHandler and MoveHandler.

This can have serious side effects; for example, if the Overwrite header is set to T, the destination file (that is also the source) is deleted before the copy/move, effectively deleting the file.

I know that it is possible to disable the remove before move/copy in case the resource exists, but in this case the wasDeleted boolean is never set to true and 201 Created is always returned instead of the correct 204 No Content in case the destination resource was already mapped.

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