go-secure

Sanitize Go errors crossing trust boundaries with domain error types and slog redaction.

1|Updated Apr 3, 2026
One-click install
npx skills add https://github.com/nq-rdl/agent-extensions --skill go-secure-nq-rdl
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-secure
Source: https://github.com/nq-rdl/agent-extensions/tree/main/skills/go-secure
Command: npx skills add https://github.com/nq-rdl/agent-extensions --skill go-secure-nq-rdl

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Secure Go error handling and information leakage prevention. Use whenever writing Go code that handles errors in APIs, services, or any code that crosses trust boundaries — HTTP handlers, gRPC services, CLI tools with user-facing output. Also trigger when reviewing Go error handling, implementing structured logging, or when the user mentions security, error sanitization, or preventing data leaks through error messages — even if they don't explicitly say "security". Covers domain error types, trust boundary translation, log redaction with slog, and safe API responses.

Core Features & Use Cases

  • Domain error types separate safe user messages from internal errors to prevent leakage.
  • Trust boundary translation automatically maps DomainError to HTTP/GRPC statuses.
  • Structured logging with redaction using slog to avoid exposing sensitive data.
  • Contextual metadata allowlisting to prevent log bloat and leakage.

Quick Start

Apply secure Go error handling patterns to ensure errors crossing trust boundaries are translated and redacted before reaching clients.

Frequently Asked Questions about go-secure

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

FAQPage Schema
How do I prevent data leakage in Go error messages across trust boundaries?

To prevent data leakage in Go error messages, you should use domain error types that separate safe user messages from internal errors. This ensures implementation details are redacted before reaching clients in APIs or services.

How do I redact sensitive data when using slog for structured logging in Go?

Redact sensitive data in slog by applying contextual metadata allowlisting during structured logging. This prevents log bloat and leakage by filtering out sensitive information before it is written to your Go application logs.

How do I map Go domain errors to HTTP and gRPC response statuses?

Map Go domain errors to HTTP and gRPC statuses through trust boundary translation. This automatically converts internal DomainError types into appropriate user-visible HTTP handler or gRPC endpoint responses without leaking internal stack traces.

What is the best way to sanitize CLI tool output to avoid exposing internal errors?

Sanitize CLI tool output by applying trust boundary translation and opaque wrapping to Go errors. This prevents exposing internal implementation details by ensuring only safe, redacted messages are displayed to the user in CLI tools.

When do I need opaque wrapping for Go error handling?

You need opaque wrapping for Go error handling when errors cross trust boundaries like HTTP handlers or gRPC endpoints. It prevents leaking implementation details by hiding internal error structures from user-visible API responses.