Public /api/config: no Telegram chat/topic ids, no spamScanAllow, no value holding an email address (seven member emails and the admin chat id were readable by anyone; admin pages read them through /api/admin/site) (2026-11-20)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-20 15:10:35 -06:00
parent d662a382ac
commit 66581fb621
+5 -1
View File
@@ -2594,7 +2594,11 @@ const server = http.createServer(async (req, res) => {
const c = chain.getConfig();
// public copy of the site settings: never anything that looks like a credential
const pubSite = {};
for (const [k, v] of Object.entries(siteConfig())) if (!/secret|token|password|private|apikey|api_key/i.test(k) && !/^support/.test(k)) pubSite[k] = v; // support* = help desk internals (Marty's chat id, saved replies)
// also never: Telegram chat/topic ids, the link-farm allow list, or any value holding an email address (2026-11-20: spamScanAllow
// put seven member emails and telegramAdminChatId in this public answer; only the admin pages use them, through /api/admin/site)
const EMAIL = /[^\s@"]+@[^\s@"]+\.[a-z]{2,}/i;
for (const [k, v] of Object.entries(siteConfig())) if (!/secret|token|password|private|apikey|api_key/i.test(k) && !/^support/.test(k)
&& !/^telegram|ChatId$|TopicId$|^spamScan/i.test(k) && !EMAIL.test(typeof v === 'string' ? v : JSON.stringify(v))) pubSite[k] = v; // support* = help desk internals (Marty's chat id, saved replies)
return json(res, 200, Object.assign({ contract: c.contract, chainId: c.chainId,
chainName: c.chainName, explorer: c.explorer, rpc: c.rpcs[0],
emailAuth: mailer.hasKey() || !IS_PROD }, pubSite));