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

Re: [PATCH] osxkeychain: lock for exclusive execution

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
May 10, 2024, 20:33 UTC
Message-ID
<Zj6EhJi9MgALC5Ti@tapette.crustytoothpaste.net>
In-Reply-To
<20240510200114.GC1954863@coredump.intra.peff.net>
On 2024-05-10 at 20:01:14, Jeff King wrote:
Show 15 quoted lines
> And I think there are several problems with that, besides inefficiency
> and locking. See this old patch, which fixes it by remembering when
> a credential came from a helper:
> 
>   https://lore.kernel.org/git/20120407033417.GA13914@sigill.intra.peff.net/
> 
> But we didn't merge it because some people rely on the behavior of
> helpers feeding back to themselves. I outlined some solutions there, but
> it would definitely be a change in behavior that people would have to
> adapt to.
> 
> Some possible alternatives:
> 
>   - we could remember _which_ helper we got the credential from, and
>     avoid invoking it again.

This will break the new `state[]` feature, which relies on being able to see the state after the fact to know whether the operation was successful. As an example of the functionality the current approach allows, authentication could use an HOTP (like TOTP, but using a counter instead of time) value, and storing the correct used counter on success would be important.

I agree it's not super important if we're just using a username and password, but considering I just added support for arbitrary authentication schemes, which can include things such as limited-use OAuth tokens, one-time use passcodes, and certain types of HMAC-based signing, we probably don't want to choose this approach.

>   - we could record a bit saying that the credential came from a helper,
>     and then feed that back to helpers when storing. So osxkeychain
>     could then decide not to store it.

This is actually possible with the new `state[]` feature. `osxkeychain` can simply set that field to something like `osxkeychain:seen=1` and simply do nothing if it sees that field.

All the credential helper needs to do is declare support for that functionality with the appropriate capability and emit the field if it gets that capability on standard input.

-- 
brian m. carlson (they/them or he/him)
Toronto, Ontario, CA
Previous: Jeff KingNext: Jeff King
Message 4 of 21 in “osxkeychain: lock for exclusive execution”
  1. osxkeychain: lock for exclusive executionKoji Nakamaru via GitGitGadget, May 10, 2024
  2. Bo AndersonMay 10, 2024
  3. Jeff KingMay 10, 2024
  4. brian m. carlsonMay 10, 2024
  5. Jeff KingMay 10, 2024
  6. brian m. carlsonMay 10, 2024
  7. Junio C HamanoMay 10, 2024
  8. Jeff KingMay 10, 2024
  9. Junio C HamanoMay 10, 2024
  10. 0/2 osxkeychain: lock for exclusive executionKoji Nakamaru via GitGitGadget, May 11, 2024
  11. 1/2 osxkeychain: lock for exclusive executionKoji Nakamaru via GitGitGadget, May 11, 2024
  12. Junio C HamanoMay 12, 2024
  13. Koji NakamaruMay 12, 2024
  14. 2/2 osxkeychain: state[] seen=1 to skip unnecessary store operationsKoji Nakamaru via GitGitGadget, May 11, 2024
  15. Junio C HamanoMay 12, 2024
  16. Koji NakamaruMay 12, 2024
  17. 0/2 osxkeychain: lock for exclusive executionKoji Nakamaru via GitGitGadget, May 15, 2024
  18. 1/2 osxkeychain: exclusive lock to serialize execution of operationsKoji Nakamaru via GitGitGadget, May 15, 2024
  19. 2/2 osxkeychain: state to skip unnecessary store operationsKoji Nakamaru via GitGitGadget, May 15, 2024
  20. Koji NakamaruMay 15, 2024
  21. Koji NakamaruMay 10, 2024

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.