phoenix-authorization-patterns

Enforce server-side authorization in Phoenix LiveView and controllers.

149|15|Updated Jan 23, 2026
One-click install
npx skills add https://github.com/j-morgan6/elixir-phoenix-guide --skill phoenix-authorization-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: phoenix-authorization-patterns
Source: https://github.com/j-morgan6/elixir-phoenix-guide/tree/main/skills/phoenix-authorization-patterns
Command: npx skills add https://github.com/j-morgan6/elixir-phoenix-guide --skill phoenix-authorization-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Enforce robust server-side authorization for Phoenix apps to prevent data leakage and insecure UI patterns.

Core Features & Use Cases

  • Standardizes authorization checks across LiveView and controllers.
  • Encourages use of policy modules and scoped queries to enforce ownership and access control.
  • Provides testing patterns to validate both authorized and unauthorized paths across UI and API boundaries.

Quick Start

Implement a policy-based guard in a LiveView or controller to ensure only the owner can mutate resources.

Frequently Asked Questions about phoenix-authorization-patterns

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

FAQPage Schema
How do I enforce server-side authorization in Phoenix LiveView?

Standardize Phoenix authorization by applying policy modules and scoped queries within LiveView and controllers to enforce server-side ownership and access control checks. This prevents data leakage and insecure UI patterns across boundaries.

What is the best way to standardize policy-based permissions in Phoenix controllers?

Standardize Phoenix controller authorization by applying policy modules and scoped queries to enforce server-side ownership and access control checks. This provides consistent validation across authorized and unauthorized paths to prevent insecure UI patterns.

Why do I need scoped queries for ownership checks in Phoenix applications?

Scoped queries enforce ownership checks in Phoenix applications by filtering data at the database level, preventing data leakage and insecure UI patterns. They ensure users only access or mutate resources they own when paired with policy modules.

How do I test authorized and unauthorized paths in Phoenix authorization?

Test authorized and unauthorized paths in Phoenix authorization by validating policy modules across LiveView and controller boundaries. This confirms access control correctly grants owner permissions while denying unauthorized mutations to prevent data leakage.

Can I use policy modules to protect ownership in both LiveView and controllers?

Yes, use policy modules to protect ownership in both LiveView and controllers by standardizing server-side authorization patterns. This enforces consistent access control and prevents data leakage across UI and API boundaries.