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

Re: [PATCH v9] credential-store: warn instead of fatal for bogus lines from store

From
Junio C Hamano <gitster@pobox.com>
Date
May 1, 2020, 01:40 UTC
Message-ID
<xmqqimhgph3z.fsf@gitster.c.googlers.com>
In-Reply-To
<20200501003041.GD33264@Carlos-MBP>
Carlo Marcelo Arenas Belón <carenas@gmail.com> writes:
Show 8 quoted lines
> the problem is that practically speaking, if users in Windows and Macs
> edited the file they "might" had saved lines with the wrong line ending (*)
> (part of the reason I added a warning about "encoding" to the documentation),
> and those are difficult to "see" as invalid.
>
> using the non _lf() version ensures any trailing '\r' character would
> get removed from the credential and allow us to use them, instead of
> silently failing.
You are forgetting why we are fixing credential-store, aren't you?

It is primarily to help those who damaged their files by editing, and introducing cruft that cannot be parsed, from a stricter parsing introduced recently in 2.17.4 and above. Without the fix, they cannot operate with the store they already have.

Now, think about those users who saved their file, after adding CR at the end of each line, but didn't do any other edit (like adding a blank line or "# comment"). It may have happened 3 years ago. What did they see from the system back then? It may have happened 3 minutes ago. What would they see with the stricter parser now?

With or without the recent parser change, they would have seen that these lines no longer match the URLs they wanted to match, but the credential store does not die on them for malformed lines, no?

In other words, the stricter parsing did nothing to these users.

In fact, those users who added CR at the end of each line 3 years ago may have even depended on the disappearance of these entries for all these years. Maybe lines that record their ancient passwords for sites are still buried in the later parts of the file, with CR, but doing no harm because these lines do not match anything. These users may have changed their password since then and wrote new records with "credential store", and these new records are stored without CR at the end of the line, so they match the URLs.

By using the non _lf() variant, you are suddenly resurrecting these old records that the users thought are already gone and have been causing no harm to them. Do we know that resurrecting these old records is a good thing to do? I don't. For example, once the user decides to "sort" the file (after all, we are talking about users who edit the file, so we cannot assume they won't do so), they would end up with duplicate records that record two passwords to the same site and they cannot tell which one is current, as you even lost the CR at the end of line that would have told you which ones are broken.

In short, you wouldn't know what ramification it has by suddenly using non _lf() variant. And it has nothing to do with the fix we are trying to make.

When fixing something, it is tempting to see if you can cover a bit more area with the same change. But you should make it a habit to stick to the absolute minimum first for safety. When contemplating to step out of the absolute minimum, you need to think twice to see if that extra "fix" really fixes, or if it potentially harms.

And I am not convinced that turning CRLF into LF in this case is a good change. In any case, it certainly does not belong to the same commit as the one that fixes the fallout from stricter parser introduced in 2.17.4 and above.

Thanks.
Previous: Carlo Marcelo Arenas BelónNext: Carlo Arenas
Message 64 of 79 in “git-credential-store: skip empty lines and comments from store”
  1. git-credential-store: skip empty lines and comments from storeCarlo Marcelo Arenas Belón, Apr 26, 2020
  2. Eric SunshineApr 27, 2020
  3. Carlo Marcelo Arenas BelónApr 27, 2020
  4. git-credential-store: skip empty lines and comments from storeCarlo Marcelo Arenas Belón, Apr 27, 2020
  5. Jeff KingApr 27, 2020
  6. Carlo Marcelo Arenas BelónApr 27, 2020
  7. Eric SunshineApr 27, 2020
  8. Junio C HamanoApr 27, 2020
  9. Jeff KingApr 27, 2020
  10. git-credential-store: skip empty lines and comments from storeCarlo Marcelo Arenas Belón, Apr 27, 2020
  11. Philip OakleyApr 27, 2020
  12. Carlo Marcelo Arenas BelónApr 28, 2020
  13. Philip OakleyApr 29, 2020
  14. DirkApr 27, 2020
  15. Junio C HamanoApr 27, 2020
  16. Jeff KingApr 27, 2020
  17. Junio C HamanoApr 27, 2020
  18. Jeff KingApr 27, 2020
  19. Carlo Marcelo Arenas BelónApr 28, 2020
  20. Carlo Marcelo Arenas BelónApr 27, 2020
  21. Jonathan NiederApr 28, 2020
  22. Jeff KingApr 28, 2020
  23. Carlo Marcelo Arenas BelónApr 28, 2020
  24. Jeff KingApr 28, 2020
  25. Carlo Marcelo Arenas BelónApr 28, 2020
  26. Stefan TaunerApr 28, 2020
  27. Junio C HamanoApr 28, 2020
  28. Carlo Marcelo Arenas BelónApr 28, 2020
  29. Junio C HamanoApr 28, 2020
  30. 0/4 credential-store: prevent fatal errorsCarlo Marcelo Arenas Belón, Apr 28, 2020
  31. 1/4 credential-store: document the file format a bit moreCarlo Marcelo Arenas Belón, Apr 28, 2020
  32. 2/4 git-credential-store: skip empty lines and comments from storeCarlo Marcelo Arenas Belón, Apr 28, 2020
  33. Eric SunshineApr 28, 2020
  34. Carlo Marcelo Arenas BelónApr 28, 2020
  35. 3/4 git-credential-store: fix (WIP)Carlo Marcelo Arenas Belón, Apr 28, 2020
  36. Eric SunshineApr 28, 2020
  37. Carlo Marcelo Arenas BelónApr 28, 2020
  38. 4/4 credential-store: make sure there is no regression with missing schemeCarlo Marcelo Arenas Belón, Apr 28, 2020
  39. Eric SunshineApr 28, 2020
  40. Junio C HamanoApr 28, 2020
  41. Junio C HamanoApr 28, 2020
  42. credential-store: warn instead of fatal for bogus lines from storeCarlo Marcelo Arenas Belón, Apr 29, 2020
  43. Junio C HamanoApr 29, 2020
  44. Carlo Marcelo Arenas BelónApr 29, 2020
  45. Junio C HamanoApr 29, 2020
  46. 0/2 credential-store: prevent fatal errorsCarlo Marcelo Arenas Belón, Apr 29, 2020
  47. 1/2 credential-store: warn instead of fatal for bogus lines from storeCarlo Marcelo Arenas Belón, Apr 29, 2020
  48. Junio C HamanoApr 29, 2020
  49. Junio C HamanoApr 29, 2020
  50. 2/2 credential-store: warn for any incomplete credentials instead of usingCarlo Marcelo Arenas Belón, Apr 29, 2020
  51. Junio C HamanoApr 29, 2020
  52. Carlo Marcelo Arenas BelónApr 29, 2020
  53. Junio C HamanoApr 29, 2020
  54. credential-store: warn instead of fatal for bogus lines from storeCarlo Marcelo Arenas Belón, Apr 29, 2020
  55. Junio C HamanoApr 29, 2020
  56. Junio C HamanoApr 29, 2020
  57. Carlo Marcelo Arenas BelónApr 30, 2020
  58. credential-store: warn instead of fatal for bogus lines from storeCarlo Marcelo Arenas Belón, Apr 30, 2020
  59. credential-store: warn instead of fatal for bogus lines from storeCarlo Marcelo Arenas Belón, Apr 30, 2020
  60. credential-store: warn instead of fatal for bogus lines from storeCarlo Marcelo Arenas Belón, Apr 30, 2020
  61. Junio C HamanoApr 30, 2020
  62. Junio C HamanoApr 30, 2020
  63. Carlo Marcelo Arenas BelónMay 1, 2020
  64. Junio C HamanoMay 1, 2020
  65. Carlo ArenasMay 1, 2020
  66. Junio C HamanoMay 1, 2020
  67. Carlo Marcelo Arenas BelónMay 1, 2020
  68. Junio C HamanoMay 1, 2020
  69. credential-store: warn/ignore for bogus lines from store fileCarlo Marcelo Arenas Belón, May 1, 2020
  70. 2/1 credential-store: warn also for store and eraseCarlo Marcelo Arenas Belón, May 1, 2020
  71. Junio C HamanoMay 1, 2020
  72. credential-store: ignore bogus lines from store fileCarlo Marcelo Arenas Belón, May 2, 2020
  73. Junio C HamanoMay 2, 2020
  74. Carlo Marcelo Arenas BelónMay 2, 2020
  75. Carlo Marcelo Arenas BelónMay 2, 2020
  76. Junio C HamanoMay 3, 2020
  77. Jeff KingMay 3, 2020
  78. Carlo Marcelo Arenas BelónMay 2, 2020
  79. credential-store: ignore bogus lines from store fileCarlo Marcelo Arenas Belón, May 2, 2020

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.