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

Re: [PATCH v3] credential/libsecret: support password_expiry_utc

From
Junio C Hamano <gitster@pobox.com>
Date
May 15, 2023, 18:14 UTC
Message-ID
<xmqq353xa2cg.fsf@gitster.g>
In-Reply-To
<CAGJzqskMwOJkriH6serqdwAVYi+fftEL8ohJd-suP6v+OxB_bg@mail.gmail.com>
M Hickford <mirth.hickford@gmail.com> writes:
Show 19 quoted lines
>> +static const SecretSchema schema = {
>> +       "org.git.Password",
>> +       /* Ignore schema name for backwards compatibility with previous versions */
>> +       SECRET_SCHEMA_DONT_MATCH_NAME,
>> +       {
>> +               {  "user", SECRET_SCHEMA_ATTRIBUTE_STRING },
>> +               {  "object", SECRET_SCHEMA_ATTRIBUTE_STRING },
>> +               {  "protocol", SECRET_SCHEMA_ATTRIBUTE_STRING },
>> +               {  "port", SECRET_SCHEMA_ATTRIBUTE_INTEGER },
>> +               {  "server", SECRET_SCHEMA_ATTRIBUTE_STRING },
>> +               {  "password_expiry_utc", SECRET_SCHEMA_ATTRIBUTE_INTEGER },
>
> I've been testing this patch with credential-generating helper
> git-credential-helper. It works, but because libsecret overwrites
> items if and only if the attributes match exactly, you end up with
> many items in the secret store that differ only by expiry date. This
> is inelegant, and confusing to users. Please hold this patch, don't
> merge to master. A solution might be to store the expiry date as the
> secret of a separate item (even though the value is not confidential)
Thanks for stopping me.  I'll mark the topic as "on hold".

It does sound problematic, but if we think about what is used as keys and what is used as values, it does make a lot more sense to store the expiry as part of a value. After all, we are not even asking "give me the password that will expire in the most distant future" or anything like that. We consult the database with "who wants to access what server over which protocol at what port" as the key and expect we find the suitable authentication material to use. It would be best if we can treat the expiry date as an additional attribute of that authentication material.

Do the methods to store and retrieve a password from the keyring allow us to add such an extra attribute to the password? I have no idea how the Gnome keyring API works, but is there a way to mark each entry in the SecretSchemaAttributes as "this is used as a key" vs "this is used as a value---do not match"? Would thinking along such a line help?

Another possibility would be to store encoded concatenation of the real password and expiration timestamp and decode them into two upon retrieval. If we were the only user of the keystore, that may work, but if we are sharing the keystore with other applications, it would be a non-starter.

What do other application do, when using the keyring to store expirable passwords with services that do let you know the expiration time of the password? If they just ask the users again only after finding out that the password did not work, perhaps we should do the same, without being proactive and notice the expiry ourselves? That is, instead of failing the access to the server immediately upon seeing an auth failure, if the authentication material is know to have expiration time, can we let the application layer to ask the end-user to provide an refreshed password and try again? For such a scheme, we do not have to store ever-changing "password_expiry_utc" and contaminate the keyring with crufts whose expiry dates are the only difference. Instead we can just have a Boolean "does this site expire a valid password?" and use it to behave differently, if desired, from sites for which the passwords do not expire, perhaps?

Previous: M HickfordNext: M Hickford
Message 7 of 11 in “credential/libsecret: support password_expiry_utc”
  1. credential/libsecret: support password_expiry_utcM Hickford via GitGitGadget, Mar 14, 2023
  2. credential/libsecret: support password_expiry_utcM Hickford via GitGitGadget, Mar 25, 2023
  3. Junio C HamanoMay 4, 2023
  4. M HickfordMay 5, 2023
  5. credential/libsecret: support password_expiry_utcM Hickford via GitGitGadget, May 5, 2023
  6. M HickfordMay 15, 2023
  7. Junio C HamanoMay 15, 2023
  8. M HickfordMay 16, 2023
  9. Junio C HamanoMay 16, 2023
  10. credential/libsecret: store new attributesM Hickford via GitGitGadget, May 17, 2023
  11. credential/libsecret: store new attributesM Hickford via GitGitGadget, Jun 16, 2023

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.