@kmugalkhod/lightcode 0.13.0 → 0.13.1

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.
Files changed (3) hide show
  1. package/cli.js +1 -1
  2. package/package.json +1 -1
  3. package/server.js +5 -1
package/cli.js CHANGED
@@ -124,7 +124,7 @@ var init_logger = __esm(() => {
124
124
  });
125
125
 
126
126
  // packages/shared/src/version.ts
127
- var lightcodeVersion = "0.13.0";
127
+ var lightcodeVersion = "0.13.1";
128
128
 
129
129
  // packages/shared/src/index.ts
130
130
  var productName = "Lightcode";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmugalkhod/lightcode",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "Lightcode — a local AI coding agent with terminal and browser interfaces.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/server.js CHANGED
@@ -515,6 +515,9 @@ function loadWebAuthStateFromEnvironment(env = Bun.env) {
515
515
  function isPublicWebPath(pathname) {
516
516
  return pathname === "/healthz" || pathname === "/app" || pathname === "/app/" || pathname.startsWith("/app/");
517
517
  }
518
+ function isPublicWebAppPath(pathname) {
519
+ return pathname === "/app" || pathname === "/app/" || pathname.startsWith("/app/");
520
+ }
518
521
  function looksLikeBrowserRequest(request) {
519
522
  const headers = request.headers;
520
523
  if (headers.get("x-lightcode-client")?.toLowerCase() === "web") {
@@ -577,8 +580,9 @@ function createWebSecurityMiddleware(options = {}) {
577
580
  return jsonSecurityError(c, 403, "web_origin_forbidden", "The browser origin is not allowed.");
578
581
  }
579
582
  const fetchSite = request.headers.get("sec-fetch-site");
583
+ const isBootstrapDocumentNavigation = isPublicWebAppPath(pathname) && (request.method === "GET" || request.method === "HEAD") && request.headers.get("sec-fetch-mode") === "navigate" && request.headers.get("sec-fetch-dest") === "document";
580
584
  const allowedFetchSites = publicPath ? new Set(["same-origin", "none"]) : new Set(["same-origin"]);
581
- if (browserRequest && fetchSite !== null && !allowedFetchSites.has(fetchSite)) {
585
+ if (browserRequest && fetchSite !== null && !allowedFetchSites.has(fetchSite) && !(fetchSite === "cross-site" && isBootstrapDocumentNavigation)) {
582
586
  return jsonSecurityError(c, 403, "web_fetch_forbidden", "Cross-site browser requests are not allowed.");
583
587
  }
584
588
  if (!publicPath && browserRequest) {