@@ -65,8 +65,8 @@ Only these top-level keys are accepted:
6565- ` patterns ` (optional for structural rules): non-empty YAML array
6666- ` patterns-not ` (optional for structural rules): non-empty YAML array using
6767 the same object schema as ` patterns `
68- - ` inside-expr ` (optional for structural rules): YAML string containing one
69- MoonBit expression snippet used as an outer context
68+ - ` inside-expr ` (optional for structural rules): YAML mapping using the same
69+ ` shape ` and optional ` guard ` schema as ` patterns ` , used as an outer context
7070- ` taint ` (required for taint rules): YAML mapping
7171
7272Unknown top-level keys are rejected.
@@ -88,7 +88,8 @@ including trailing newlines produced by block scalars.
8888
8989### Pattern Objects
9090
91- Structural entries in ` patterns ` and ` patterns-not ` use this object schema.
91+ Structural entries in ` patterns ` , ` patterns-not ` , and ` inside-expr ` use this
92+ object schema.
9293
9394Only these keys are accepted:
9495
@@ -538,12 +539,15 @@ context. It may be used with `patterns`, with `patterns-not`, or with both.
538539id: wrapped-target
539540description: |
540541 Match a target call only inside wrapper(...).
541- inside-expr: wrapper($(prefix:exp), __TARGET__)
542+ inside-expr:
543+ shape: wrapper($(prefix:exp), __TARGET__)
542544patterns:
543545 - shape: target.call($(prefix:exp))
544546` ` `
545547
546- ` inside-expr` is a YAML string parsed as one MoonBit expression snippet.
548+ ` inside-expr` is a YAML mapping. Its `shape` is parsed as one MoonBit
549+ expression snippet, and its optional `guard` filters `id` and `const` captures
550+ declared by that outer shape.
547551
548552Additional rules :
549553
@@ -707,11 +711,11 @@ A rule set or rule file is rejected when any of these conditions occurs:
707711- an unsupported key appears at the top level, inside `taint`, or inside a
708712 pattern object
709713- a required key is missing
710- - ` id` , `description`, `inside-expr`, or `shape` is not a YAML string
714+ - ` id` , `description`, or `shape` is not a YAML string
711715- ` id` is empty or contains `/`
712716- the rule does not choose structural or taint mode
713717- ` inside-expr` appears on a taint rule
714- - ` inside-expr` is present but is not a string
718+ - ` inside-expr` is present but is not a mapping
715719- ` inside-expr` is present without `patterns` or `patterns-not`
716720- ` patterns` is not an array or is empty
717721- a `patterns` entry is not a mapping
@@ -790,7 +794,8 @@ positions. `start`, `limit`, and `body` are expression captures.
790794id: unsafe-wrapper
791795description: |
792796 Match a sink only under an unsafe wrapper.
793- inside-expr: unsafe(__TARGET__)
797+ inside-expr:
798+ shape: unsafe(__TARGET__)
794799patterns:
795800 - shape: sink(__)
796801` ` `
@@ -823,7 +828,8 @@ own `value`; it does not reuse any positive pattern capture.
823828id: wrapper-without-danger
824829description: |
825830 Match wrappers whose payload contains no danger call.
826- inside-expr: wrapper(__TARGET__)
831+ inside-expr:
832+ shape: wrapper(__TARGET__)
827833patterns-not:
828834 - shape: danger()
829835` ` `
0 commit comments