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

nosemgrep comments not honored by extension in python #159

Open
forana opened this issue Jul 30, 2024 · 7 comments
Open

nosemgrep comments not honored by extension in python #159

forana opened this issue Jul 30, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@forana
Copy link

forana commented Jul 30, 2024

Anonymized python:

class MyClass (
    ABadClass,  # nosemgrep: myrule
    AnotherClass,
    ADifferentClass,
): ...

Anonymized rule:

  - id: myrule
    languages:
      - python
    severity: ERROR
    message: Do not use ABadClass
    pattern-regex: .*ABadClass.*

Via CLI, the nosemgrep line correctly ignores the error. Via the plugin, the error is not ignored.

@forana forana changed the title semgrepignore comments not honored by extension in python nosemgrep comments not honored by extension in python Jul 30, 2024
@forana
Copy link
Author

forana commented Jul 30, 2024

Interestingly, when the useJS setting is enabled - the nosemgrep comments are honored. nevermind, the extension took abnormally long to update.

@ajbt200128
Copy link
Contributor

thanks for the report, we'll look into this! Can you try running the cli with the --experimental flag as the first flag, and see if semgrep still ignores it?

@forana
Copy link
Author

forana commented Jul 30, 2024

@ajbt200128 via semgrep scan --experimental -f path/to/my/config --include=path/to/example/file, I see that all of my rules are scanned and no findings are found - so, looks like semgrep still honors it there.

@ajbt200128
Copy link
Contributor

thanks, that's super useful, looks like it's definitely a bug on the extension side then

@forana
Copy link
Author

forana commented Jul 30, 2024

Suppose I should add: semgrep version = 1.81.0

@ajbt200128 ajbt200128 added the bug Something isn't working label Aug 28, 2024
@forana
Copy link
Author

forana commented Dec 19, 2024

Noting that this still occurs on version 1.101.0

@forana
Copy link
Author

forana commented Dec 19, 2024

FWIW @ajbt200128 this may be an upstream issue with the LSP - per the nosemgrep docs:

Ignoring code through this method still generates a finding. The finding is automatically set to the Ignored triage state.

If the LSP is sending these through and ignoring that state change, that would explain it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants