git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] ssh signing: don't detach the filename strbuf from key_file tempfile

From
Patrick Steinhardt <ps@pks.im>
Date
Jul 7, 2025, 09:02 UTC
Message-ID
<aGuNCGNk96DK4GzX@pks.im>
In-Reply-To
<20250706173450.12995-1-redoste@redoste.xyz>
On Sun, Jul 06, 2025 at 07:34:49PM +0200, redoste wrote:
Show 15 quoted lines
> diff --git a/t/t7528-signed-commit-ssh.sh b/t/t7528-signed-commit-ssh.sh
> index 065f780636..1a8d96f355 100755
> --- a/t/t7528-signed-commit-ssh.sh
> +++ b/t/t7528-signed-commit-ssh.sh
> @@ -390,6 +390,22 @@ test_expect_success GPGSSH 'check config gpg.format values' '
>  	test_must_fail git commit -S --amend -m "fail"
>  '
>  
> +test_expect_success GPGSSH 'check temporary files clean up when signing commits' '
> +	test_config gpg.format ssh &&
> +	eval $(ssh-agent) &&
> +	test_when_finished "kill ${SSH_AGENT_PID}" &&
> +	mkdir tmpdir &&
> +	TMPDIR="$(pwd)/tmpdir" &&
> +	export TMPDIR &&

I think this exported environment variable now leaks into subsequent tests, doesn't it? We may want to do it in a subshell.

	mkdir tmpdir &&
	TMPDIR="$(pwd)/tmpdir" &&
	(
		export TMPDIR &&
		ssh-add "${GPGSSH_KEY_PRIMARY}" &&
		echo 1 >file && git add file &&
		git commit -a -m inline -S"$(cat "${GPGSSH_KEY_PRIMARY}.pub")" &&
		echo 2 >file &&
		git commit -a -m file -S"${GPGSSH_KEY_PRIMARY}"
	) && 
	find tmpdir -type f >tmpfiles &&
	test_line_count = 0 tmpfiles
Patrick
Show 16 quoted lines
> +	ssh-add "${GPGSSH_KEY_PRIMARY}" &&
> +	echo 1 >file && git add file &&
> +	git commit -a -m inline -S"$(cat "${GPGSSH_KEY_PRIMARY}.pub")" &&
> +	echo 2 >file &&
> +	git commit -a -m file -S"${GPGSSH_KEY_PRIMARY}" &&
> +	find tmpdir -type f >tmpfiles &&
> +	test_line_count = 0 tmpfiles
> +'
> +
>  test_expect_failure GPGSSH 'detect fudged commit with double signature (TODO)' '
>  	sed -e "/gpgsig/,/END PGP/d" forged1 >double-base &&
>  	sed -n -e "/gpgsig/,/END PGP/p" forged1 | \
> -- 
> 2.49.0
> 
> 
Previous: brian m. carlsonNext: Phillip Wood
Message 12 of 21 in “ssh signing: don't detach the filename strbuf from key_file tempfile”
  1. ssh signing: don't detach the filename strbuf from key_file tempfileredoste, Jul 4, 2025
  2. Jeff KingJul 5, 2025
  3. brian m. carlsonJul 5, 2025
  4. redosteJul 5, 2025
  5. redosteJul 5, 2025
  6. brian m. carlsonJul 6, 2025
  7. Jeff KingJul 6, 2025
  8. redosteJul 6, 2025
  9. redosteJul 6, 2025
  10. ssh signing: don't detach the filename strbuf from key_file tempfileredoste, Jul 6, 2025
  11. brian m. carlsonJul 6, 2025
  12. Patrick SteinhardtJul 7, 2025
  13. Phillip WoodJul 7, 2025
  14. redosteJul 7, 2025
  15. Phillip WoodJul 7, 2025
  16. redosteJul 7, 2025
  17. Phillip WoodJul 7, 2025
  18. ssh signing: don't detach the filename strbuf from key_file tempfileredoste, Jul 7, 2025
  19. Junio C HamanoJul 7, 2025
  20. Patrick SteinhardtJul 8, 2025
  21. Phillip WoodJul 8, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.