{"id":13610066,"url":"https://github.com/praetorian-inc/gokart","last_synced_at":"2025-09-28T09:31:11.588Z","repository":{"id":39847917,"uuid":"396907667","full_name":"praetorian-inc/gokart","owner":"praetorian-inc","description":"A static analysis tool for securing Go code","archived":true,"fork":false,"pushed_at":"2024-01-23T01:14:55.000Z","size":194,"stargazers_count":2181,"open_issues_count":32,"forks_count":110,"subscribers_count":27,"default_branch":"main","last_synced_at":"2025-01-12T13:39:12.185Z","etag":null,"topics":["golang","security","security-tools","static-analysis","static-code-analysis"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/praetorian-inc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-16T17:50:56.000Z","updated_at":"2025-01-08T15:29:07.000Z","dependencies_parsed_at":"2024-01-07T01:19:46.403Z","dependency_job_id":"ff958ad9-c980-4b66-b2be-54a8a91e1a7b","html_url":"https://github.com/praetorian-inc/gokart","commit_stats":{"total_commits":34,"total_committers":14,"mean_commits":"2.4285714285714284","dds":0.7352941176470589,"last_synced_commit":"3d38a9ae72f7d67d5c13f83ec5669630868e409e"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praetorian-inc%2Fgokart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praetorian-inc%2Fgokart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praetorian-inc%2Fgokart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praetorian-inc%2Fgokart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/praetorian-inc","download_url":"https://codeload.github.com/praetorian-inc/gokart/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234502975,"owners_count":18843340,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","security","security-tools","static-analysis","static-code-analysis"],"created_at":"2024-08-01T19:01:40.890Z","updated_at":"2025-09-28T09:31:06.180Z","avatar_url":"https://github.com/praetorian-inc.png","language":"Go","funding_links":[],"categories":["开源类库","Go","Open source library","Programming Languages"],"sub_categories":["代码分析","Code Analysis"],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"docs/img/logo.png\" width=\"75%\"\u003e\n\u003c/p\u003e\n\n# GoKart - Go Security Static Analysis\n\n[![CI](https://github.com/praetorian-inc/gokart/workflows/CI/badge.svg)](actions?query=branch%3Adevelopment)\n[![Release](https://github.com/praetorian-inc/gokart/workflows/Release/badge.svg)](releases)\n\nGoKart is a static analysis tool for Go that finds vulnerabilities using\nthe SSA (single static assignment) form of Go source code. It is capable of\ntracing the source of variables and function arguments to determine whether\ninput sources are safe, which reduces the number of false positives compared\nto other Go security scanners. For instance, a SQL query that is concatenated with a variable might\ntraditionally be flagged as SQL injection; however, GoKart can figure out if the variable\nis actually a constant or constant equivalent, in which case there is no vulnerability.\n\nGoKart also helps to power [**Chariot**](https://lp.praetorian.com/l/874901/2021-11-24/dtw1j?utm_source=github\u0026utm_medium=organic_oss\u0026utm_campaign=gokart),\nPraetorian's security platform that helps you find, manage, and fix vulnerabilities in your source\ncode and cloud environments. Chariot makes it simple to run automated, continuous GoKart scans on\nyour source code. If you want to try GoKart, you can set up a free Chariot account in minutes by\nclicking [here](https://chariot.praetorian.com/app/login?register\u0026utm_source=github\u0026utm_medium=organic_oss\u0026utm_campaign=gokart).\n\n## Why We Built GoKart\n\nStatic analysis is a powerful technique for finding vulnerabilities in source code. \nHowever, the approach has suffered from being noisy - that is, many static analysis\ntools find quite a few \"vulnerabilities\" that are not actually real. This has led\nto developer friction as users get tired of the tools \"crying wolf\" one time too\nmany.\n\nThe motivation for GoKart was to address this: could we create a scanner with \nsignificantly lower false positive rates than existing tools? Based on our experimentation\nthe answer is yes. By leveraging source-to-sink tracing and SSA, GoKart is capable\nof tracking variable taint between variable assignments, significantly improving the \naccuracy of findings. Our focus is on usability: pragmatically, that means we \nhave optimized our approaches to reduce false alarms.\n\nFor more information, please read [our blog post](https://www.praetorian.com/blog/introducing-gokart?utm_source=github\u0026utm_medium=organic_oss\u0026utm_campaign=gokart).\n\n## Install\n\nYou can install GoKart locally by using any one of the options listed below.\n\n### Install with `go install`\n\n```shell\n$ go install github.com/praetorian-inc/gokart@latest\n```\n\n### Install a release binary\n\n1. Download the binary for your OS from the [releases page](https://github.com/praetorian-inc/gokart/releases).\n\n2. (OPTIONAL) Download the `checksums.txt` file to verify the integrity of the archive\n\n```shell\n# Check the checksum of the downloaded archive\n$ shasum -a 256 gokart_${VERSION}_${ARCH}.tar.gz\nb05c4d7895be260aa16336f29249c50b84897dab90e1221c9e96af9233751f22  gokart_${VERSION}_${ARCH}.tar.gz\n\n$ cat gokart_${VERSION}_${ARCH}_checksums.txt | grep gokart_${VERSION}_${ARCH}.tar.gz\nb05c4d7895be260aa16336f29249c50b84897dab90e1221c9e96af9233751f22  gokart_${VERSION}_${ARCH}.tar.gz\n```\n\n3. Extract the downloaded archive\n\n```shell\n$ tar -xvf gokart_${VERSION}_${ARCH}.tar.gz\n```\n\n4. Move the `gokart` binary into your path:\n\n```shell\n$ mv ./gokart /usr/local/bin/\n```\n\n### Clone and build yourself\n\n```shell\n# clone the GoKart repo\n$ git clone https://github.com/praetorian-inc/gokart.git\n\n# navigate into the repo directory and build\n$ cd gokart\n$ go build\n\n# Move the gokart binary into your path\n$ mv ./gokart /usr/local/bin\n```\n\n### Docker Support\nBuild the docker image\n```shell\ndocker build -t gokart .\n```\n\nRunning the container with a local scan (the local scan directory needs to be mounted to the container image)\n```shell\ndocker run -v /path/to/scan-dir:/scan-dir gokart scan /scan-dir\n```\n\nRunning the container with a remote scan (when specifying a private key for auth, that will also need to be mounted to the container)\n```shell\ndocker run gokart scan -r https://github.com/praetorian-inc/gokart\n\n# specifying a private key for private repository ssh authentication\ndocker run -v /path/to/key-dir/:/key-dir gokart scan -r git@github.com:praetorian-inc/gokart.git -k /key-dir/ssh_key\n```\n\n## Usage\n\n### Run GoKart on a Go module in the current directory\n\n```shell\n# running without a directory specified defaults to '.'\ngokart scan \u003cflags\u003e\n```\n\n### Scan a Go module in a different directory\n\n```shell\ngokart scan \u003cdirectory\u003e \u003cflags\u003e \n```\n\n### Get Help\n\n```shell\ngokart help\n```\n\n## Getting Started - Scanning an Example App\n\nYou can follow the steps below to run GoKart on [Go Test Bench](https://github.com/Contrast-Security-OSS/go-test-bench),\nan intentionally vulnerable Go application from the Contrast Security team.\n\n```shell\n# Clone sample vulnerable application\ngit clone https://github.com/Contrast-Security-OSS/go-test-bench.git\ngokart scan go-test-bench/\n```\n\nOutput should show some identified vulnerabilities, each with a Vulnerable Function and Source of\nUser Input identified.\n\nTo test some additional GoKart features, you can scan with the CLI flags suggested below.\n\n```shell\n# Use verbose flag to show full traces of these vulnerabilities\ngokart scan go-test-bench/ -v\n\n# Use globalsTainted flag to ignore whitelisted Sources\n# may increase false positive results\ngokart scan go-test-bench/ -v -g\n\n# Use debug flag to display internal analysis information\n# which is useful for development and debugging\ngokart scan go-test-bench/ -d\n\n# Output results in sarif format\ngokart scan go-test-bench/ -s\n\n# Output results to file\ngokart scan go-test-bench/ -o gokart-go-test-bench.txt\n\n# Output scarif results to file\ngokart scan go-test-bench/ -o gokart-go-test-bench.txt -s\n\n# Scan remote public repository \n# Repository will be cloned locally, scanned and deleted afterwards\ngokart scan -r https://github.com/ShiftLeftSecurity/shiftleft-go-demo -v\n\n# Specify the remote branch to scan\ngokart scan -r https://github.com/ShiftLeftSecurity/shiftleft-go-demo -b actions_fix\n\n# Scan remote private repository via ssh\ngokart scan -r git@github.com:Contrast-Security-OSS/go-test-bench.git \n\n# Scan remote private repository and optionally specify a key for ssh authentication \ngokart scan -r git@github.com:Contrast-Security-OSS/go-test-bench.git -k /home/gokart/.ssh/github_rsa_key\n\n# Use remote scan and output flags together for seamless security reviews\ngokart scan -r https://github.com/ShiftLeftSecurity/shiftleft-go-demo -o gokart-shiftleft-go-demo.txt -v \n\n# Use remote scan, output and sarif flags for frictionless integration into CI/CD\ngokart scan -r https://github.com/ShiftLeftSecurity/shiftleft-go-demo -o gokart-shiftleft-go-demo.txt -s\n```\n\nTo test out the extensibility of GoKart, you can modify the configuration file that GoKart uses to\nintroduce a new vulnerable sink into analysis. There is a Test Sink analyzer defined in the included\ndefault config file at `util/analyzers.yml`. Modify `util/analyzers.yml` to remove the comments on\nthe Test Sink analyzer and then direct GoKart to use the modified config file with the `-i` flag.\n\n```shell\n# Scan using modified analyzers.yml file and output full traces\ngokart scan go-test-bench/ -v -i \u003cpath-to-gokart\u003e/util/analyzers.yml\n```\n\nOutput should now contain additional vulnerabilities, including new \"Test Sink reachable by user input\"\nvulnerabilities.\n\n## Run GoKart Tests\n\nYou can run the included tests with the following command, invoked from the GoKart root directory.\n\n```shell\ngo test -v ./...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpraetorian-inc%2Fgokart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpraetorian-inc%2Fgokart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpraetorian-inc%2Fgokart/lists"}