Skip to content

bridges: better credentials management #327

Open

Description

@MichaelMure

Excerpt of the discussion:

Nice find, I had no idea it existed. Using real secret store instead of the git config is definitely a nice thing to have.

Toying a bit with that thing, I found that:

  1. it's a way to interact with user-specified secret storage
  2. if no credential helper is configured (virtually 100% of users) it default to a one off prompt. Nothing is stored, even between git invocation.
  3. a cache system exist (need to be configured) to store credential in memory in between git invocation
  4. a storage system exist (need to be configured) to store credential in a clear-text file
  5. the expressiveness of this credential system is highly coupled with what git know: URLs, login, password. Storing tokens or metadata is kinda hacky.

So, what I derive from that is:

  • this system is deeply tied to what git understand but could be abused for our needs. A standardized way to talk to a secret store is neat, especially as it could require no git-bug specific configuration.
  • instead of being a new kind of credential (token, password, login/password), this would really be a new way to store credentials for the credential system
  • credential's metadata can keep being stored in the git config. Shoehorning those into the git credential system seems a bit too much
  • in term of UX, an explicit choice between the git config and this more secure system is not required each time a credential is stored. It seems ok to me to use that better system if available and default to the git config if not. It may cause problems though if this system become unavailable and credentials are left in an incoherent state.

Does that sounds reasonable to you ? If so I'll merge my branch and we can add this feature later as it's orthogonal to everything else. Only the storage functions will be impacted.

Originally posted by @MichaelMure in #324 (comment)

Activity

  1. Julian commented on May 22, 2020

    @Julian

    Not sure if here's the right place to add this comment, but even beyond git-credential, isn't using the git config a bit surprising? It surprised me certainly -- I have my configuration itself tracked in git, and seeing secret credentials pop up in the file breaks being able to do that (of course I noticed, but yeah I definitely didn't expect secrets to be added to the global git config as part of setting up git-bug with a bridge)

  2. karlicoss commented on May 23, 2020

    @karlicoss
    Contributor

    Agree that adding directly to git config is a bit extreme (because people usually expect this file to be public). Perhaps an easy fix without changing the model would be using an include section in git config instead:

    [include]
        path = .config/git-bug/token
    

    and git-bug keeps its token sections .config/git-bug/token.

  3. MichaelMure commented on May 23, 2020

    @MichaelMure
    ContributorAuthor

    Using the git config is not perfect but it has a very nice property: it works cross platform and across repository very easily. I'm open to suggestion and help to change that though.

  4. Julian commented on May 23, 2020

    @Julian

    Cool! Glad to hear.
    In Python-land if it were me I may be considering something like the keyring module.

    Maybe there's something similar for go (OS-agnostic access to the operating system's credentials keychain)

    But can have a think or look around.

  5. sudoforge commented on Jun 17, 2020

    @sudoforge
    Contributor

    Just a note: using the include section won't work, because git-bug currently uses the --global and --local flags respectively, which do not follow includes. If specifying a file is desired, includes can be followed by also using --include.

    Since this is off-topic for this issue, it's probably best to continue the discussion in #406.

  6. MichaelMure commented on Jul 29, 2020

    @MichaelMure
    ContributorAuthor

    Closing as the likely path forward is to not use the git global config anymore but not the git credential thing either.

    What is being cooked in #412 is to use the user system keyring (accessed through https://github.com/99designs/keyring) with a simple file in the user config dir as a fallback.

  7. mpldr commented on Mar 1, 2023

    @mpldr

    Storing the Secrets in a freedesktop.org Secret Service would probably be the best way to solve this on Linux.

  8. sudoforge commented on Mar 1, 2023

    @sudoforge
    Contributor

    my vote would be for a systemd-creds entry for linux. unless that keyring lib already supports that.

  9. mpldr commented on Mar 1, 2023

    @mpldr

    Would that even be applicable for git-bug? If memory serves me well systemd-creds is intended to be used for credentials used by units.

  10. sudoforge commented on Mar 1, 2023

    @sudoforge
    Contributor

    it's a generic tool for encrypting and decrypting things. yes, it's built into systemd and available to units, but there's nothing stopping anyone from using systemd-creds directly.

  11. mpldr commented on Mar 1, 2023

    @mpldr

    Then I would suggest to instead opt for the system-independent standard already implemented by various password (and other secrets) managers.

  12. sudoforge commented on Mar 2, 2023

    @sudoforge
    Contributor

    If we're looking for a cross-platform solution, letting the user pick how their credentials are stored and using git-credential is actually what I'd argue for, since that is a) available in Git, requiring no additional user-managed dependency, and b) not limiting the user to supported secret backends (e.g. a particular keyring).

    I do not have gnome-keyring installed, and have no desire to install it just so I can use it for managing my git-bug credentials -- I'd much prefer to use my existing password store.

  13. 7 remaining items

  14. sudoforge commented on Mar 4, 2023

    @sudoforge
    Contributor

    That became meta real quick ;-). The idea is to delegate that to something that does it better. Let's not implement it ourselves, we would just do it terribly.

    Of course; DIYing this would be a non-optimal solution.

    A simpler implementation of "cascading support" is simply:

    • an encrypted file in the user's home directory (the current solution)
    • git credentials

    because git-credentials can be configured (by the user) to proxy out to whatever other solution they want.

  15. changed the title [-]bridges: support user secret storage through git-credential[/-] [+]bridges: better credentials management[/+] on Mar 5, 2023
  16. smoyer64 commented on Mar 5, 2023

    @smoyer64
    Collaborator
  17. sudoforge commented on Mar 6, 2023

    @sudoforge
    Contributor

    I don't see how using another application to abstract the storage mechanism away is any different from using some command specified in gitconfig (which is what git-credentials does with the credential.helper parameter), which, as I've detailed in other comments in this thread, avoids requiring the user to install a new dependency, and avoids any sort of limitation on how the user wants to provide credentials to git-bug.

    In fact, I think referencing git-credential here has added confusion around what we need to do. Let's scratch that topic.

    Piping out to a user-defined command to fetch credentials, securely storing that input somewhere, and going about our business seems to be the most straightforward way to accomplish this without much complexity.

    ➜ git config --get-regex 'git-bug.*'
    git-bug.credential_command /path/to/some/tool --foo --bar baz
    

    We then get the value for this, perform whatever validation we need to (e.g. does the program exist in PATH?), execute it, report back and short circuit if it fails, else take the stdout as input, store it securely (memguard?), and use it as the credential when authenticating.

  18. smoyer64 commented on Mar 6, 2023

    @smoyer64
    Collaborator

    I didn't mean we should use chezmoi ... I meant we should pick an abstraction that ultimately allows the user to choose. I'm actually in agreement with you WRT using something like the credential.helper.

  19. github-actions commented on Jul 23, 2024

    @github-actions

    This bot triages untriaged issues and PRs according to the following rules:

    • After 90 days of inactivity, the lifecycle/stale label is applied
    • After 30 days of inactivity since lifecycle/stale was applied, the issue is closed

    To remove the stale status, you can:

    • Remove the lifecycle/stale label
    • Comment on this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/bridgeRelates to bridges (generic)kind/featureRelates to a new featurepriority/important-longtermImportant over the long term, but may not be staffed and/or may require multiple releasestriage/needs-informationWe need more information before accepting this

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions