From: "Daniel Martí" <mvdan@mvdan.cc>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Daniel Martí via GitGitGadget" <gitgitgadget@gmail.com>,
git@vger.kernel.org, "M Hickford" <mirth.hickford@gmail.com>,
"Mantas Mikulėnas" <grawity@gmail.com>,
"Patrick Steinhardt" <ps@pks.im>
Subject: Re: [PATCH] credential/libsecret: load secrets explicitly
Date: Mon, 21 Sep 2026 22:54:15 +0100 [thread overview]
Message-ID: <c3f51472-8dfa-42df-aa8b-b0f5bfd0aafe@mvdan.cc> (raw)
In-Reply-To: <a60afe54-7059-4827-8c3b-dfe01a0cde9c@mvdan.cc>
Friendly nudge :) Happy to look into any tweaks or questions.
On 8/22/26 9:47 PM, Daniel Martí wrote:
> Hi Junio, thanks very much for your review. I also do not program Gnome,
> so this is just based on my best effort research :)
>
> Junio C Hamano <gitster@pobox.com> writes:
> > The above makes it sound like we can just request with
> > secret_service_search_sync() exactly the same way as before (i.e.,
> > with LOAD_SECRETS), and then check with secret_item_get_secret()
> > to see if it has secret value in it. The problem with the current
> > code is that we do not validate what that secrete value is (iow, we
> > do not say "ah, NULL, we should not assume we do have secret already
> > obtained here").
> >
> > So does the first hunk to drop _LOAD_SECRETS really needed?
>
> Not strictly; your version would avoid the assertion failures too.
>
> I dropped the flag because it isn't the single call it appears to be:
> libsecret implements SECRET_SEARCH_LOAD_SECRETS as the SearchItems
> D-Bus call followed by a separate GetSecrets call covering the matched
> items, with any error from that second step discarded. It also skips
> locked items on the client side without even asking the daemon, so
> SECRET_SEARCH_UNLOCK having silently failed is one way to end up with
> a NULL secret. The patch does SearchItems plus one GetSecret for the
> one item we use, so the common case is the same two round trips either
> way; it is your fallback version that would add a third in the rare
> case. That is what the "cost is unchanged" paragraph in the commit
> message is trying to say.
>
> Keeping the flag with a fallback load would also mean the explicit
> load only runs during the rare race, so that path would go essentially
> unexercised, and load errors on the common path would still be
> silently discarded. With the unconditional load there is one code
> path, taken on every run, and any failure produces a real error
> message.
>
> > I am also assuming that this is a race condition that is not very
> > easy to reliably reproduce in the test, so I wouldn't expect it to
> > come with a test to ensure that the fix will not regress in the
> > future (in other words, lack of patch to t/ directory is fine).
>
> Right, it needs a concurrently-racing process (or a locked keyring)
> to trigger, so I don't see a way to test it reliably.
>
> Thanks!
next prev parent reply other threads:[~2026-09-21 21:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 22:40 [PATCH] credential/libsecret: load secrets explicitly Daniel Martí via GitGitGadget
2026-08-20 15:00 ` Daniel Martí
2026-08-20 19:05 ` Junio C Hamano
2026-08-22 20:47 ` Daniel Martí
2026-09-21 21:54 ` Daniel Martí [this message]
2026-09-21 22:52 ` Junio C Hamano
2026-09-24 7:00 ` M Hickford
2026-09-27 22:45 ` Daniel Martí
2026-09-27 22:46 ` [PATCH v2] " Daniel Martí via GitGitGadget
2026-09-28 7:37 ` Daniel Martí
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c3f51472-8dfa-42df-aa8b-b0f5bfd0aafe@mvdan.cc \
--to=mvdan@mvdan.cc \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
--cc=grawity@gmail.com \
--cc=mirth.hickford@gmail.com \
--cc=ps@pks.im \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox