fix(api): redact third-party credentials in ddns/notification list

GET /api/v1/ddns and /api/v1/notification returned full objects with
plaintext credentials (Cloudflare/TencentCloud secrets, webhook URLs
with embedded bot tokens, Authorization headers). Redact these fields
in the list responses.

Since the frontend edit form repopulates from the list endpoint, the
update handlers now treat an empty submitted credential as "no change"
and preserve the stored value, preventing accidental secret wipes.

Ref: GHSA-ww5p-j6cj-6mqq
This commit is contained in:
naiba committed 2026-06-20 01:54:50 +00:00
1 parent d556c3216f
commit 39d398066d
4 files changed
+210 -5

No files matched your search

+2
View File
@@ -43,6 +43,7 @@ func (c *DDNSClass) InsertForTest(p *model.DDNSProfile) {
c.listMu.Lock()
c.list[p.ID] = p
c.listMu.Unlock()
c.sortList()
}
// NewEmptyNotificationClassForTest 构造空 NotificationClass。
@@ -62,4 +63,5 @@ func (c *NotificationClass) InsertForTest(n *model.Notification) {
c.listMu.Lock()
c.list[n.ID] = n
c.listMu.Unlock()
c.sortList()
}