Dev - #9
Conversation
Agent/user access modes
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b4a61c5ea9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const body = scanBodySchema.parse(req.body); | ||
| try { | ||
| return { data: await scanSillyTavernImportRoot(body.rootPath) }; |
There was a problem hiding this comment.
Restrict server-side imports to trusted users and roots
In public multi-user deployments, any authenticated user can submit an arbitrary server path to this endpoint; the scanner enumerates recognized files under that root, and the companion import endpoint copies character, persona, world-info, and chat contents into the caller's account. A normal user who knows another user's SillyTavern installation path can therefore import that user's data. Restrict these endpoints to administrators/local mode and validate the root against an explicit allowlist.
AGENTS.md reference: AGENTS.md:L125-L125
Useful? React with 👍 / 👎.
| const DEFAULT_CORS_ORIGINS = [ | ||
| "http://localhost:5173", | ||
| "http://127.0.0.1:5173", | ||
| ] as const; |
There was a problem hiding this comment.
Allow the built frontend's same origin by default
When the production frontend is built into server/public and served by Express at http://localhost:5000, same-origin mutation requests carry an Origin of http://localhost:5000, but the default allowlist contains only the Vite development origins on port 5173. Consequently rejectDisallowedOrigin returns 403 before routing every POST/PATCH/DELETE in the default built deployment. Include the backend's local origins or accept an origin that matches the request host.
Useful? React with 👍 / 👎.
| data: await resetUserPassword({ | ||
| userId: params.id, | ||
| ...body, | ||
| config, | ||
| }), |
There was a problem hiding this comment.
Prevent administrative self-password resets from stranding the UI
When an administrator resets their own password from the Users tab, this call revokes every session for the target, including the session authenticating the request, but returns only a user DTO and leaves the frontend marked authenticated. The model then immediately reloads the user list with the revoked cookie, receives 401, and leaves the application in a stale authenticated state even though the reset succeeded. Reject self-targeting here, route it through the own-password flow that issues a replacement session, or explicitly transition the client to logged out.
Useful? React with 👍 / 👎.
No description provided.