# Insecure Cookie Configuration

> Detects cookies set without Secure, HttpOnly, or SameSite attributes.

- Skill: `zakirkun/insecure-cookie-configuration` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add zakirkun/insecure-cookie-configuration`
- Raw SKILL.md: https://api.skillmd.com/api/skills/zakirkun/insecure-cookie-configuration/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: zakirkun (https://skillmd.com/u/zakirkun)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/zakirkun/insecure-cookie-configuration

---


# Insecure Cookie Configuration

## Overview
Cookies that store session tokens or authentication data must be configured with security attributes to prevent theft and CSRF attacks:
- **Secure**: Cookie only sent over HTTPS
- **HttpOnly**: Cookie inaccessible to JavaScript (prevents XSS token theft)
- **SameSite**: Prevents cross-site request forgery (Strict or Lax)

Missing any of these attributes expands the attack surface.

## Detection Strategy
Look for `Set-Cookie` headers or cookie-setting function calls that omit one or more of the critical security flags.

## Remediation
Always set session cookies with all three security attributes.

**Vulnerable (Go):**
```go
http.SetCookie(w, &http.Cookie{
    Name:  "session",
    Value: token,
})
```

**Safe (Go):**
```go
http.SetCookie(w, &http.Cookie{
    Name:     "session",
    Value:    token,
    Secure:   true,
    HttpOnly: true,
    SameSite: http.SameSiteStrictMode,
})
```

