Subject: bug#59284: 29.0.50; Accept functions in place of passwords in ERC

From: "J.P." <[email-masked]>
Date: Thu, 15 Dec 2022 06:22:18 -0800

This was recently added to emacs-29 as

  commit 5258f3616812da63526da7b1aadfe26fc384ef2a
  Author: F. Jason Park <[email-masked]>
  Date:   Sun Nov 13 01:52:48 2022 -0800
  
      Accept functions in place of passwords in ERC
      
But I forgot to increment the logging-format version number. Here's a
patch that does that and also ignores incoming messages when checking
for redacted secrets, which is currently pointless. Anyone interested
please take a look (preferably in the next few days). Thanks.

>From 2ed44d72eb7d613dc594b69d2fcd075357cb3916 Mon Sep 17 00:00:00 2001
From: "F. Jason Park" <[email-masked]>
Date: Wed, 14 Dec 2022 20:03:15 -0800
Subject: [PATCH] Increment erc-debug-irc-protocol-version to 2

* lisp/erc/erc.el (erc-debug-irc-protocol-version): Change version to
2 to help dependent tooling detect redacted passwords.
(erc-log-irc-protocol): Don't bother redacting incoming messages.
(Bug#59284.)
---
 lisp/erc/erc.el | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 5e78096da5..6afa400478 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -2323,7 +2323,7 @@ erc-error
 (defvar erc-debug-irc-protocol-time-format "%FT%T.%6N%z "
   "Timestamp format string for protocol logger.")
 
-(defconst erc-debug-irc-protocol-version "1"
+(defconst erc-debug-irc-protocol-version "2"
   "Protocol log format version number.
 This exists to help tooling track changes to the format.
 
@@ -2334,7 +2334,10 @@ erc-debug-irc-protocol-version
 double CRLF, if present, signals the end of a log.  Session resumption
 is not supported.  Logger lines must adhere to the following format:
 TIMESTAMP PEER-NAME FLOW-INDICATOR IRC-MESSAGE CRLF.  Outgoing messages
-are indicated with a >> and incoming with a <<.")
+are indicated with a >> and incoming with a <<.
+
+In version 2, certain outgoing passwords are replaced by a string
+of ten question marks.")
 
 (defvar erc-debug-irc-protocol nil
   "If non-nil, log all IRC protocol traffic to the buffer \"*erc-protocol*\".
@@ -2390,7 +2393,7 @@ erc-log-irc-protocol
                       (format "%s:%s" erc-session-server erc-session-port))))
           (ts (when erc-debug-irc-protocol-time-format
                 (format-time-string erc-debug-irc-protocol-time-format))))
-      (when erc--debug-irc-protocol-mask-secrets
+      (when (and outbound erc--debug-irc-protocol-mask-secrets)
         (setq string (erc--mask-secrets string)))
       (with-current-buffer (get-buffer-create "*erc-protocol*")
         (save-excursion
-- 
2.38.1