golang-security

Identify and remediate security vulnerabilities in Go code and architecture.

2|Updated Mar 13, 2023
One-click install
npx skills add https://github.com/haipham22/golang-sample --skill golang-security-haipham22
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-security
Source: https://github.com/haipham22/golang-sample/tree/main/.agents/skills/golang-security
Command: npx skills add https://github.com/haipham22/golang-sample --skill golang-security-haipham22

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you find, prevent, and fix security flaws in Go applications before they ship, especially in code paths that handle user input, authentication, encryption, files, network calls, and logs.

Core Features & Use Cases

  • Security Review Guidance: Audit Go code for injection, SSRF, XSS, path traversal, unsafe deserialization, weak crypto, secret leakage, and race conditions.
  • Secure Implementation Patterns: Write safer handlers, clients, middleware, and storage code using vetted Go primitives and defense-in-depth defaults.
  • Operational Hardening: Apply best practices for JWT validation, password hashing, cookie flags, rate limiting, timeout configuration, security headers, and observability hygiene.
  • Use Case: Review a new API endpoint that accepts external input, traces data flow through handlers and services, and returns prioritized remediation steps with clear security rationale.

Quick Start

Use the golang-security skill to review this Go code for vulnerabilities and rewrite any risky parts using secure, production-ready patterns.

Frequently Asked Questions about golang-security

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

FAQPage Schema
How do I review Go code for security vulnerabilities like injection and SSRF?

To review Go code for security vulnerabilities, you need to trace data flow through handlers and services to identify injection, SSRF, and path traversal risks, then apply prioritized remediation steps using vetted Go primitives and validation patterns.

What are the secure implementation patterns for authentication and cryptography in Go?

Secure authentication and cryptography in Go require constant-time comparison, proper TLS configuration, and vetted password hashing primitives to prevent weak crypto and secret leakage, ensuring defense-in-depth defaults across handlers and middleware.

How do I prevent path traversal and unsafe file access in Go applications?

Preventing path traversal and unsafe file access in Go requires applying scoped file access controls and strict input validation to ensure filesystem operations cannot be manipulated by external user input.

Can I use this approach to audit Go concurrency and race conditions?

Yes, you can audit Go concurrency and race conditions by reviewing code paths for synchronization issues and applying secure Go primitives to prevent exploitable race conditions in multi-threaded operations.

What is the best way to harden Go web APIs against XSS and secret leakage?

The best way to harden Go web APIs against XSS and secret leakage involves applying security headers, rate limiting, proper cookie flags, and observability hygiene to prevent sensitive data exposure in logs and responses.

How do I validate JWT tokens and configure TLS securely in Go?

Validating JWT tokens and configuring TLS securely in Go involves applying strict validation patterns, setting secure timeout configurations, and enforcing defense-in-depth defaults to protect authentication flows and network calls.