Giter VIP home page Giter VIP logo

semgrep-rules's Introduction

Trail of Bits public Semgrep rules

This repository contains Semgrep rules developed by Trail of Bits and made available to the public. They are part of our ongoing development efforts and are used in our security audits, vulnerability reseach, and internal projects. They will evolve over time as we identify new techniques.

Using Semgrep

To run individual rules from your terminal, navigate to the root folder of your project and run the following:

$ semgrep --config /path/to/semgrep-rules/semgreprule.yml

To run all rules:

$ semgrep --config /path/to/semgrep-rules/ .

Useful flags

Semgrep will run against all supported code files except for those in your .gitignore file. If you want to run the rules against all files and directories, including those in your .gitignore, add the --no-git-ignore flag.

$ semgrep --config /path/to/semgrep-rules/ . --no-git-ignore

You can also tell Semgrep to ignore files and directories that match any pattern. For instance, if you want to tell Semgrep to ignore all Go test files you can run the following:

$ $ semgrep --config /path/to/semgrep-rules/ . --exclude='*_test.go'

Use -o to output results to a file:

$ semgrep --config /path/to/semgrep-rules/hanging-goroutine.yml -o leaks.txt'

Rules

Rule ID Language What it Finds
anonymous-race-condition Go Race conditions within anonymous goroutines
hanging-goroutine Go Goroutine leaks
iterate-over-empty-collection Go Iterations over empty collection
nil-check-after-call Go Possible nil dereferences
questionable-assignment Go Possible unintentional assignment when an error occurs
nondeterministic-select Go Nondeterministic select logic.
servercodec-readrequestbody-unhandled-nil Go Possible incorrect ServerCodec interface implementation
sleep-used-for-synchronizations Go Uses time.Sleep for goroutine synchronizations
string-to-int-signedness-cast Go Integer underflows
sync-mutex-value-copied Go Copying of sync.Mutex via value receivers
waitgroup-add-called-inside-goroutine Go Calls to sync.WaitGroup.Add inside of anonymous goroutines
waitgroup-wait-inside-loop Go Calls to sync.WaitGroup.Wait inside a loop
tarfile-extractall-traversal Python Potential path traversal in call to extractall for a tarfile

semgrep-rules's People

Contributors

hex0punk avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.