xedoc-cli 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xedoc-cli",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Local web UI for Codex account, chat, execution, and workspace management.",
5
5
  "author": "Edward Nguyen <monokaijs@gmail.com>",
6
6
  "type": "module",
package/server/index.mjs CHANGED
@@ -3,8 +3,16 @@ import { createHmac, createHash, timingSafeEqual } from "node:crypto"
3
3
  import { createReadStream, mkdirSync, statSync } from "node:fs"
4
4
  import { createServer } from "node:http"
5
5
  import { homedir } from "node:os"
6
- import { dirname, extname, join, normalize, resolve } from "node:path"
7
- import { fileURLToPath } from "node:url"
6
+ import {
7
+ dirname,
8
+ extname,
9
+ isAbsolute,
10
+ join,
11
+ normalize,
12
+ relative,
13
+ resolve,
14
+ } from "node:path"
15
+ import { fileURLToPath, pathToFileURL } from "node:url"
8
16
  import { PrismaClient } from "@prisma/client"
9
17
  import { createRequestListener } from "@react-router/node"
10
18
  import { Server as SocketServer } from "socket.io"
@@ -24,7 +32,9 @@ mkdirSync(dirname(databasePath), { recursive: true, mode: 0o700 })
24
32
  const prisma = new PrismaClient({
25
33
  datasources: { db: { url: databaseUrl } },
26
34
  })
27
- const build = await import(join(packageRoot, "build/server/index.js"))
35
+ const build = await import(
36
+ pathToFileURL(join(packageRoot, "build/server/index.js")).href
37
+ )
28
38
  const clientRoot = join(packageRoot, "build/client")
29
39
  const requestListener = createRequestListener({
30
40
  build,
@@ -161,7 +171,12 @@ function serveStaticAsset(request, response) {
161
171
  }
162
172
 
163
173
  const candidate = resolve(clientRoot, `.${normalize(pathname)}`)
164
- if (!candidate.startsWith(`${clientRoot}/`) && candidate !== clientRoot) {
174
+ const relativeCandidate = relative(clientRoot, candidate)
175
+ if (
176
+ relativeCandidate.startsWith("..") ||
177
+ relativeCandidate === ".." ||
178
+ isAbsolute(relativeCandidate)
179
+ ) {
165
180
  return false
166
181
  }
167
182
 
@@ -1 +0,0 @@
1
- import{j as t,t as r}from"./jsx-runtime-Dafdqr5g.js";import{t as s}from"./app-shell-DuerBOKJ.js";var a=r(),o=t(function(){return(0,a.jsx)(s,{})});export{o as default};
@@ -1 +0,0 @@
1
- import{j as r,t as s}from"./jsx-runtime-Dafdqr5g.js";import{n as t}from"./app-shell-DuerBOKJ.js";var a=s(),o=r(function(){return(0,a.jsx)(t,{})});export{o as default};
@@ -1 +0,0 @@
1
- import{j as r,t as s}from"./jsx-runtime-Dafdqr5g.js";import{r as t}from"./app-shell-DuerBOKJ.js";var a=s(),o=r(function(){return(0,a.jsx)(t,{})});export{o as default};