fix(plugin): don't cache error responses, add SSRF guard to plugin_get

This commit is contained in:
2026-07-13 05:13:01 +08:00
parent 4dfc23d35f
commit ed04b87f16
2 changed files with 7 additions and 1 deletions
+4 -1
View File
@@ -56,7 +56,10 @@ export async function fetchPluginGame(
const path = `/plugin/game/${steamAppId}?limit=${limit}${hardware ? `&hardware=${encodeURIComponent(hardware)}` : ""}`
const raw = await pluginGet(path, settingsRef.baseUrl)
const value = raw as unknown as PluginGameResponse
cache.set(key, { value, expires: Date.now() + TTL_MS })
// Don't cache error responses — transient failures shouldn't poison the cache
if (!raw.error) {
cache.set(key, { value, expires: Date.now() + TTL_MS })
}
return value
}