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

[JGIT PATCH 2/5] Don't display passwords on the console in fetch/push output

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jul 10, 2008, 06:13 UTC
Message-ID
<1215670403-19191-3-git-send-email-spearce@spearce.org>
In-Reply-To
<1215670403-19191-2-git-send-email-spearce@spearce.org>

When we show the URI we just fetched or pushed against there may be a user password embedded in that URI, as saved in the user's .git/config file. We shouldn't display that in public to prying eyes so nulling it out will give us a copy of the URI without that field in it.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 .../src/org/spearce/jgit/pgm/Fetch.java            |    2 +-
 .../src/org/spearce/jgit/pgm/Push.java             |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/pgm/Fetch.java b/org.spearce.jgit/src/org/spearce/jgit/pgm/Fetch.java
index c9c997e..36a0592 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/pgm/Fetch.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/pgm/Fetch.java
@@ -71,7 +71,7 @@ class Fetch extends TextBuiltin {
 			return;
 
 		out.print("From ");
-		out.print(tn.getURI());
+		out.print(tn.getURI().setPass(null));
 		out.println();
 		for (final TrackingRefUpdate u : r.getTrackingRefUpdates()) {
 			final char type = shortTypeOf(u.getResult());
diff --git a/org.spearce.jgit/src/org/spearce/jgit/pgm/Push.java b/org.spearce.jgit/src/org/spearce/jgit/pgm/Push.java
index cbdf465..8411a11 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/pgm/Push.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/pgm/Push.java
@@ -149,7 +149,7 @@ class Push extends TextBuiltin {
 			final RemoteRefUpdate rru) {
 		if (first) {
 			first = false;
-			out.format("To %s\n", transport.getURI());
+			out.format("To %s\n", transport.getURI().setPass(null));
 		}
 
 		final String remoteName = rru.getRemoteName();
-- 
1.5.6.2.393.g45096
Previous: Shawn O. PearceNext: Shawn O. Pearce
Message 3 of 12 in “Yet another round of transport fixes”
  1. 0/5 Yet another round of transport fixesShawn O. Pearce, Jul 10, 2008
  2. 1/5 Include a progress meter for large uploads to Amazon S3Shawn O. Pearce, Jul 10, 2008
  3. 2/5 Don't display passwords on the console in fetch/push outputShawn O. Pearce, Jul 10, 2008
  4. 3/5 Reuse the same SSH connection when automatically fetching tagsShawn O. Pearce, Jul 10, 2008
  5. 4/5 Report remote SSH execution errors during push via TransportExceptionShawn O. Pearce, Jul 10, 2008
  6. 5/5 Explicitly capture the stderr from a failed SSH fetch or pushShawn O. Pearce, Jul 10, 2008
  7. Robin RosenbergJul 10, 2008
  8. Robin RosenbergJul 10, 2008
  9. Johannes SchindelinJul 10, 2008
  10. Robin RosenbergJul 10, 2008
  11. Shawn O. PearceJul 11, 2008
  12. Robin RosenbergJul 11, 2008

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.