Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions rule_schema_v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ $defs:
- $ref: "#/$defs/metavariable-pattern"
- $ref: "#/$defs/metavariable-type"
- $ref: "#/$defs/semgrep-internal-metavariable-name"
- $ref: "#/$defs/metavariable-name"
- $ref: "#/$defs/metavariable-comparison"
- $ref: "#/$defs/pattern-where-python"
pattern-either-content:
Expand Down Expand Up @@ -647,6 +648,38 @@ $defs:
required:
- metavariable-type
additionalProperties: false
metavariable-name:
type: object
properties:
# NOTE: Similar to the semgrep-internal-* variant, but doesn't yet permit
# a `kind` constraint.
metavariable-name:
type: object
title: Filter for metavariables with a certain kind
properties:
metavariable:
type: string
title: Metavariable to match
module:
title: A module name
type: string
modules:
title: A list of module names
type: array
items:
type: string
required:
- metavariable
oneOf:
- required:
- module
- required:
- modules
additionalProperties: false
required:
- metavariable-name
additionalProperties: false
# EXPERIMENTAL variant
semgrep-internal-metavariable-name:
type: object
properties:
Expand All @@ -657,6 +690,8 @@ $defs:
metavariable:
type: string
title: Metavariable to match
# If updating kind, consider if this experimental version can be
# removed in favour of the non-prefixed one.
kind:
title: Kind keyword
type: string
Expand Down
2 changes: 1 addition & 1 deletion rule_schema_v2.atd
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ type metavariable_cond = {
(* for semgrep-internal-metavariable-name, currently only support
"django-view" kind *)
?kind: string option;
(* for semgrep-internal-metavariable-name; consider renaming? for v2 *)
(* for metavariable-name; consider renaming? for v2 *)
?module_ <json name="module">: string option;
?modules: string list option;

Expand Down