Semgrep
Semgrep is a fast, rule-based static-analysis tool that finds bugs and security issues in source code across many languages.
Legal & ethical use. Use this tool only on systems, networks and data that you own or have explicit written permission to test. Unauthorised access or scanning can break computer-misuse laws (for example Pakistan's Prevention of Electronic Crimes Act, 2016, and equivalents elsewhere). Practise in your own lab or in authorised environments such as CTFs.
What it is used for
- Scan a repository for insecure patterns in CI
- Write a custom rule to ban a dangerous function
Key features
- Pattern-based rules that look like code
- Large community rule registry
- CI integration
Installation
Install with `pip install semgrep` or use Homebrew/Docker as in the docs.
Beginner usage guide
Run it with a ruleset on a project, then read a finding and its fix guidance.
Example commands
Run these only against your own lab or authorised targets. Placeholder addresses such as 192.0.2.x are documentation ranges.
Scan with the auto config
semgrep scan --config auto .Uses recommended rules for detected languages (needs network access to fetch rules).
Keep learning
References
Source verification
Last reviewed: 2026-10-27
Links checked over HTTP: 2026-10-27 07:51 UTC — official: 200, docs: 200, repo: 200
Commands were written from the official documentation and have not been executed on this site; test them in your lab.
