From nobody Tue Apr 23 13:02:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1580916329777192.68578053066187; Wed, 5 Feb 2020 07:25:29 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-69-JzGgwiVrMfChEVa0-Yz30Q-1; Wed, 05 Feb 2020 10:25:25 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A69888024E3; Wed, 5 Feb 2020 15:25:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0C4ED8ECE2; Wed, 5 Feb 2020 15:25:19 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D13FC8579D; Wed, 5 Feb 2020 15:25:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 015FPGU6012305 for ; Wed, 5 Feb 2020 10:25:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0C57386CCC; Wed, 5 Feb 2020 15:25:16 +0000 (UTC) Received: from dhcp-16-105.lcy.redhat.com (unknown [10.42.16.105]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7C5728ECE2; Wed, 5 Feb 2020 15:25:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580916328; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=R4Pcbt+43sFPV9XHkY1M/k77caty26GKvl08rsLg9dA=; b=LdzZrXllpLSgjMrbDBiXv2QHHQ43R1cAz5afi/4R8gMfNKYDgkXVfehqJiFpLIwHJSS1l4 sPiIayr3Jcoufh9qysw3aS8UEB4RPM8imtwp8kUT/YTb46JrSMcd87TH8GSdT3RuMIsqoB nW8GRBunFUKCqoScpNcmWPfAQM84xEs= From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [hooks PATCH v2] Don't allow @localhost email addresses in commit message Date: Wed, 5 Feb 2020 15:25:08 +0000 Message-Id: <20200205152508.2227180-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: JzGgwiVrMfChEVa0-Yz30Q-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Andrea Bolognani Reviewed-by: J=C3=A1n Tomko --- update | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/update b/update index 247b008..7f26035 100755 --- a/update +++ b/update @@ -41,6 +41,10 @@ # When this boolean is true, you may not push a merge commit to BRANCH_N= AME. # By default, you may. # +# hooks.allowlocalhostemail +# When this boolean is true, commit message email addresses are +# allowed to refer to @localhost +# # --------------------------------------------------------------------- # Allow people to change server-side git config in very specific ways. # To enable this, on the server, you must do something like the following, @@ -264,6 +268,19 @@ if [ $check_diff =3D yes ]; then fi done fi + + allow_localhost_email=3D$(git config --bool hooks.allowlocalhostemail) + if [ "$allow_localhost_email" !=3D "true" ]; then + for rev in `git log --format=3D%h $oldrev..$newrev` + do + git show $rev | grep -E '<.*@localhost.*>' >/dev/null 2>&1 + if test $? !=3D 0 + then + echo "*** Update hook: @localhost email address is forbidden $rev" >&2 + exit 1 + fi + done + fi fi =20 # --- Finished --=20 2.24.1