Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dO6R9-0005qK-79 for pgsql-docs@arkaria.postgresql.org; Thu, 22 Jun 2017 18:02:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dO6R8-0007UH-Jw for pgsql-docs@arkaria.postgresql.org; Thu, 22 Jun 2017 18:02:34 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dO6Ql-0006p3-EA for pgsql-docs@postgresql.org; Thu, 22 Jun 2017 18:02:11 +0000 Received: from mail-lf0-x241.google.com ([2a00:1450:4010:c07::241]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dO6Qi-0000aE-CW for pgsql-docs@postgresql.org; Thu, 22 Jun 2017 18:02:10 +0000 Received: by mail-lf0-x241.google.com with SMTP id f28so3750209lfi.3 for ; Thu, 22 Jun 2017 11:02:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=ZGql42og/BvyP5HsqafhEtVVo0y6oK5hl+jbPfAEsyc=; b=HnaCNRA1fcm2dSlYxW+8dAnDOyf+C9j14m2xjCTlwH7seKnu/eSoHX2e2ZTA0PoaW3 Jw1LsL20nVdrMyGKJZ9j32Kjc7zCd0olKBTBkgfniH6jQZH7LnMnh51nZiTMOdRFqrFO HNHBJpP2fjgUry0jcUOVDRQ1K7OZ2Wp9df256YcyR1Mzj883O1gYblQeW3c/ix4T0jfR aySzxXH6L6S+aG6/udZXDtlYDtZaBW7VsdIoCN96EH6jaFdUuMtFf3xM/VQJzu0y4NTg UPFXFoqm/bX0wz6YrKa+Kd3oCquB30Zs/yeXVa/DNeoVvaEf+Z0BIi9v1kFHD1ZEsuUT oN5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=ZGql42og/BvyP5HsqafhEtVVo0y6oK5hl+jbPfAEsyc=; b=iPCUkzSt/KCubGbtWCaOLsMkaEXCgJg9Ff36D9bUCFvEvOf6qIYQ8E+tYriXoFvjQB TjZW5irnVrYnLvRFie3yGP3lYTvEXFsDDYxdEU7Kw3kRDt5U8vOs7HwojzWqERqu3pQu Ga8aicO7FoIOHvfrevfV5D4iDUtSbXAodi2BQUTXzc8L9vK8TYBuNtLOWAL69e5ilNyn MHW2s/WwhG6bo3HsX4ybjuVR37BYyPCPzh1TOhBeYWVtn4Dh7rd2Nj7/EqraaoB8KH1K rWSacMqRTqG29kYMprnSx7CKHSXuAWV2FcfiqO6SbVdczcSt+LpWb7LL7zmsEivhiqPn /Dmw== X-Gm-Message-State: AKS2vOxH6ryeX71rdo11FTRrTODh/JgGPQwcJZ/SU/M7JSGmxBO/yrtX VD3V7evRNnvgbK3Q X-Received: by 10.25.229.142 with SMTP id i14mr1428956lfk.146.1498154525209; Thu, 22 Jun 2017 11:02:05 -0700 (PDT) Received: from [192.168.1.99] (dsl-hkibng32-54fb4e-103.dhcp.inet.fi. [84.251.78.103]) by smtp.gmail.com with ESMTPSA id 25sm611024ljo.22.2017.06.22.11.02.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Jun 2017 11:02:04 -0700 (PDT) Subject: Re: gen_random_uuid security not explicit in documentation To: Michael Paquier , rightfold@gmail.com References: <20170101232054.10135.50528@wrigleys.postgresql.org> Cc: pgsql-docs@postgresql.org From: Heikki Linnakangas Message-ID: <22b132fc-e7cb-f40b-aa8e-7a54da41bf96@iki.fi> Date: Thu, 22 Jun 2017 21:02:03 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-docs Precedence: bulk Sender: pgsql-docs-owner@postgresql.org On 01/03/2017 02:47 PM, Michael Paquier wrote: > (Adding Heikki in CC who committed this code) > > On Mon, Jan 2, 2017 at 8:20 AM, wrote: >> The C source code of gen_random_uuid reads: >> >> /* >> * Generate random bits. pg_backend_random() will do here, we don't >> * promis UUIDs to be cryptographically random, when built with >> * --disable-strong-random. >> */ >> >> However, the pgcrypto documentation does not mention >> --disable-strong-random >> at all. I think the documentation should mention under which conditions >> the function returns secure data. > > That's actually a good idea. But as it does not only apply to > get_random_uuid(), I would think that a notice at the top of the > pgcrypto documentation would make the most sense. Something like: > "If PostgreSQL is built with --disable-strong-random, the data > generated by the functions is not guaranteed to be cryptographically > random." Hmm, not sure what to do here. --disable-strong-random is similar to e.g. --disable-spinlocks; no reasonable production platform would use it. So I'm not inclined to sprinkle references to it across the docs, it seems better to document what it changes, in the description of --disable-strong-random itself. To be pedantic, the documentation only claims that gen_random_bytes() returns cryptographically strong values. For gen_random_uuid(), it just says that it's "random". But yeah, it's subtle. By the feat of having them side-by-side, and a similar name, you'd think that they behave the same. And with --enable-strong-random, they do. I'm inclined to change gen_random_uuid() to throw an error if the server is built with --disable-strong-random, like gen_random_bytes() does. That way, they would behave the same. Thoughts? - Heikki -- Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs