{"thread":{"id":"58989","subject":"[PATCH] Documentation: clarify that cache forgets credentials if the system restarts","startedAt":"2022-12-21T08:23:29Z","lastAt":"2023-01-29T17:27:01Z","messageCount":9,"participants":["M Hickford via GitGitGadget","Junio C Hamano","brian m. carlson","Jeff King","M Hickford"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"469425","messageId":"pull.1447.git.1671610994375.gitgitgadget@gmail.com","threadId":"58989","inReplyTo":null,"subject":"[PATCH] Documentation: clarify that cache forgets credentials if the system restarts","fromName":"M Hickford via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2022-12-21T08:23:14Z","receivedAt":"2022-12-21T08:23:29Z","isPatch":true,"sender":{"key":"mirth.hickford@gmail.com","avatar":"https://avatars.githubusercontent.com/u/105314?v=4"},"body":"From: M Hickford <mirth.hickford@gmail.com>\n\nMake it obvious to readers unfamiliar with Unix sockets.\n\nSigned-off-by: M Hickford <mirth.hickford@gmail.com>\n---\n    Documentation: clarify that cache forgets credentials if the system\n    restarts\n    \n    Make it obvious to readers unfamiliar with Unix sockets.\n    \n    Signed-off-by: M Hickford mirth.hickford@gmail.com\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-1447%2Fhickford%2Fpatch-2-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1447/hickford/patch-2-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/1447\n\n Documentation/git-credential-cache.txt | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-credential-cache.txt b/Documentation/git-credential-cache.txt\nindex 432e159d952..83fb4d4c4dc 100644\n--- a/Documentation/git-credential-cache.txt\n+++ b/Documentation/git-credential-cache.txt\n@@ -16,7 +16,8 @@ DESCRIPTION\n \n This command caches credentials in memory for use by future Git\n programs. The stored credentials never touch the disk, and are forgotten\n-after a configurable timeout.  The cache is accessible over a Unix\n+after a configurable timeout.  Credentials are forgotten sooner if you\n+log out or the system restarts.  The cache is accessible over a Unix\n domain socket, restricted to the current user by filesystem permissions.\n \n You probably don't want to invoke this command directly; it is meant to\n\nbase-commit: 7c2ef319c52c4997256f5807564523dfd4acdfc7\n-- \ngitgitgadget\n"},{"id":"469429","messageId":"xmqqo7rxror4.fsf@gitster.g","threadId":"58989","inReplyTo":"pull.1447.git.1671610994375.gitgitgadget@gmail.com","subject":"Re: [PATCH] Documentation: clarify that cache forgets credentials if the system restarts","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-12-21T11:15:59Z","receivedAt":"2022-12-21T11:16:39Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"M Hickford via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: M Hickford <mirth.hickford@gmail.com>\n>\n> Make it obvious to readers unfamiliar with Unix sockets.\n\nIs familiarity with sockets required?\n\nIsn't the death of the daemon process that causes the credential\ndata cached in-core of the process?\n\n>  This command caches credentials in memory for use by future Git\n>  programs. The stored credentials never touch the disk, and are forgotten\n> -after a configurable timeout.  The cache is accessible over a Unix\n> +after a configurable timeout.  Credentials are forgotten sooner if you\n> +log out or the system restarts.  The cache is accessible over a Unix\n\nIf we mention \"if you log out\" here, the readers would also want to\nlearn about credentialCache.ignoreSIGHUP configuration, no?\n\nThis is not a new issue, but I am not sure if \"never touch the disk\"\nis a honest thing to say (I know there is no \"write this in a file\"\ndone by the cache daemon, but the running daemon can be swapped out\nand I do not think we do anything to prevent the in-core structure\ncredential_cache_entry from getting written to the swap.\n\nTaking all of the above together, perhaps something like this?\n\n    ... caches credentials for use by future Git programs.  The\n    stored credentials are kept in memory of the cache-daemon\n    process (instead of written to a file) and are forgotten after a\n    configuarble timeout.  The cache-daemon dies with the cached\n    credentials upon a system shutdown/restart, or when it receives\n    SIGHUP (i.e. by logging out, you disconnect from the terminal\n    the daemon was started from); the latter can be disabled with\n    credentialCache.ignoreSIGHUP configuration.  The cache is\n    accessible over a Unix domain socket, ...\n\n"},{"id":"469445","messageId":"Y6OEFQs2OphhhuhB@tapette.crustytoothpaste.net","threadId":"58989","inReplyTo":"pull.1447.git.1671610994375.gitgitgadget@gmail.com","subject":"Re: [PATCH] Documentation: clarify that cache forgets credentials if the system restarts","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2022-12-21T22:09:25Z","receivedAt":"2022-12-21T22:09:35Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2022-12-21 at 08:23:14, M Hickford via GitGitGadget wrote:\n> From: M Hickford <mirth.hickford@gmail.com>\n> \n> Make it obvious to readers unfamiliar with Unix sockets.\n> \n> Signed-off-by: M Hickford <mirth.hickford@gmail.com>\n> ---\n>     Documentation: clarify that cache forgets credentials if the system\n>     restarts\n>     \n>     Make it obvious to readers unfamiliar with Unix sockets.\n>     \n>     Signed-off-by: M Hickford mirth.hickford@gmail.com\n> \n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1447%2Fhickford%2Fpatch-2-v1\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1447/hickford/patch-2-v1\n> Pull-Request: https://github.com/gitgitgadget/git/pull/1447\n> \n>  Documentation/git-credential-cache.txt | 3 ++-\n>  1 file changed, 2 insertions(+), 1 deletion(-)\n> \n> diff --git a/Documentation/git-credential-cache.txt b/Documentation/git-credential-cache.txt\n> index 432e159d952..83fb4d4c4dc 100644\n> --- a/Documentation/git-credential-cache.txt\n> +++ b/Documentation/git-credential-cache.txt\n> @@ -16,7 +16,8 @@ DESCRIPTION\n>  \n>  This command caches credentials in memory for use by future Git\n>  programs. The stored credentials never touch the disk, and are forgotten\n> -after a configurable timeout.  The cache is accessible over a Unix\n> +after a configurable timeout.  Credentials are forgotten sooner if you\n> +log out or the system restarts.  The cache is accessible over a Unix\n>  domain socket, restricted to the current user by filesystem permissions.\n\nI don't think it's accurate to say that the credentials are forgotten\nsooner if you log out.  That may be the case on Windows, or it may be\nthe case if you or your distro have configured systemd to gratuitously\nmurder all your local processes when your session exits[0], but it\nhasn't traditionally been the case on Unix that processes exit when your\nsession or shell exits.  For example, I don't believe that the statement\nis accurate on Debian, Ubuntu, or the BSDs by default, which constitute\na substantial number of deployed Unix systems.\n\n[0] Such as with KillUserProcesses=yes.\n-- \nbrian m. carlson (he/him or they/them)\nToronto, Ontario, CA\n"},{"id":"469447","messageId":"Y6PDx7Ij4NA/kBB7@coredump.intra.peff.net","threadId":"58989","inReplyTo":"xmqqo7rxror4.fsf@gitster.g","subject":"Re: [PATCH] Documentation: clarify that cache forgets credentials if the system restarts","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2022-12-22T02:41:11Z","receivedAt":"2022-12-22T02:41:16Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Dec 21, 2022 at 08:15:59PM +0900, Junio C Hamano wrote:\n\n> This is not a new issue, but I am not sure if \"never touch the disk\"\n> is a honest thing to say (I know there is no \"write this in a file\"\n> done by the cache daemon, but the running daemon can be swapped out\n> and I do not think we do anything to prevent the in-core structure\n> credential_cache_entry from getting written to the swap.\n\nRight, we don't do anything like mlock(), mostly because of the\nportability problems (though obviously we could make an optional\nwrapper, which is strictly better than the status quo). On the other\nhand, neither does git itself, so we're only holding credential-cache to\nthe same standard. Arguably the cache holds credentials longer, but a\nfetch or push may run for quite a while bottle-necked on network or pack\ngeneration/indexing (and both of those operations create memory pressure\nwhich may trigger swap).\n\nBut I agree that it is more accurate to say \"does not touch the\nfilesystem\" or your \"instead of written to a file\".\n\n> Taking all of the above together, perhaps something like this?\n> \n>     ... caches credentials for use by future Git programs.  The\n>     stored credentials are kept in memory of the cache-daemon\n>     process (instead of written to a file) and are forgotten after a\n>     configuarble timeout.  The cache-daemon dies with the cached\n>     credentials upon a system shutdown/restart, or when it receives\n>     SIGHUP (i.e. by logging out, you disconnect from the terminal\n>     the daemon was started from); the latter can be disabled with\n>     credentialCache.ignoreSIGHUP configuration.  The cache is\n>     accessible over a Unix domain socket, ...\n\nThat seems reasonable. I was going to suggest also mentioning that we\ncan ask the daemon to exit manually, but that is pretty well covered\nlater in the document. On the other hand, it may make sense to put all\nof this together in the description.\n\nAs brian mentioned, not every system behaves the same with respect to\nSIGHUP here. So we may need to be a little more vague here.\n\nSo maybe more like:\n\n  ...are forgotten after a configurable timeout, or if the daemon exits.\n\n  You can ask the daemon to exit manually, forgetting all cached\n  credentials before their timeout, by running:\n\n    git credential-cache exit\n\n  The daemon will also exit when it receives a signal. Depending on the\n  configuration of your system, this may happen automatically when you\n  log out. If you want to inhibit this behavior (and let items time out\n  as normal even when you're logged out), you can set the\n  credentialCache.ignoreSIGHUP configuration variable to `true`.\n\nThere are many possible variations, of course. I was mostly just trying\nto get across the point that:\n\n  - there are several ways for the daemon to exit\n\n  - sighup / logout handling may depend on your system\n\nAnd I am happy with any text that says so.\n\n-Peff\n"},{"id":"471118","messageId":"20230128200827.6427-1-mirth.hickford@gmail.com","threadId":"58989","inReplyTo":"Y6PDx7Ij4NA/kBB7@coredump.intra.peff.net","subject":"[PATCH] Documentation: clarify that cache forgets credentials if the system restarts","fromName":"M Hickford","fromEmail":"mirth.hickford@gmail.com","sentAt":"2023-01-28T20:08:27Z","receivedAt":"2023-01-28T20:08:34Z","isPatch":true,"sender":{"key":"mirth.hickford@gmail.com","avatar":"https://avatars.githubusercontent.com/u/105314?v=4"},"body":"Thanks Junio, Jeff and Brian for your replies. I'll send an updated patch based on Junio's text. To me, most important is to explain that credentials are forgotten early if the daemon exits, so that setting a timeout of 1 year is unlikely to work.\n"},{"id":"471119","messageId":"pull.1447.v2.git.1674936563549.gitgitgadget@gmail.com","threadId":"58989","inReplyTo":"pull.1447.git.1671610994375.gitgitgadget@gmail.com","subject":"[PATCH v2] Documentation: clarify that cache forgets credentials if the system restarts","fromName":"M Hickford via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-01-28T20:09:23Z","receivedAt":"2023-01-28T20:09:31Z","isPatch":true,"sender":{"key":"mirth.hickford@gmail.com","avatar":"https://avatars.githubusercontent.com/u/105314?v=4"},"body":"From: M Hickford <mirth.hickford@gmail.com>\n\nSigned-off-by: M Hickford <mirth.hickford@gmail.com>\n---\n    Documentation: clarify that cache forgets credentials if the system\n    restarts\n    \n    Make it obvious to readers unfamiliar with Unix sockets.\n    \n    Signed-off-by: M Hickford mirth.hickford@gmail.com\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-1447%2Fhickford%2Fpatch-2-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1447/hickford/patch-2-v2\nPull-Request: https://github.com/gitgitgadget/git/pull/1447\n\nRange-diff vs v1:\n\n 1:  5032ddf99da ! 1:  e84d069cf19 Documentation: clarify that cache forgets credentials if the system restarts\n     @@ Metadata\n       ## Commit message ##\n          Documentation: clarify that cache forgets credentials if the system restarts\n      \n     -    Make it obvious to readers unfamiliar with Unix sockets.\n     -\n          Signed-off-by: M Hickford <mirth.hickford@gmail.com>\n      \n       ## Documentation/git-credential-cache.txt ##\n     -@@ Documentation/git-credential-cache.txt: DESCRIPTION\n     +@@ Documentation/git-credential-cache.txt: git config credential.helper 'cache [<options>]'\n     + DESCRIPTION\n     + -----------\n       \n     - This command caches credentials in memory for use by future Git\n     - programs. The stored credentials never touch the disk, and are forgotten\n     +-This command caches credentials in memory for use by future Git\n     +-programs. The stored credentials never touch the disk, and are forgotten\n      -after a configurable timeout.  The cache is accessible over a Unix\n     -+after a configurable timeout.  Credentials are forgotten sooner if you\n     -+log out or the system restarts.  The cache is accessible over a Unix\n     - domain socket, restricted to the current user by filesystem permissions.\n     +-domain socket, restricted to the current user by filesystem permissions.\n     ++This command caches credentials for use by future Git programs.\n     ++The stored credentials are kept in memory of the cache-daemon\n     ++process (instead of written to a file) and are forgotten after a\n     ++configurable timeout. Credentials are forgotten sooner if the\n     ++cache-daemon dies, for example if the system restarts. The cached\n     ++is accessible over a Unix domain socket, restricted to the current\n     ++user by filesystem permissions.\n       \n       You probably don't want to invoke this command directly; it is meant to\n     + be used as a credential helper by other parts of Git. See\n\n\n Documentation/git-credential-cache.txt | 11 +++++++----\n 1 file changed, 7 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/git-credential-cache.txt b/Documentation/git-credential-cache.txt\nindex 432e159d952..9eef5d2cc10 100644\n--- a/Documentation/git-credential-cache.txt\n+++ b/Documentation/git-credential-cache.txt\n@@ -14,10 +14,13 @@ git config credential.helper 'cache [<options>]'\n DESCRIPTION\n -----------\n \n-This command caches credentials in memory for use by future Git\n-programs. The stored credentials never touch the disk, and are forgotten\n-after a configurable timeout.  The cache is accessible over a Unix\n-domain socket, restricted to the current user by filesystem permissions.\n+This command caches credentials for use by future Git programs.\n+The stored credentials are kept in memory of the cache-daemon\n+process (instead of written to a file) and are forgotten after a\n+configurable timeout. Credentials are forgotten sooner if the\n+cache-daemon dies, for example if the system restarts. The cached\n+is accessible over a Unix domain socket, restricted to the current\n+user by filesystem permissions.\n \n You probably don't want to invoke this command directly; it is meant to\n be used as a credential helper by other parts of Git. See\n\nbase-commit: 5cc9858f1b470844dea5c5d3e936af183fdf2c68\n-- \ngitgitgadget\n"},{"id":"471120","messageId":"pull.1447.v3.git.1674936815117.gitgitgadget@gmail.com","threadId":"58989","inReplyTo":"pull.1447.v2.git.1674936563549.gitgitgadget@gmail.com","subject":"[PATCH v3] Documentation: clarify that cache forgets credentials if the system restarts","fromName":"M Hickford via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-01-28T20:13:34Z","receivedAt":"2023-01-28T20:13:42Z","isPatch":true,"sender":{"key":"mirth.hickford@gmail.com","avatar":"https://avatars.githubusercontent.com/u/105314?v=4"},"body":"From: M Hickford <mirth.hickford@gmail.com>\n\nSigned-off-by: M Hickford <mirth.hickford@gmail.com>\n---\n    Documentation: clarify that cache forgets credentials if the system\n    restarts\n    \n    Make it obvious to readers unfamiliar with Unix sockets.\n    \n    Signed-off-by: M Hickford mirth.hickford@gmail.com\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-1447%2Fhickford%2Fpatch-2-v3\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1447/hickford/patch-2-v3\nPull-Request: https://github.com/gitgitgadget/git/pull/1447\n\nRange-diff vs v2:\n\n 1:  e84d069cf19 ! 1:  09f4afae70c Documentation: clarify that cache forgets credentials if the system restarts\n     @@ Documentation/git-credential-cache.txt: git config credential.helper 'cache [<op\n      +The stored credentials are kept in memory of the cache-daemon\n      +process (instead of written to a file) and are forgotten after a\n      +configurable timeout. Credentials are forgotten sooner if the\n     -+cache-daemon dies, for example if the system restarts. The cached\n     ++cache-daemon dies, for example if the system restarts. The cache\n      +is accessible over a Unix domain socket, restricted to the current\n      +user by filesystem permissions.\n       \n\n\n Documentation/git-credential-cache.txt | 11 +++++++----\n 1 file changed, 7 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/git-credential-cache.txt b/Documentation/git-credential-cache.txt\nindex 432e159d952..f473994a864 100644\n--- a/Documentation/git-credential-cache.txt\n+++ b/Documentation/git-credential-cache.txt\n@@ -14,10 +14,13 @@ git config credential.helper 'cache [<options>]'\n DESCRIPTION\n -----------\n \n-This command caches credentials in memory for use by future Git\n-programs. The stored credentials never touch the disk, and are forgotten\n-after a configurable timeout.  The cache is accessible over a Unix\n-domain socket, restricted to the current user by filesystem permissions.\n+This command caches credentials for use by future Git programs.\n+The stored credentials are kept in memory of the cache-daemon\n+process (instead of written to a file) and are forgotten after a\n+configurable timeout. Credentials are forgotten sooner if the\n+cache-daemon dies, for example if the system restarts. The cache\n+is accessible over a Unix domain socket, restricted to the current\n+user by filesystem permissions.\n \n You probably don't want to invoke this command directly; it is meant to\n be used as a credential helper by other parts of Git. See\n\nbase-commit: 5cc9858f1b470844dea5c5d3e936af183fdf2c68\n-- \ngitgitgadget\n"},{"id":"471122","messageId":"Y9YWruI4CdbJ9Rjn@coredump.intra.peff.net","threadId":"58989","inReplyTo":"pull.1447.v3.git.1674936815117.gitgitgadget@gmail.com","subject":"Re: [PATCH v3] Documentation: clarify that cache forgets credentials if the system restarts","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-01-29T06:48:14Z","receivedAt":"2023-01-29T06:48:20Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Jan 28, 2023 at 08:13:34PM +0000, M Hickford via GitGitGadget wrote:\n\n> diff --git a/Documentation/git-credential-cache.txt b/Documentation/git-credential-cache.txt\n> index 432e159d952..f473994a864 100644\n> --- a/Documentation/git-credential-cache.txt\n> +++ b/Documentation/git-credential-cache.txt\n> @@ -14,10 +14,13 @@ git config credential.helper 'cache [<options>]'\n>  DESCRIPTION\n>  -----------\n>  \n> -This command caches credentials in memory for use by future Git\n> -programs. The stored credentials never touch the disk, and are forgotten\n> -after a configurable timeout.  The cache is accessible over a Unix\n> -domain socket, restricted to the current user by filesystem permissions.\n> +This command caches credentials for use by future Git programs.\n> +The stored credentials are kept in memory of the cache-daemon\n> +process (instead of written to a file) and are forgotten after a\n> +configurable timeout. Credentials are forgotten sooner if the\n> +cache-daemon dies, for example if the system restarts. The cache\n> +is accessible over a Unix domain socket, restricted to the current\n> +user by filesystem permissions.\n\nThis version looks good to me.\n\n-Peff\n"},{"id":"471127","messageId":"xmqqfsbt6ylq.fsf@gitster.g","threadId":"58989","inReplyTo":"Y9YWruI4CdbJ9Rjn@coredump.intra.peff.net","subject":"Re: [PATCH v3] Documentation: clarify that cache forgets credentials if the system restarts","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-01-29T17:26:41Z","receivedAt":"2023-01-29T17:27:01Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Sat, Jan 28, 2023 at 08:13:34PM +0000, M Hickford via GitGitGadget wrote:\n>\n>> diff --git a/Documentation/git-credential-cache.txt b/Documentation/git-credential-cache.txt\n>> index 432e159d952..f473994a864 100644\n>> --- a/Documentation/git-credential-cache.txt\n>> +++ b/Documentation/git-credential-cache.txt\n>> @@ -14,10 +14,13 @@ git config credential.helper 'cache [<options>]'\n>>  DESCRIPTION\n>>  -----------\n>>  \n>> -This command caches credentials in memory for use by future Git\n>> -programs. The stored credentials never touch the disk, and are forgotten\n>> -after a configurable timeout.  The cache is accessible over a Unix\n>> -domain socket, restricted to the current user by filesystem permissions.\n>> +This command caches credentials for use by future Git programs.\n>> +The stored credentials are kept in memory of the cache-daemon\n>> +process (instead of written to a file) and are forgotten after a\n>> +configurable timeout. Credentials are forgotten sooner if the\n>> +cache-daemon dies, for example if the system restarts. The cache\n>> +is accessible over a Unix domain socket, restricted to the current\n>> +user by filesystem permissions.\n>\n> This version looks good to me.\n\nYup, it looks good to me, too.  Thanks, all.\n"}]}