DONG-WEI-YANG
Claude Sonnet 5
fix(security): derive consent-log IP from tRPC context, never client input
beda5a1 Download src/server/context.ts from mkc-itltc-AIOT/simple-case-management-assistant: direct link, hf CLI and curl.
- Browser
- Download file 400 Bytes
-
https://huggingface.co/spaces/mkc-itltc-AIOT/simple-case-management-assistant/resolve/main/src/server/context.ts
- Command line
-
hf download hf://spaces/mkc-itltc-AIOT/simple-case-management-assistant/src/server/context.ts
-
curl -L -o context.ts https://huggingface.co/spaces/mkc-itltc-AIOT/simple-case-management-assistant/resolve/main/src/server/context.ts
400 Bytes
| // src/server/context.ts | |
| // tRPC context: exposes the real client IP (from Express's req.ip) to | |
| // procedures — never the client-supplied value from request input. | |
| import type { CreateExpressContextOptions } from '@trpc/server/adapters/express' | |
| import type { Context } from './trpc' | |
| export function createContext({ req }: CreateExpressContextOptions): Context { | |
| return { ip: req.ip ?? null } | |
| } | |