ework-web 0.10.110 → 0.10.112
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 +1 -1
- package/src/auth.ts +2 -1
- package/src/config.ts +7 -0
- package/src/index.ts +4 -0
package/package.json
CHANGED
package/src/auth.ts
CHANGED
|
@@ -46,7 +46,8 @@ export interface AuthResult {
|
|
|
46
46
|
export function authCookieName(cfg: Config): string {
|
|
47
47
|
// __Host- prefix (C2 hardening) requires Secure + Path=/ + no Domain and is only
|
|
48
48
|
// honored by browsers over TLS; cfg.secureCookie is flipped on only after Caddy/TLS.
|
|
49
|
-
|
|
49
|
+
const name = cfg.cookieName ?? AUTH_COOKIE_NAME;
|
|
50
|
+
return cfg.secureCookie ? `__Host-${name}` : name;
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
export async function makeAuthCookieHeader(cfg: Config, login: string): Promise<string> {
|
package/src/config.ts
CHANGED
|
@@ -50,6 +50,12 @@ export const configSchema = z.object({
|
|
|
50
50
|
.default("ework-actions"),
|
|
51
51
|
upstreamTimeoutMs: z.coerce.number().default(15000),
|
|
52
52
|
secureCookie: z.boolean().default(false),
|
|
53
|
+
// Cookies are domain-scoped, NOT port-scoped: two ework webs on the same host
|
|
54
|
+
// (different ports) overwrite/kick each other's login unless names differ.
|
|
55
|
+
cookieName: z
|
|
56
|
+
.string()
|
|
57
|
+
.regex(/^[A-Za-z0-9_-]+$/, "WORK_COOKIE_NAME must be alphanumeric/dash/underscore")
|
|
58
|
+
.default("ework_auth"),
|
|
53
59
|
// ework is human-facing; writes on by default. Flip off to use as a read-only mirror.
|
|
54
60
|
writesEnabled: z.boolean().default(true),
|
|
55
61
|
// Issue-thread comment order: 'desc' = newest first (top), 'asc' = oldest first.
|
|
@@ -167,6 +173,7 @@ export async function loadConfig(): Promise<Config> {
|
|
|
167
173
|
host: process.env.WORK_HOST,
|
|
168
174
|
authToken: process.env.WORK_TOKEN,
|
|
169
175
|
cookieSecret: process.env.WORK_COOKIE_SECRET,
|
|
176
|
+
cookieName: process.env.WORK_COOKIE_NAME,
|
|
170
177
|
operatorLogin: process.env.WORK_OPERATOR_LOGIN,
|
|
171
178
|
systemLogin: process.env.WORK_SYSTEM_LOGIN,
|
|
172
179
|
upstreamTimeoutMs: process.env.WORK_UPSTREAM_TIMEOUT_MS,
|
package/src/index.ts
CHANGED
|
@@ -811,6 +811,10 @@ async function handle(req: Request, url: URL, ip: string, ctx: { authed: boolean
|
|
|
811
811
|
}
|
|
812
812
|
}
|
|
813
813
|
}
|
|
814
|
+
if (!daemonEp && /^ses_[0-9A-Za-z]{8,}/.test(sid)) {
|
|
815
|
+
const scanned = await tryAllDaemons();
|
|
816
|
+
if (scanned) return scanned;
|
|
817
|
+
}
|
|
814
818
|
const client = daemonEp ? new RemoteOpencodeClient(daemonEp) : opencode;
|
|
815
819
|
try {
|
|
816
820
|
const { html: body } = await buildSessionView(client, sid, desc, cfg.collapseLines, limit, all);
|