Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pattern parser throws an error when parsing patterns with explicit private attributes #10258

Open
1 of 3 tasks
kurt-r2c opened this issue May 16, 2024 · 0 comments
Open
1 of 3 tasks
Labels

Comments

@kurt-r2c
Copy link
Contributor

kurt-r2c commented May 16, 2024

Describe the bug
Parser engine throws up when parsing patterns with explicit private attributes, e.g.

rules:
  - id: parser-doesnt-like-private-attributes
    pattern: |
        #$ATTR(...) {
          ...
        }
    message: Semgrep found a match $ATTR
    languages: [ts,js]
    severity: WARNING

The engine parsing targets can handle private attributes just fine - this shows up if you have e.g. a rule that finds function definitions, then you use the metavariable values to construct a new Semgrep rule.

To Reproduce
https://semgrep.dev/playground/s/kx2Zz

as long as you don't use a private attribute explicitly in a pattern, the engine is happy:
https://semgrep.dev/playground/s/NbYA1

further complicating the issue, calling a private attribute with this seems to parse just fine:
https://semgrep.dev/playground/s/eqlwE

Expected behavior
this should parse.

Screenshots
If applicable, add screenshots to help explain your problem.

What is the priority of the bug to you?

  • P0: blocking your adoption of Semgrep or workflow
  • P1: important to fix or quite annoying
  • P2: regular bug that should get fixed

Environment
semgrep.dev, semgrep 1.72.0

Use case
recursively templated scans using results from Semgrep itself

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants