<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Logging on Feng-Chi's Notes</title><link>https://holmeslin.github.io/tags/logging/</link><description>Recent content in Logging on Feng-Chi's Notes</description><generator>Hugo -- gohugo.io</generator><language>zh-tw</language><lastBuildDate>Mon, 02 Nov 2026 13:00:00 +0800</lastBuildDate><atom:link href="https://holmeslin.github.io/tags/logging/index.xml" rel="self" type="application/rss+xml"/><item><title>url.Redacted() 遮不住的 token</title><link>https://holmeslin.github.io/posts/go-url-redacted-credential-leak/</link><pubDate>Mon, 02 Nov 2026 13:00:00 +0800</pubDate><guid>https://holmeslin.github.io/posts/go-url-redacted-credential-leak/</guid><description>&lt;p&gt;服務啟動時把連線字串印到 log，方便確認連到哪台機器，這是很常見的寫法。Go 的 &lt;code&gt;net/url&lt;/code&gt; 有一個 &lt;code&gt;Redacted()&lt;/code&gt;，看名字會以為它能把敏感資訊遮掉，但它只遮「密碼」這一格。很多連線字串的祕密根本不放在那一格。&lt;/p&gt;
&lt;p&gt;這篇用實際跑過的測試，整理 &lt;code&gt;Redacted()&lt;/code&gt; 會漏掉的幾種情況，以及 &lt;code&gt;url.Parse&lt;/code&gt; 錯誤訊息的同類問題，最後給一個簡單的替代寫法。&lt;/p&gt;</description></item></channel></rss>