From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id Vaq1IgiDNWpbqw8AWB0awg (envelope-from ) for ; Fri, 19 Jun 2026 13:57:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1781891848; bh=ITemAyntQM5gLk/Pfskbclm5SpV/PJVeCuSIw6bdz4w=; h=Date:Subject:To:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=nJmTS0FBlQCQaIPJ3FFMY4ni/UocKzwh/uGsx1QMRV5dUz3+fBK7C6ZR0CjJ2nppN VYpbVbf5MvdK75nQPGZhfED2/3ksvs46r8Ti9m7g6bl61EH893aU47q2+xUEkOfX0v Ap3F4UqV6R5/M5+JfZ9kijyMIGKa2PVbhPiNW2Nk= Received: by simark.ca (Postfix, from userid 112) id 794971E070; Fri, 19 Jun 2026 13:57:28 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=GHAhBHQ4; dkim-atps=neutral Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 93D701E070 for ; Fri, 19 Jun 2026 13:57:27 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2594F4BAE7D8 for ; Fri, 19 Jun 2026 17:57:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2594F4BAE7D8 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=GHAhBHQ4 Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 01CE34BAE7E3 for ; Fri, 19 Jun 2026 17:56:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 01CE34BAE7E3 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 01CE34BAE7E3 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781891799; cv=none; b=Y9Nw7yvOEjkKla65Pbw4SKP/6NmaJZKh6uAVDDiUsZDu5cyyPTMawbeQT4Khb0dbGcme5UDMGlGiBc7im5mGe/hh/4elsYMQEiCM3FVQnL66zlhMrHN+UKjX7n7Cq1hf+rmF8bIv5I9AZUkqGKlyGNuPsrtoplj4p6qwaUTe7rQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781891799; c=relaxed/simple; bh=ITemAyntQM5gLk/Pfskbclm5SpV/PJVeCuSIw6bdz4w=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=kBNlkwIzicHb+c6C5wGJDJEpeJX5+c3CEiMfvLCVR1v/t57A6rOoZ+acdKiUIXkijNPqk9cOU1KqXd+TtPnbr3wLHHfBQbq47rVrntMQ/MSagTCgAwPPgnyz7GTjAToHaTSezHqWQucxxLh6eDk+aS/CrByv8PZ5ieQRLHl3XdA= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=GHAhBHQ4 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 01CE34BAE7E3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1781891796; bh=ITemAyntQM5gLk/Pfskbclm5SpV/PJVeCuSIw6bdz4w=; h=Date:Subject:To:References:From:In-Reply-To:From; b=GHAhBHQ4GtbBLq1BEiGnLkVsZj5YiAYzsWOFM/Y8pV05ykK5IwkkPfku6xNcDmKGL 7Yri3rin6JJ8So7GwK1MuIaEzGzsyrkFJoAWtLZ0x0I+SFxH7LrnLuKNM56Js38eqn rFM3iCj42BzvoJyVAXBISXt6rqyNkiaV7ExBPOIw= Received: by simark.ca (Postfix) id CEB661E070; Fri, 19 Jun 2026 13:56:36 -0400 (EDT) Message-ID: Date: Fri, 19 Jun 2026 13:56:36 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] [pre-commit] Add shellcheck To: Tom de Vries , gdb-patches@sourceware.org References: <20260618151957.76500-1-tdevries@suse.de> Content-Language: en-US From: Simon Marchi In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On 2026-06-19 07:19, Tom de Vries wrote: > On 6/18/26 7:05 PM, Simon Marchi wrote: >> >> >> On 2026-06-18 11:19, Tom de Vries wrote: >>> I found a pure python implementation of shellcheck [1]. >>> >>> Use it to run shellcheck on scripts in the repo. >>> >>> Exclude any scripts that are not currently clean. >>> >>> Running it seems reasonably fast: >>> ... >>> $ pre-commit run shellcheck --all-files -v >>> shellcheck...............................................................Passed >>> - hook id: shellcheck >>> - duration: 0.06s >>> ... >>> >>> For information on other solutions, see this RFC [2]. >>> >>> [1] https://pypi.org/project/pureshellcheck/0.2.2/ >>> [2] https://sourceware.org/pipermail/gdb-patches/2024-November/213400.html >> >> While I'm sympathetic to the use of pre-commit (I added the first >> hooks), I'm starting to get a bit worried that we kind of blindly pull >> hooks from random places without paying much attention. This is going >> to get executed on the machines of many GDB devs, and probably some CI >> too. >> >> I had this thought because this one has the "random project on github >> vibes" (it appears to be a vibe coded project started a week ago). More >> established projects (like black) are not immune to being compromised, >> but they are easier to trust I guess. >> >> Assuming you gave a quick look at the code of this project and judge >> that it's fine, > > Yeah, I did, that is, I cloned the github repository, checked it out at main/v0.2.2, and asked claude code to review it on safety aspects. Cool, thanks. >> how can we ensure that whatever pre-commit pulls is what >> you reviewed? > > The mechanism to get the tool proposed in this patch is via pip. The pypi index mentions the github repo as source, so I'm relying on that. Ok I didn't get this at first. You specify the tool (and exact version) using additional_dependencies, that downloads it in the venv, and then it runs "pureshellcheck" since it's specified as the entry point. I previously thought it would get it from the github repo directly, but no (the github repo URL isn't even mentioned anywhere in the hook). Getting a specific version from pypi seems safe-ish, in that it's not possible (from what I've read) to swap a file with another, keeping the same name. Although I read that it might be possible for someone to upload a source package at first, and then only later upload a binary one for the same version (which could differ and contain something nasty). pip would then prefer the binary one as soon as it's uploaded. >From what I understand, with hooks like flake8, pre-commit clones the specified ref, then does "pip install" in it to install it in the venv. So we use the flake8 code as specified by that ref, but its dependencies are still downloaded from pypi, we can't get around that. >> We use a git tag, but is that sufficient? Could a >> (malicious or compromised) project publish a tag, and then replaced that >> tag with something else later? > > I suppose it's possible. I found out about $ pre-commit autoupdate --freeze it transforms: rev: 26.5.1 into rev: 4160603246a6b365d4a2af661c6d71b0a0f50478 # frozen: 26.5.1 It won't solve all the integrity concerns, but we might as well use that, I don't see a downside. >> An alternative could be to point to a specific commit hash. A more >> radical alternative would be to vendor (put in our repo) the code of the >> hooks we use. >> > > Yeah, that is safer. It would mean though using github as the source. But the repo as is doesn't have pre-commit hooks. I worked around that before by using my own github account (see commit 7f6c7a5bb37 ("[pre-commit] Add tclint hook")). I'll submit a v2 shortly that uses this approach. > > FWIW, I'm open to any other solutions. Could you maybe submit a .pre-commit-hooks.yaml to that project? And then we can point to a specific tag/hash of that repo. If we don't hear anything from them after a few weeks then we could consider your fork, but if we can have the hooks upstream from the start it's less maintenance. Simon