Re: COPY: "Duplicate" functionality

Daurnimator <quae@daurnimator.com> Fri, 09 December 2016 04:20 UTC

Return-Path: <ietf-http-wg-request+bounce-httpbisa-archive-bis2juki=lists.ie@listhub.w3.org>
X-Original-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Delivered-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 98C88129644 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Thu, 8 Dec 2016 20:20:39 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -9.897
X-Spam-Level:
X-Spam-Status: No, score=-9.897 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.001, RCVD_IN_DNSWL_HI=-5, RP_MATCHES_RCVD=-2.896, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=daurnimator.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OdRIrC8ovvaB for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Thu, 8 Dec 2016 20:20:38 -0800 (PST)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id E885612963D for <httpbisa-archive-bis2Juki@lists.ietf.org>; Thu, 8 Dec 2016 20:20:37 -0800 (PST)
Received: from lists by frink.w3.org with local (Exim 4.80) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1cFCcK-0003Wi-OW for ietf-http-wg-dist@listhub.w3.org; Fri, 09 Dec 2016 04:17:04 +0000
Resent-Date: Fri, 09 Dec 2016 04:17:04 +0000
Resent-Message-Id: <E1cFCcK-0003Wi-OW@frink.w3.org>
Received: from titan.w3.org ([128.30.52.76]) by frink.w3.org with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from <quae@daurnimator.com>) id 1cFCc8-0003Vp-UA for ietf-http-wg@listhub.w3.org; Fri, 09 Dec 2016 04:16:52 +0000
Received: from mail-wj0-f179.google.com ([209.85.210.179]) by titan.w3.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <quae@daurnimator.com>) id 1cFCc2-0001Dv-LS for ietf-http-wg@w3.org; Fri, 09 Dec 2016 04:16:47 +0000
Received: by mail-wj0-f179.google.com with SMTP id xy5so4795794wjc.0 for <ietf-http-wg@w3.org>; Thu, 08 Dec 2016 20:16:25 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daurnimator.com; s=daurnimator; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=AMUDCZ0igzY6L5yj/nNTZDmPoIVGpw6gxE19robIDso=; b=DT26dzPBe998cxVX4YAVVHR6Z35e1vjL9oIMgDo2kYJpZY8m3e+L0t8XJv3bWmc+BU 8AiNA91AIMMYPnkhGMEBn10P+xalwrXLRZNL9zJVv1yFOcMl/40O3J5lkiy8DXDou0l4 aDyIQ4mlPiZsljVI5A2vedPZubig6AumYEq8I=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=AMUDCZ0igzY6L5yj/nNTZDmPoIVGpw6gxE19robIDso=; b=OIlPF/tYwhSudZy2tM6z7UV5uLJ3MIZA9wzEcHvqM9CHediM4//axuKWXlJW4gG5e/ 8wwkB81DQ/JkCkyRMJTxAU9ElYvfyTmSh/IvWT6VsdAa0agy5uPoymeRq/oGMH6JbHgm S3ZbNymUdIouC0hHQtKAz4HJ9LSEdr4KPj4JQjIIRzjsduPkHX8+JcB7Ho3Z3e6oSphx SnPcKK74hPC6vdgi9EDtyN9S+mw8kIubMThNsdc38cn/w7EIMMzyoYKGNvyk6L4vaJ+3 fpMuTEfcTT8LKsZiOdr8VbZfypSf7EvgweEOhXw18vEpFXJzYvliIlHmrPzuZ3vWobzA T1uw==
X-Gm-Message-State: AKaTC01sSzkem6q2vfQFD5mnVdnP/URZlZ9NLGK+K2OsvFJMMGfYqQ9FyeqTRRKTJSOg7g==
X-Received: by 10.194.31.167 with SMTP id b7mr75600558wji.168.1481256979199; Thu, 08 Dec 2016 20:16:19 -0800 (PST)
Received: from mail-wm0-f49.google.com (mail-wm0-f49.google.com. [74.125.82.49]) by smtp.gmail.com with ESMTPSA id t82sm18390789wmd.17.2016.12.08.20.16.18 for <ietf-http-wg@w3.org> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Dec 2016 20:16:18 -0800 (PST)
Received: by mail-wm0-f49.google.com with SMTP id a197so8709180wmd.0 for <ietf-http-wg@w3.org>; Thu, 08 Dec 2016 20:16:18 -0800 (PST)
X-Received: by 10.46.5.15 with SMTP id 15mr34604554ljf.64.1481256977884; Thu, 08 Dec 2016 20:16:17 -0800 (PST)
MIME-Version: 1.0
Received: by 10.25.16.90 with HTTP; Thu, 8 Dec 2016 20:16:17 -0800 (PST)
In-Reply-To: <2F51D679-FD66-43E3-9F6C-88947E944371@me.com>
References: <9104F1BF-CA99-4640-A350-EDE4D9290C84@sharp.fm> <c9f7ee15-cfbb-26f5-4252-d587374f83d5@gmx.de> <2F51D679-FD66-43E3-9F6C-88947E944371@me.com>
From: Daurnimator <quae@daurnimator.com>
Date: Fri, 9 Dec 2016 15:16:17 +1100
X-Gmail-Original-Message-ID: <CAEnbY+cx4S2OmnnOAG2PgfALYqA2P7Pyuy0cyrTd_ftgNEeFtg@mail.gmail.com>
Message-ID: <CAEnbY+cx4S2OmnnOAG2PgfALYqA2P7Pyuy0cyrTd_ftgNEeFtg@mail.gmail.com>
To: ChanMaxthon <xcvista@me.com>
Cc: Julian Reschke <julian.reschke@gmx.de>, Graham Leggett <minfrin@sharp.fm>, HTTP Working Group <ietf-http-wg@w3.org>
Content-Type: text/plain; charset=UTF-8
Received-SPF: none client-ip=209.85.210.179; envelope-from=quae@daurnimator.com; helo=mail-wj0-f179.google.com
X-W3C-Hub-Spam-Status: No, score=-4.0
X-W3C-Hub-Spam-Report: BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, URIBL_BLOCKED=0.001, W3C_AA=-1, W3C_WL=-1
X-W3C-Scan-Sig: titan.w3.org 1cFCc2-0001Dv-LS 4ce70bafce6e111f371ade6bc41c9830
X-Original-To: ietf-http-wg@w3.org
Subject: Re: COPY: "Duplicate" functionality
Archived-At: <http://www.w3.org/mid/CAEnbY+cx4S2OmnnOAG2PgfALYqA2P7Pyuy0cyrTd_ftgNEeFtg@mail.gmail.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/33143
X-Loop: ietf-http-wg@w3.org
Resent-Sender: ietf-http-wg-request@w3.org
Precedence: list
List-Id: <ietf-http-wg.w3.org>
List-Help: <http://www.w3.org/Mail/>
List-Post: <mailto:ietf-http-wg@w3.org>
List-Unsubscribe: <mailto:ietf-http-wg-request@w3.org?subject=unsubscribe>

On 1 November 2016 at 16:18, ChanMaxthon <xcvista@me.com> wrote:
> I think you can generate a name, HEAD it, and then COPY it if you get a 404.

That's a latent TOCTOU vulnerability.

Instead, specify "Overwrite: F" and do the copy with a suffix of your
choosing e.g " (1)".
If you get a 412 in response then increment and try with e.g. a suffix of " (2)"

Alternatively, you could generate a unique path (e.g. a UUID) and use that.