Fix ast-grep utility IDs for 0.43 parser by coderabbitai[bot] · Pull Request #202 · coderabbitai/ast-grep-essentials · GitHub
Skip to content
Open
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
8 changes: 4 additions & 4 deletions rules/c/security/file-access-before-action-c.yml
16 changes: 8 additions & 8 deletions rules/c/security/file-stat-before-action-c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ note: >-
ast-grep-essentials: true

utils:
PATTERN_1(identifier)nth1:
PATTERN_1_identifier_nth1:
kind: identifier
regex: ^(fopen|freopen|remove|rename|access|open|stat|lstat|unlink|mkdir|rmdir|chdir)$
all:
Expand Down Expand Up @@ -88,7 +88,7 @@ utils:
follows:
regex: ^==$

PATTERN_1(identifier)nth2:
PATTERN_1_identifier_nth2:
kind: identifier
regex: ^(fopen|freopen|remove|rename|access|open|stat|lstat|unlink|mkdir|rmdir|chdir)$
all:
Expand Down Expand Up @@ -172,7 +172,7 @@ utils:
- kind: identifier
regex: ^(fopen|freopen|remove|rename|access|open|stat|lstat|unlink|mkdir|rmdir|chdir)$

PATTERN_3(field_expression)(identifier)nth1:
PATTERN_3_field_expression_identifier_nth1:
kind: field_expression
has:
nthChild: 1
Expand Down Expand Up @@ -251,7 +251,7 @@ utils:
follows:
regex: ^==$

PATTERN_3(field_expression)(identifier)nth2:
PATTERN_3_field_expression_identifier_nth2:
kind: field_expression
has:
nthChild: 1
Expand Down Expand Up @@ -332,7 +332,7 @@ utils:

rule:
any:
- matches: PATTERN_1(identifier)nth1
- matches: PATTERN_1(identifier)nth2
- matches: PATTERN_3(field_expression)(identifier)nth1
- matches: PATTERN_3(field_expression)(identifier)nth2
- matches: PATTERN_1_identifier_nth1
- matches: PATTERN_1_identifier_nth2
- matches: PATTERN_3_field_expression_identifier_nth1
- matches: PATTERN_3_field_expression_identifier_nth2
20 changes: 10 additions & 10 deletions rules/c/security/insecure-hash-c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ utils:
stopBy: neighbor
kind: argument_list

MATCH_PATTERN_TWO_(EVP_MD_fetch):
MATCH_PATTERN_TWO_EVP_MD_fetch:
kind: expression_statement
has:
stopBy: neighbor
Expand All @@ -50,7 +50,7 @@ utils:
kind: string_content
regex: ^(MD2|MD4|MD5|SHA1|SHA-1)$

MATCH_PATTERN_TWO_with_instance_(EVP_MD_fetch):
MATCH_PATTERN_TWO_with_instance_EVP_MD_fetch:
kind: expression_statement
all:
- has:
Expand Down Expand Up @@ -142,7 +142,7 @@ utils:
not:
kind: comment

MATCH_PATTERN_TWO_(EVP_get_digestbyname):
MATCH_PATTERN_TWO_EVP_get_digestbyname:
kind: expression_statement
has:
stopBy: neighbor
Expand Down Expand Up @@ -174,7 +174,7 @@ utils:
not:
kind: comment

MATCH_PATTERN_TWO_with_instance_(EVP_get_digestbyname):
MATCH_PATTERN_TWO_with_instance_EVP_get_digestbyname:
kind: expression_statement
all:
- has:
Expand Down Expand Up @@ -250,7 +250,7 @@ utils:
kind: string_content
regex: ^(MD2|MD4|MD5|SHA1|SHA-1)$

MATCH_PATTERN_THREE_(gcry_md_hash_buffers):
MATCH_PATTERN_THREE_gcry_md_hash_buffers:
kind: expression_statement
has:
stopBy: neighbor
Expand All @@ -277,12 +277,12 @@ rule:
- kind: expression_statement
any:
- matches: MATCH_PATTERN_ONE
- matches: MATCH_PATTERN_TWO_(EVP_MD_fetch)
- matches: MATCH_PATTERN_TWO_with_instance_(EVP_MD_fetch)
- matches: MATCH_PATTERN_TWO_EVP_MD_fetch
- matches: MATCH_PATTERN_TWO_with_instance_EVP_MD_fetch
- matches: MATCH_PATTERN_THREE
- matches: MATCH_PATTERN_TWO_(EVP_get_digestbyname)
- matches: MATCH_PATTERN_TWO_with_instance_(EVP_get_digestbyname)
- matches: MATCH_PATTERN_THREE_(gcry_md_hash_buffers)
- matches: MATCH_PATTERN_TWO_EVP_get_digestbyname
- matches: MATCH_PATTERN_TWO_with_instance_EVP_get_digestbyname
- matches: MATCH_PATTERN_THREE_gcry_md_hash_buffers
not:
all:
- has:
Expand Down
34 changes: 17 additions & 17 deletions rules/c/security/world-writable-file-c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ utils:
kind: argument_list
field: arguments

AND_2_EQUALS_2_&_S_IXXXX:
AND_2_EQUALS_2_S_IXXXX:
any:
- kind: number_literal
regex: ^-?([2367]|[0-9]*(0[2367]|1[014589]|2[2367]|3[014589]|4[2367]|5[014589]|6[2367]|7[014589]|8[2367]|9[014589]))$
Expand All @@ -44,7 +44,7 @@ rule:
any:
# chmod/fchmod/creat
- any:
- matches: AND_2_EQUALS_2_&_S_IXXXX
- matches: AND_2_EQUALS_2_S_IXXXX
- kind: identifier
pattern: $MODE
inside:
Expand All @@ -63,7 +63,7 @@ rule:
pattern: $MODE
- has:
nthChild: 2
matches: AND_2_EQUALS_2_&_S_IXXXX
matches: AND_2_EQUALS_2_S_IXXXX
- kind: expression_statement
any:
- has:
Expand All @@ -75,7 +75,7 @@ rule:
pattern: $MODE
- has:
nthChild: 2
matches: AND_2_EQUALS_2_&_S_IXXXX
matches: AND_2_EQUALS_2_S_IXXXX
- has:
kind: comma_expression
has:
Expand All @@ -87,7 +87,7 @@ rule:
pattern: $MODE
- has:
nthChild: 2
matches: AND_2_EQUALS_2_&_S_IXXXX
matches: AND_2_EQUALS_2_S_IXXXX
nthChild:
position: 2
ofRule:
Expand Down Expand Up @@ -117,7 +117,7 @@ rule:

# fchmodat
- any:
- matches: AND_2_EQUALS_2_&_S_IXXXX
- matches: AND_2_EQUALS_2_S_IXXXX
- kind: identifier
pattern: $MODE
inside:
Expand All @@ -136,7 +136,7 @@ rule:
pattern: $MODE
- has:
nthChild: 2
matches: AND_2_EQUALS_2_&_S_IXXXX
matches: AND_2_EQUALS_2_S_IXXXX
- kind: expression_statement
any:
- has:
Expand All @@ -148,7 +148,7 @@ rule:
pattern: $MODE
- has:
nthChild: 2
matches: AND_2_EQUALS_2_&_S_IXXXX
matches: AND_2_EQUALS_2_S_IXXXX
- has:
kind: comma_expression
has:
Expand All @@ -160,7 +160,7 @@ rule:
pattern: $MODE
- has:
nthChild: 2
matches: AND_2_EQUALS_2_&_S_IXXXX
matches: AND_2_EQUALS_2_S_IXXXX
nthChild:
position: 3
ofRule:
Expand All @@ -183,7 +183,7 @@ rule:

# open
- any:
- matches: AND_2_EQUALS_2_&_S_IXXXX
- matches: AND_2_EQUALS_2_S_IXXXX
- kind: identifier
pattern: $MODE
inside:
Expand All @@ -202,7 +202,7 @@ rule:
pattern: $MODE
- has:
nthChild: 2
matches: AND_2_EQUALS_2_&_S_IXXXX
matches: AND_2_EQUALS_2_S_IXXXX
- kind: expression_statement
any:
- has:
Expand All @@ -214,7 +214,7 @@ rule:
pattern: $MODE
- has:
nthChild: 2
matches: AND_2_EQUALS_2_&_S_IXXXX
matches: AND_2_EQUALS_2_S_IXXXX
- has:
kind: comma_expression
has:
Expand All @@ -226,7 +226,7 @@ rule:
pattern: $MODE
- has:
nthChild: 2
matches: AND_2_EQUALS_2_&_S_IXXXX
matches: AND_2_EQUALS_2_S_IXXXX
nthChild:
position: 3
ofRule:
Expand Down Expand Up @@ -256,7 +256,7 @@ rule:

# openat
- any:
- matches: AND_2_EQUALS_2_&_S_IXXXX
- matches: AND_2_EQUALS_2_S_IXXXX
- kind: identifier
pattern: $MODE
inside:
Expand All @@ -275,7 +275,7 @@ rule:
pattern: $MODE
- has:
nthChild: 2
matches: AND_2_EQUALS_2_&_S_IXXXX
matches: AND_2_EQUALS_2_S_IXXXX
- kind: expression_statement
any:
- has:
Expand All @@ -287,7 +287,7 @@ rule:
pattern: $MODE
- has:
nthChild: 2
matches: AND_2_EQUALS_2_&_S_IXXXX
matches: AND_2_EQUALS_2_S_IXXXX
- has:
kind: comma_expression
has:
Expand All @@ -299,7 +299,7 @@ rule:
pattern: $MODE
- has:
nthChild: 2
matches: AND_2_EQUALS_2_&_S_IXXXX
matches: AND_2_EQUALS_2_S_IXXXX
nthChild:
position: 4
ofRule:
Expand Down
12 changes: 6 additions & 6 deletions rules/cpp/security/file-access-before-action-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ note: >-
ast-grep-essentials: true

utils:
PATTERN_1(identifier):
PATTERN_1_identifier:
kind: identifier
regex: ^(fopen|freopen|remove|rename|access|open|stat|lstat|unlink|mkdir|rmdir|chdir)$
all:
Expand Down Expand Up @@ -92,7 +92,7 @@ utils:
follows:
regex: ^==$

PATTERN_2(qualified_identifier):
PATTERN_2_qualified_identifier:
kind: qualified_identifier
any:
- regex: ^(folly::readFile|folly::writeFile|folly::writeFileAtomic|folly::writeFileAtomicNoThrow|folly::File)$
Expand Down Expand Up @@ -184,7 +184,7 @@ utils:
- regex: ^(folly::readFile|folly::writeFile|folly::writeFileAtomic|folly::writeFileAtomicNoThrow|folly::File)$
- regex: ^(boost::)?(filesystem::file_size|filesystem::create_directory|filesystem::create_directories|filesystem::remove|filesystem::remove_all|filesystem::rename|filesystem::copy_file|filesystem::copy|filesystem::copy_directory|filesystem::resize_file|filesystem::last_write_time|filesystem::permissions|filesystem::symlink_status|filesystem::create_symlink|filesystem::create_hard_link|filesystem::read_symlink)$

PATTERN_3(field_expression):
PATTERN_3_field_expression:
kind: field_expression
has:
nthChild: 1
Expand Down Expand Up @@ -270,6 +270,6 @@ utils:

rule:
any:
- matches: PATTERN_1(identifier)
- matches: PATTERN_2(qualified_identifier)
- matches: PATTERN_3(field_expression)
- matches: PATTERN_1_identifier
- matches: PATTERN_2_qualified_identifier
- matches: PATTERN_3_field_expression
24 changes: 12 additions & 12 deletions rules/cpp/security/file-stat-before-action-cpp.yml
Loading