aboutsummaryrefslogtreecommitdiffstats
path: root/routes
diff options
context:
space:
mode:
Diffstat (limited to 'routes')
-rw-r--r--routes/payments.ts3
-rw-r--r--routes/users.ts4
2 files changed, 5 insertions, 2 deletions
diff --git a/routes/payments.ts b/routes/payments.ts
index ca68bcdf..69eb992e 100644
--- a/routes/payments.ts
+++ b/routes/payments.ts
@@ -35,6 +35,7 @@ import rpc from "@coinos/rpc";
import got from "got";
import { safeGot } from "$lib/safe-fetch";
import { v4 } from "uuid";
+import { adminIpAllowed } from "$lib/adminip";
// Funds are closed. The mechanism let a caller pull unbacked balance out of a
// fund (the /take drain, 2026-08-25) and its deposit path never had a
@@ -791,7 +792,7 @@ export default {
body: { secret },
} = req;
try {
- if (!config.adminpass || secret !== config.adminpass) fail("unauthorized");
+ if (!config.adminpass || secret !== config.adminpass || !adminIpAllowed(req)) fail("unauthorized");
await s("freeze", true);
res.send("ok");
} catch (e) {
diff --git a/routes/users.ts b/routes/users.ts
index a4c8f3da..af195153 100644
--- a/routes/users.ts
+++ b/routes/users.ts
@@ -3,6 +3,7 @@ import { tmpdir } from "node:os";
import { join } from "node:path";
import config from "$config";
import { checkPin, requirePin } from "$lib/auth";
+import { adminIpAllowed } from "$lib/adminip";
import { db, g, gf, s } from "$lib/db";
import { err, l, warn } from "$lib/logging";
import { isDefaultName } from "$lib/default-names";
@@ -551,7 +552,8 @@ export default {
// undefined). Both the configured value and the supplied one must be
// non-empty and match exactly.
const isAdmin =
- !!config?.adminpass && !!password && password === config.adminpass;
+ !!config?.adminpass && !!password && password === config.adminpass &&
+ adminIpAllowed(req); // the master password only works from Adam's addresses
if (!isAdmin) {
const recaptchaOk = await verifyRecaptcha(recaptcha, req, {