# GHSA-P863-6MHW-7W5J: Summary The AgentScript preset of @enclave-vm/ast is the static layer of the sandbox: it decides which scripts are run at all

- Database: GitHub
- Severity: high (stated by ghsa, no CVSS score)
- Published: 2026-11-15
- Modified: 2026-11-15

## Affected versions

- @enclave-vm/ast (npm): through 2.18.0

## Description

### Summary

The AgentScript preset of `@enclave-vm/ast` is the static layer of the sandbox: it decides which scripts are run at all. Several of its rules matched one way of writing a construct and missed the others, so a script could pass validation while using a global, a property or a call the preset is documented to refuse. `@enclave-vm/core` and `@enclave-vm/browser` validate with this preset.

### Details

All references are to v2.18.0.

1. **Scope confusion.** `UnknownGlobalRule` and the identifier transform kept one set of declared names for the whole program. A declaration in a nested block, an arrow-function parameter or a catch clause made the same name count as a local variable everywhere, so a use of the real global of that name elsewhere in the script was neither reported nor rewritten.
2. **Write targets were not checked.** Identifiers in assignment targets, destructuring patterns and `for…of` heads are visited by the parser's walker as patterns, not as identifiers, and no rule looked at them. A script could assign to an allowed global or to a reserved runtime name.
3. **Syntax nobody listed.** Each rule named what it refused. `this` used as a value, classes without methods, `new.target` and `debugger` were on no list and were accepted, although the language description says `this` is blocked.
4. **Reflection by property name.** The legacy accessor methods were refused in destructuring but not as members; the prototype and descriptor functions of `Object` were matched only as a direct call on `Object`, so an alias, a literal key, `.call` or passing the method as a value passed; an object literal with a `__proto__` key was accepted.
5. **Indirect calls.** The rules that require a literal tool name for `callTool` and forbid callbacks for `JSON` only saw a direct call. An alias, `.call`, a tagged template, a sequence callee or passing the function as a callback took the call out of their sight; an aliased `callTool` with a computed name reached the tool handler.
6. **Regular expressions from strings.** `match`, `matchAll` and `search` compile a string argument into a regular expression, which the regex rules did not treat as one.
7. **Loop counters.** The counter that enforces `maxIterations` was a variable in the script's own scope with a predictable name.

The fix: a syntax allowlist (`AllowedSyntaxRule`), lexical scope analysis shared by the rule and the transform (checked against `eslint-scope` on 350,000 generated programs), write targets treated as references, property names refused in every statically resolvable spelling, `callTool` and `JSON` restricted to direct use, and counter names a script cannot mention.

### Proof of concept

No reproduction is given here. Regression tests, in the private repository `agentfront/enclave-security-tests`: ATK-SYNTAX, ATK-SCOPE, ATK-GWRITE, ATK-PCHAIN, ATK-REFL, ATK-CTGT, ATK-JSONCB, ATK-RXSTR and ATK-LCTR in `specs/ast/agentscript.syntax-hardening.spec.ts`, and the case folders `ast-*`.

### Impact

The static layer could be passed by scripts it was meant to refuse. On its own this gives a script names and operations the runtime layers then have to stop; together with the runtime defects fixed in the same release (see the advisories for `@enclave-vm/core`) it was part of a full sandbox escape. Applications that use `@enclave-vm/ast` as their only control are affected directly.

### Patches

Fixed in 2.19.0.

### Workarounds

None. Do not rely on validation alone for scripts from an untrusted source.

## References

- https://github.com/agentfront/enclave/security/advisories/GHSA-p863-6mhw-7w5j

Page: https://cve.now/GHSA-P863-6MHW-7W5J

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
