Hide agent IP when unauthenticated

Ensure agent.IP is cleared for unauthenticated requests. Previously IPv4, IPv6 and Hostname were redacted, but agent.IP was left intact and could leak sensitive information. This change sets agent.IP to an empty string in Get() when the user is not authenticated.
This commit is contained in:
yumusb committed 2026-02-24 09:44:27 +08:00
1 parent d40fc1314f
commit 63cdd37b12
1 file changed
+1
+1
View File
@@ -26,6 +26,7 @@ func (h *AgentHandler) Get(c echo.Context) error {
// 未登录时隐藏敏感信息
if !isAuthenticated {
agent.IP = ""
agent.IPv4 = ""
agent.IPv6 = ""
agent.Hostname = ""