gosec  by securego

Go security checker for scanning Go AST and SSA code

created 9 years ago
8,382 stars

Top 6.2% on sourcepulse

GitHubView on GitHub
Project Summary

gosec is a Go security checker that inspects source code for security vulnerabilities by analyzing the Go Abstract Syntax Tree (AST) and Static Single Assignment (SSA) representations. It helps developers identify and mitigate common security risks in their Go applications, supporting integration with CI/CD pipelines and offering various output formats for reporting.

How It Works

gosec scans Go source code by parsing it into an AST and then into an SSA representation. This allows for deeper analysis of code flow and data propagation, enabling the detection of a wide range of security issues, from hardcoded credentials and insecure TLS configurations to potential denial-of-service vulnerabilities and improper file permissions. Its rule-based approach is extensible, with a comprehensive list of checks mapped to CWEs.

Quick Start & Requirements

  • Install via go install github.com/securego/gosec/v2/cmd/gosec@latest or using the provided install script.
  • Requires Go toolchain.
  • Official documentation: https://github.com/securego/gosec

Highlighted Details

  • Detects over 100 security vulnerabilities across various categories.
  • Supports AI-assisted vulnerability fixing suggestions (e.g., using Gemini).
  • Integrates with GitHub Actions for automated security scanning and SARIF output.
  • Offers extensive configuration options for rule selection, exclusion, and output formats (JSON, SARIF, SonarQube, etc.).

Maintenance & Community

  • Actively maintained by the securego community.
  • Development information available in CONTRIBUTING.md.
  • Release process involves tagging and automated builds/publishing via goreleaser.

Licensing & Compatibility

  • Licensed under the Apache License, Version 2.0.
  • Permissive license suitable for commercial use and integration into closed-source projects.

Limitations & Caveats

  • Some rules may require specific Go versions or have known limitations (e.g., G601 for Go 1.21 or lower).
  • AI-assisted fixing relies on external API providers and requires API keys.
  • False positives are possible and can be suppressed via #nosec comments or configuration.
Health Check
Last commit

5 days ago

Responsiveness

1 day

Pull Requests (30d)
8
Issues (30d)
3
Star History
219 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.