You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
build-typescript still enforces sandbox-only import rules for trusted routes #124
0.4.0-alpha.2 makes function/middleware routes trusted and unsandboxed by default (sandbox: true is now the opt-in for the isolated QuickJS/WASM path) — see docs/SPIKE-DEFAULT-TRUST-MODEL.md and docs/FUNCTION-SECURITY.md.
Gap
src/typescript-authoring.ts (buildTypeScriptProject, used by urlcode build-typescript) was not updated as part of that change. It still applies the sandbox's own module rules to every function/middleware it transpiles, regardless of whether the route declares sandbox: true:
only relative .ts/.js/.mjs imports are accepted (Only relative guest module imports are supported)
no dynamic import(), bare specifiers, or import.meta
So a project authoring a trusted route in TypeScript is still restricted to the narrower sandboxed-guest import surface at build time, even though the emitted JavaScript will run with full Node access once served (bare imports, npm packages, dynamic import(), no size ceiling). This is documented as a known limitation in docs/TYPESCRIPT-AUTHORING.md (added alongside the trust-model PR), but the build itself doesn't yet distinguish the two modes.
Suggested fix
Give buildTypeScriptProject (or its caller) the same sandbox-aware branch src/policy.ts's prepareFunctionSnapshot now has: for a route whose YAML declares sandbox: true, keep today's relative-import-only/size-limited transpile; for a trusted route, transpile without those restrictions (still no importing application code into Node, still no semantic type-checking — just relax the import/size rules the sandbox specifically needs).
Files involved
src/typescript-authoring.ts — the build pipeline enforcing the restriction unconditionally
docs/TYPESCRIPT-AUTHORING.md — already notes the gap; update once fixed
test/typescript-authoring.test.ts — add coverage for a trusted route using a bare/dynamic import once fixed
Filed per this repo's "file what you find" convention while implementing the trusted-by-default change; not blocking that PR since the build restriction is a compatibility ceiling, not a security regression (routes can still be authored directly in JS to get full trusted capability today).
Activity
Trusted-by-default function/middleware execution, sandbox as opt-in (#…
Make build-typescript sandbox-aware like prepareFunctionSnapshot (#148)