xypriss 9.14.33 → 9.14.34

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/cjs/index.js CHANGED
@@ -2325,6 +2325,7 @@ function getVerifiedCallerInfo() {
2325
2325
  const frames = captureNativeFrames();
2326
2326
  let immediateCallerRoot;
2327
2327
  let immediateCallerFile = "";
2328
+ let hasNonEngineFrame = false;
2328
2329
  for (let i = 0; i < frames.length; i++) {
2329
2330
  const { filePath, isEval } = frames[i];
2330
2331
  if (isEval ||
@@ -2347,6 +2348,7 @@ function getVerifiedCallerInfo() {
2347
2348
  if (isEngineCorePath(filePath)) {
2348
2349
  continue;
2349
2350
  }
2351
+ hasNonEngineFrame = true;
2350
2352
  // Skip genuine CLI TypeScript loaders (tsx / ts-node) at the bottom of the stack
2351
2353
  // ONLY if an application caller has already been established above in the call chain.
2352
2354
  // A loader can never be the direct caller of restricted APIs!
@@ -2376,6 +2378,13 @@ function getVerifiedCallerInfo() {
2376
2378
  callerFile: immediateCallerFile,
2377
2379
  };
2378
2380
  }
2381
+ if (!hasNonEngineFrame && frames.length > 0) {
2382
+ return {
2383
+ root: ENGINE_CORE_DIR || undefined,
2384
+ isUntrusted: false,
2385
+ callerFile: "<engine-core>",
2386
+ };
2387
+ }
2379
2388
  /**
2380
2389
  * Fail-Closed Security Policy:
2381
2390
  * When the call stack cannot be unambiguously attributed to an authorized application caller
@@ -27335,7 +27344,10 @@ class XStatic {
27335
27344
  const projectRoot = this.sys.__root__;
27336
27345
  // Synchronous Sandbox Check (Project Root Violation)
27337
27346
  if (!options.allowOutsideRoot && !options.unsafe && projectRoot) {
27338
- if (!resolvedDir.startsWith(projectRoot)) {
27347
+ const relProject = this.sys.path.relative(projectRoot, resolvedDir);
27348
+ const isInsideProject = !relProject.startsWith("..") &&
27349
+ !this.sys.path.isAbsolute(relProject);
27350
+ if (!isInsideProject && resolvedDir !== projectRoot) {
27339
27351
  this.qLog.warn(`Blocked attempt to mount static directory outside project root: ${resolvedDir}`);
27340
27352
  throw new Error(`Forbidden: Project Root Violation for path ${resolvedDir}`);
27341
27353
  }