Skip to content

LexerSearch - SAST alternative #692

Closed

Description

@thescanner42

I'm not associated with the Semgrep org but I'm coming from that space. In particular I noticed this issue. It's unfortunate that Semgrep can perform poorly to the point where it needs a hard timeout on the process to bound its time and space usage. It looks like guarddog was running into this problem.

I created a SAST tool which I am calling LexerSearch. It's a new tool and not battle tested. That being said, I've taken a glance through guarddog's Semgrep rules and I think LexerSearch is suitable for the same problems, while providing better performance + time and space.

I migrated the first rule, api obfuscation to show what it would look like with LexerSearch instead. But please keep in mind I could be missing things as I haven't tested it. Here's the rule and playground link:

- patterns:
  - '&_MOD.__dict__[$_F](...)'
  - '&_MOD.__dict__[$_F].__call__(...)'
  - '&_MOD.__getattribute__($_F)(...)'
  - '&_MOD.__getattribute__($_F).__call__(...)'
  - getattr(&_MOD, $_F)(...)
  - getattr(&_MOD, $_F).__call__(...)
  name: name1
  group: ''
  out: {}
  transform:
    _MOD: ^[A-Za-z_][A-Za-z0-9_\.]*$|^__import__\(.*\)$
- patterns:
  - __import__($_MOD).&_F(...)
  - __import__($_MOD).&_F.__call__(...)
  name: name2
  group: ''
  out: {}
  transform:
    _F: '[^(__getattribute__)][A-Za-z_][A-Za-z0-9_]*'

I'm happy to answer any questions.

cc @sobregosodd @kulukami

Activity

  1. sobregosodd commented on Mar 26, 2026

    @sobregosodd
    Collaborator

    Hello @thescanner42 thanks for the heads up, we will take a look.

    Currently guarddog main limitation is semgrep, this doesn't mean that semgrep is a bad tool in itself, but probably is not the best tool for the job.

    We are working in a new version which completely replaces semgrep to overcome our current limitations.

    I will move this issue to a discussion

  2. locked and limited conversation to collaborators on Mar 26, 2026
  3. converted this issue into a discussion #700 on Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions