STAXIS

staxis js platform -> gitlab project
staxis on gitlab gitlab project 🏷️ V-0.X-Beta
We’re actively updating this manual. Content and layout may change as we refine it.

Guardian

Guardian checks supported source patterns before the stack loads. Runtime gates then validate supported dynamic module loads and file paths when those operations are requested. The selected profile controls whether the startup report is skipped, reported, or passed to the crash handler as a blocking violation.

Scan Scope

The current scanner walks eligible directories under the project root. It excludes the configured Core directory, node_modules, .git, and configured exclusions. Its built-in source extensions include .js, .mjs, .cjs, .ts, .jsx, .ejs, and .mts. checkExts adds extensions to that set.

The temporary directory receives a separate executable-file check covering source, shell scripts, and binary formats. Keep generated application source in the directories intended for those outputs. Top-level project files are outside the directory walk, and npm dependency internals are outside the default scan.

Source analysis uses patterns and binding recognition, with limited handling of aliases and quoted text. Review scanner findings in context. This mechanism covers recognized forms within the scanned files; arbitrary JavaScript can exceed that coverage.

Policy Settings

  • allowNodeDeps allows supported Node.js built-in imports. allowBareDeps enables consideration of npm-style imports, which must also satisfy allowedDeps. An allowedDeps entry uses roots for requester scopes and require for module names. Its pack field is currently a policy label.
  • allowedImports uses pack labels and files patterns for configured import targets. allowedFileAccess uses pack labels and roots patterns for filesystem targets. Paths are resolved relative to the project. Review rules for each consuming pack.
  • excludeRoots and excludeDirs reduce scan coverage. allowedExceptions exempts matching dynamic-import or require profiles from parts of the scan. guardIncludes registers helper identifiers recognized as include functions. It does not add files to the directory walk.
  • Recognized code generation, alternative runtime loaders, filesystem calls, and process execution also receive dedicated checks. Review any opaque-execution allowance against the operation and source that require it.

Gate File Access

In the project's config.js, enable the pack in config.engineopt.guard.allowedFileAccess. Merge the following engineopt branch into the exported config object, preserving existing guard rules. For a pack labelled storage, the following entry permits access under its directory. A matching enabled file-access rule also permits pack-local targets in the current runtime gate.

                // config.js -> config (merge into the exported object)
                engineopt: {
                    guard: {
                        allowedFileAccess: [
                            {
                                pack: 'storage',
                                roots: ['system-lrpcks/storage/**']
                            }
                        ]
                    }
                }
            

In the pack's main.js, pass the path through engine.fileaccess inline at the filesystem call. This example returns a library API. Its parent directory already exists as the pack directory.

                import { writeFileSync } from 'node:fs'
                import { defineLayer } from '#core:layers'

                export default defineLayer(({ engine }) => ({
                    save(message) {
                        writeFileSync(engine.fileaccess('./message.txt'), String(message), 'utf8')
                    }
                }))
            

fileaccess returns a validated absolute path. It performs no file operation itself. For rename or copy operations, gate both source and destination.

Gate Dynamic Imports

For supported runtime imports, use engine.importing or engine.requiring, or the importing and requiring exports of #core:loaders. These gates resolve the caller's pack context from the execution stack and evaluate the target against allowedImports.

                const helper = await engine.importing('./helper.js')
            

Declare the permitted target in allowedImports before using the gate, including pack-local targets. Absolute paths and schemes such as file:, data:, and https: are rejected by these runtime gates. Explicit gate calls validate paths when invoked even if the startup Guardian scan was disabled.

Runtime Scope

Guardian's source checks and explicit runtime gates depend on reviewed code following supported patterns. They do not intercept every operation available to code in the Node.js process. The configured Core and host permissions remain trusted. Validate application input and choose filesystem and deployment permissions for the resources the process should access.