camstack 1.2.113 → 1.2.115

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/dist/cli.js CHANGED
@@ -38,7 +38,7 @@ async function runServe(args) {
38
38
  ...typeof values.data === "string" ? { data: values.data } : {}
39
39
  };
40
40
  Object.assign(process.env, buildServeEnv(opts));
41
- await import("./launcher-64OXE64I.js");
41
+ await import("./launcher-4PKTFAZK.js");
42
42
  }
43
43
 
44
44
  // src/commands/agent.ts
@@ -83,7 +83,7 @@ async function runAgent(args) {
83
83
  ...typeof values.port === "string" ? { port: values.port } : {}
84
84
  };
85
85
  Object.assign(process.env, buildAgentEnv(opts));
86
- await import("./launcher-64OXE64I.js");
86
+ await import("./launcher-4PKTFAZK.js");
87
87
  }
88
88
 
89
89
  // src/commands/setup.ts
@@ -414073,6 +414073,7 @@ var require_session_cookie = __commonJS({
414073
414073
  exports.loginRedirectUrl = loginRedirectUrl;
414074
414074
  exports.isEmbedRedirectTarget = isEmbedRedirectTarget;
414075
414075
  exports.isSessionGradeJwtPayload = isSessionGradeJwtPayload;
414076
+ exports.sessionCookieIsSecure = sessionCookieIsSecure;
414076
414077
  exports.SESSION_COOKIE = "camstack_session";
414077
414078
  function buildSessionCookie(token2, ttlSec, opts = {}) {
414078
414079
  return {
@@ -414136,6 +414137,19 @@ var require_session_cookie = __commonJS({
414136
414137
  const p = payload;
414137
414138
  return p.kind === void 0 && typeof p.userId === "string" && typeof p.isAdmin === "boolean";
414138
414139
  }
414140
+ function sessionCookieIsSecure(requestProtocol, headers, forwardedPrefixHeader) {
414141
+ const secureLeg = requestProtocol === "https";
414142
+ if (!secureLeg)
414143
+ return false;
414144
+ if (headers[forwardedPrefixHeader] === void 0)
414145
+ return true;
414146
+ const raw = headers["x-forwarded-proto"];
414147
+ const proto = Array.isArray(raw) ? raw[0] : raw;
414148
+ if (proto === void 0)
414149
+ return true;
414150
+ const browserScheme = proto.split(",")[0]?.trim().toLowerCase();
414151
+ return browserScheme !== "http";
414152
+ }
414139
414153
  }
414140
414154
  });
414141
414155
 
@@ -431529,12 +431543,16 @@ var require_main4 = __commonJS({
431529
431543
  } catch {
431530
431544
  return reply.status(401).send({ error: "invalid token" });
431531
431545
  }
431532
- const c = (0, session_cookie_js_1.buildSessionCookie)(token2, ttlSec, { secure: request.protocol === "https" });
431546
+ const c = (0, session_cookie_js_1.buildSessionCookie)(token2, ttlSec, {
431547
+ secure: (0, session_cookie_js_1.sessionCookieIsSecure)(request.protocol, request.headers, spa_mount_1.FORWARDED_PREFIX_HEADER)
431548
+ });
431533
431549
  reply.setCookie(c.name, c.value, c.options);
431534
431550
  return reply.send({ ok: true });
431535
431551
  });
431536
431552
  fastify.delete("/api/auth/session", async (request, reply) => {
431537
- const c = (0, session_cookie_js_1.clearSessionCookie)({ secure: request.protocol === "https" });
431553
+ const c = (0, session_cookie_js_1.clearSessionCookie)({
431554
+ secure: (0, session_cookie_js_1.sessionCookieIsSecure)(request.protocol, request.headers, spa_mount_1.FORWARDED_PREFIX_HEADER)
431555
+ });
431538
431556
  reply.setCookie(c.name, c.value, c.options);
431539
431557
  return reply.send({ ok: true });
431540
431558
  });
@@ -431554,7 +431572,9 @@ var require_main4 = __commonJS({
431554
431572
  } catch {
431555
431573
  return reply.status(401).send({ error: "invalid token" });
431556
431574
  }
431557
- const c = (0, session_cookie_js_1.buildSessionCookie)(token2, ttlSec, { secure: request.protocol === "https" });
431575
+ const c = (0, session_cookie_js_1.buildSessionCookie)(token2, ttlSec, {
431576
+ secure: (0, session_cookie_js_1.sessionCookieIsSecure)(request.protocol, request.headers, spa_mount_1.FORWARDED_PREFIX_HEADER)
431577
+ });
431558
431578
  reply.setCookie(c.name, c.value, c.options);
431559
431579
  return reply.redirect(next);
431560
431580
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "camstack",
3
- "version": "1.2.113",
3
+ "version": "1.2.115",
4
4
  "description": "CLI tool for managing and running CamStack server",
5
5
  "keywords": [
6
6
  "camstack",