security

A set of security instructions for Electron and web applications, including authentication, input handling, secrets, and common attacks.

In plain words
What is it for?
It is for implementing or reviewing login permissions, input validation, secret handling, external data processing, and secure Electron settings.
Why use it?
It helps reduce risks such as unauthorized access, unsafe user input, cross-site scripting, request forgery, and injection attacks.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/macromania/agentop/security
Any agent
npx skills add macromania/agentop --skill security
Clone the repo
git clone --depth 1 https://github.com/macromania/agentop

Made for: Claude Code, Codex.

Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,967 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00052 $0.02967
Opus 5 $0.00026 $0.01484
Sonnet 5 $0.00010 $0.00593
Haiku 4.5 $0.00005 $0.00297

Measured 2d ago against content hash 3e438d9a60b2, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

security scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

exec: require('child_process').exec, // Never do this!
.github/skills/security/SKILL.md · 476 lines

How it starts

The opening of the file, as written. The whole thing — 476 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Security Best Practices

Security patterns and practices for building secure Electron applications with proper input validation, authentication, and defense against common vulnerabilities.

When to Use This Skill

  • Implementing authentication/authorization
  • Handling user input
  • Managing secrets and API keys
  • Processing external data
  • Reviewing code for security issues
  • Setting up Electron security

Core Security Principles

Defense in Depth

Layer multiple security controls:

// Layer 1: Input validation at entry point
function handleUserInput(input: string): void {
  const validated = validateInput(input);
  
  // Layer 2: Sanitization before processing
  const sanitized = sanitizeForProcessing(validated);
  
  // Layer 3: Parameterized queries (no string concatenation)
  await db.query('SELECT * FROM items WHERE name = ?', [sanitized]);
  
  // Layer 4: Output encoding for display
  const encoded = encodeForHTML(sanitized);
}

Principle of Least Privilege

Request only necessary permissions:

// ❌ Overly permissive
mainWindow = new BrowserWindow({
  webPreferences: {
    nodeIntegration: true,  // Dangerous!
    contextIsolation: false,  // Dangerous!
  }
});

// ✅ Minimal permissions
mainWindow = new BrowserWindow({
  webPreferences: {
    nodeIntegration: false,
    contextIsolation: true,
    sandbox: true,
    webSecurity: true,
    preload: path.join(__dirname, 'preload.js'),
  }
});

Electron Security

Secure Window Configuration

// src/main/window.ts
export function createSecureWindow(): BrowserWindow {
  const mainWindow = new BrowserWindow({
    width: 1200,
    height: 800,
    webPreferences: {
      // Security essentials
      nodeIntegration: false,
      contextIsolation: true,
      sandbox: true,
      webSecurity: true,
      allowRunningInsecureContent: false,
      
      // Preload for safe IPC
      preload: path.join(__dirname, 'preload.js'),
    },
  });
  
  // Prevent navigation to external URLs
  mainWindow.webContents.on('will-navigate', (event, url) => {
    const allowed = ['http://localhost:', 'file://'];
    if (!allowed.some(prefix => url.startsWith(prefix))) {
      event.preventDefault();
      console.warn('Blocked navigation to:', url);
    }
  });
  
  // Prevent new windows
  mainWindow.webContents.setWindowOpenHandler(({ url }) => {
    shell.openExternal(url);  // Open in system browser
    return { action: 'deny' };
  });
  
  return mainWindow;
}

Read the full file on GitHub · 476 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 476 lines · 52 tokens per session scan A 3e438d9a60b2

Subscribe to this mod's changes

security is a skill published in the GitHub repository macromania/agentop (10 stars, last pushed 5mo ago), licensed MIT. It adds 52 tokens to every session and 2,967 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.