security: server-owned audit logs + fullscreen custom pages
Port upstream PR #22 + Lite style updates: - lib/audit.js: server-side logAudit(req, action, userId), records IP from x-forwarded-for / cf-connecting-ip - login/register/create_post/create_reply record server-side - Remove client logEvent calls (AppProvider/NewPost/ReplyList) - Remove forgeable POST /api/event-logs endpoint - CustomPage: fullscreen immersive (fixed, 100vh-nav, mobile 56px nav offset) matching upstream Lite
This commit is contained in:
1 parent
45ace3ba75
commit
b9d6ca5da8
11 files changed
+73
-24
No files matched your search
@@ -3,6 +3,7 @@ import pool from '@/lib/db';
|
||||
import { getUser } from '@/lib/auth';
|
||||
import { jsonWithEtag } from '@/lib/http-cache';
|
||||
import { verifyCaptcha } from '@/lib/captcha';
|
||||
import { logAudit } from '@/lib/audit';
|
||||
|
||||
export async function GET(req, { params }) {
|
||||
try {
|
||||
@@ -43,6 +44,7 @@ export async function POST(req, { params }) {
|
||||
RETURNING *`,
|
||||
[(await params).id, user.id, content, reply_to_id || null]
|
||||
);
|
||||
await logAudit(req, 'create_reply', user.id);
|
||||
await pool.query('UPDATE posts SET updated_at = NOW() WHERE id = $1', [(await params).id]);
|
||||
return Response.json(r.rows[0]);
|
||||
} catch {
|
||||
|
||||
Reference in new issue
Block a user