go-security

Enforce security best practices in Go web services and authentication flows.

Updated Dec 15, 2025
One-click install
npx skills add https://github.com/scruffydan/AI-Agents --skill go-security
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-security
Source: https://github.com/scruffydan/AI-Agents/tree/main/source/skills/go-security
Command: npx skills add https://github.com/scruffydan/AI-Agents --skill go-security

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Go applications commonly suffer from security issues such as unsafe template rendering, SQL injection, weak randomness, insecure TLS configurations, and insufficient input validation. This Skill provides a concise, practical checklist to harden Go services by encouraging safe coding practices and secure configurations.

Core Features & Use Cases

  • Enforces safe HTML templating with html/template to prevent XSS
  • Promotes parameterized SQL queries and prepared statements to prevent SQL injection
  • Encourages proper cryptographic randomness using crypto/rand and secure token handling
  • Enforces TLS usage, certificate validation, and modern protocol configurations
  • Emphasizes input validation and robust error handling
  • Integrates with static analysis tools (gosec, go vet, golangci-lint) to catch issues early

Quick Start

Open a Go project and perform a security review focusing on template rendering, database access, and TLS configuration, then apply the recommended fixes.

Frequently Asked Questions about go-security

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent SQL injection in Go web services using parameterized queries?

Prevent SQL injection in Go web services by using parameterized queries and prepared statements with the database/sql package. This enforces strict separation between SQL code and user input, blocking malicious data execution.

What is the best way to prevent XSS when rendering HTML templates in Golang?

Prevent XSS in Golang HTML templates by using the html/template package. It provides contextual auto-escaping for template rendering, ensuring user-supplied data is safely sanitized before output to the browser.

How do I configure secure TLS and robust crypto randomness in a Go application?

Configure secure TLS and crypto randomness in Go applications by enforcing modern protocol configurations, strict certificate validation, and using the crypto/rand package for generating secure tokens and robust randomness.

Can I use gosec and go vet for static analysis to check Go security vulnerabilities?

Yes, you can use gosec and go vet for static analysis to check Go security vulnerabilities. Integrating these tools with golangci-lint configurations catches unsafe code patterns, input validation issues, and template safety risks early.

What are the limitations of relying solely on static analysis for Go security?

Static analysis limitations in Go security mean tools like gosec may miss complex runtime vulnerabilities or logic flaws in authentication flows. You must complement automated checks with robust input validation and secure coding practices.