add token revoke and panic lockdown endpoints with security logging

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-23 00:48:44 +00:00
co-authored by Claude Opus 4.8
parent b96b23d92b
commit fcee091b53
9 changed files with 71 additions and 42 deletions
+9
View File
@@ -0,0 +1,9 @@
import type { Context } from 'hono';
// Best-effort client IP for audit logging. Behind a reverse proxy the real address is in
// x-forwarded-for (first hop); fall back to x-real-ip, then "unknown".
export const clientIp = (ctx: Context): string => {
const xff = ctx.req.header('x-forwarded-for');
if (xff) return xff.split(',')[0]?.trim() || 'unknown';
return ctx.req.header('x-real-ip') || 'unknown';
};