mcpbeat Sign in

Security Skill for Claude

Enforce Elixir/Phoenix security — auth, OAuth, sessions, CSRF, XSS; Use when editing auth files, login flows, RBAC…

8k tokens
context cost
the whole folder, loaded on every use
8
files
instructions only
0
copies elsewhere
how many repositories repackaged it
514
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/oliver-kriska/claude-elixir-phoenix --skill security

What comes with it

28 287 bytes besides the instruction
references/advanced-patterns.md
references/authentication.md
references/authorization.md
references/input-validation.md
references/oauth-linking.md
references/rate-limiting.md
references/security-headers.md

The instruction itself

11 sections, as written by the author

Elixir/Phoenix Security Reference

> Ash projects: AshAuthentication has its own strategy/token patterns — use the ash-framework skill. CSRF, XSS, and secret management patterns below still apply.

Quick reference for security patterns in Elixir/Phoenix.

Iron Laws — Never Violate These

  • VALIDATE AT BOUNDARIES — Never trust client input. All data through changesets
  • NEVER INTERPOLATE USER INPUT — Use Ecto's ^ operator, never string interpolation
  • NO String.to_atom WITH USER INPUT — Atom exhaustion DoS. Use to_existing_atom/1
  • AUTHORIZE EVERYWHERE — Check in contexts AND re-validate in LiveView events
  • ESCAPE BY DEFAULT — Never use raw/1 with untrusted content
  • SECRETS NEVER IN CODE — All secrets in runtime.exs from env vars
  • LIVEVIEW EVENT PARAMS ARE UNTRUSTED — Users can alter forms, hooks, and every phx-value-* in DevTools. Validate and authorize against server-side state before acting

Quick Patterns

Timing-Safe Authentication

def authenticate(email, password) do
  user = Repo.get_by(User, email: email)

  cond do
    user && Argon2.verify_pass(password, user.hashed_password) ->
      {:ok, user}
    user ->
      {:error, :invalid_credentials}
    true ->
      Argon2.no_user_verify()  # Timing attack prevention
      {:error, :invalid_credentials}
  end
end

LiveView Authorization (CRITICAL)

# `id` is client input even when it came from phx-value-id.
# RE-AUTHORIZE IN EVERY EVENT HANDLER
def handle_event("delete", %{"id" => id}, socket) do
  post = Blog.get_post!(id)

  # Don't trust that mount authorized this action!
  with :ok <- Bodyguard.permit(Blog, :delete_post, socket.assigns.current_user, post) do
    Blog.delete_post(post)
    {:noreply, stream_delete(socket, :posts, post)}
  else
    _ -> {:noreply, put_flash(socket, :error, "Unauthorized")}
  end
end

Rendered LiveView events can expose IDs in HTML and websocket payloads. That is

not automatically a vulnerability: treat IDs as public identifiers, never as

proof of access. Use opaque references only when the identifier itself must not

be disclosed, and still perform server-side authorization.

SQL Injection Prevention

# ✅ SAFE: Parameterized queries
from(u in User, where: u.name == ^user_input)

# ❌ VULNERABLE: String interpolation
from(u in User, where: fragment("name = '#{user_input}'"))

Quick Decisions

What to validate?

  • All user input → Ecto changesets
  • File uploads → Extension + magic bytes + size
  • PathsPath.safe_relative/2 for traversal
  • AtomsString.to_existing_atom/1 only

What to escape?

  • HTML output → Auto-escaped by default (<%= %>)
  • User HTML → HtmlSanitizeEx with scrubber
  • Neverraw/1 with untrusted content

Anti-patterns

| Wrong | Right |

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

| "SELECT * FROM users WHERE name = '#{name}'" | from(u in User, where: u.name == ^name) |

| String.to_atom(user_input) | String.to_existing_atom(user_input) |

| <%= raw @user_comment %> | <%= @user_comment %> |

| Hardcoded secrets in config | runtime.exs from env vars |

| Auth only in mount | Re-auth in every handle_event |

| Trusting phx-value-* or hidden IDs | Load server-side state and authorize it |

References

For detailed patterns, see:

  • references/authentication.md - phx.gen.auth, MFA, sessions
  • references/authorization.md - Bodyguard, scopes, LiveView auth
  • references/input-validation.md - Changesets, file uploads, paths
  • references/security-headers.md - CSP, CSRF, rate limiting, headers
  • references/oauth-linking.md - OAuth account linking, token management
  • references/rate-limiting.md - Composite key strategies, Hammer patterns
  • references/advanced-patterns.md - SSRF prevention, secrets management, supply chain

Other skills for the same job

different authors, same section of the catalogue
Backend Security Coder
by ComeOnOliver
×2

Expert in secure backend coding practices specializing in input validation, authentication, and API security. Use PROACTIVELY for backend security implementations or security code reviews.

5k tokens
Cloud Penetration Testing
by ComeOnOliver
×2

This skill should be used when the user asks to "perform cloud penetration testing", "assess Azure or AWS or GCP security", "enumerate cloud resources", "exploit cloud misconfigurations", "test O365 security", "extract secrets from cloud environments", or "audit cloud infrastructure". It provides comprehensive techniques for security assessment across major cloud platforms.

16k tokens
Codebase Cleanup Deps Audit
by ComeOnOliver
×2

You are a dependency security expert specializing in vulnerability scanning, license compliance, and supply chain security. Analyze project dependencies for known vulnerabilities, licensing issues, outdated packages, and provide actionable remediation strategies.

10k tokens
Flow Nexus Platform
by ComeOnOliver
×2

Comprehensive Flow Nexus platform management - authentication, sandboxes, app deployment, payments, and challenges

14k tokens
Linux Privilege Escalation
by ComeOnOliver
×2

This skill should be used when the user asks to "escalate privileges on Linux", "find privesc vectors on Linux systems", "exploit sudo misconfigurations", "abuse SUID binaries", "exploit cron jobs for root access", "enumerate Linux systems for privilege escalation", or "gain root access from low-privilege shell". It provides comprehensive techniques for identifying and exploiting privilege escalation paths on Linux systems.

8k tokens
Malware Analyst
by ComeOnOliver
×2

Expert malware analyst specializing in defensive malware research, threat intelligence, and incident response. Masters sandbox analysis, behavioral analysis, and malware family identification. Handles static/dynamic analysis, unpacking, and IOC extraction. Use PROACTIVELY for malware triage, threat hunting, incident response, or security research.

4k tokens
Metasploit Framework
by ComeOnOliver
×2

This skill should be used when the user asks to "use Metasploit for penetration testing", "exploit vulnerabilities with msfconsole", "create payloads with msfvenom", "perform post-exploitation", "use auxiliary modules for scanning", or "develop custom exploits". It provides comprehensive guidance for leveraging the Metasploit Framework in security assessments.

7k tokens
Mobile Security Coder
by ComeOnOliver
×2

Expert in secure mobile coding practices specializing in input validation, WebView security, and mobile-specific security patterns. Use PROACTIVELY for mobile security implementations or mobile security code reviews.

6k tokens

How to use it

Copy the folder

Take oliver-kriska/claude-elixir-phoenix-codex-security from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.