implement-authorization — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited implement-authorization (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
| Gem | Pattern | Best For |
|---|---|---|
| Pundit | Explicit policy classes | Complex per-resource rules |
| CanCanCan | Centralized Ability class | Simple role-based permissions |
pundit or cancancan to Gemfile and run bundle installrails g pundit:install or rails g cancan:ability)authorize @record (Pundit) or authorize! :action, @record (CanCanCan) in each actionPundit::NotAuthorizedError or CanCan::AccessDenied as expected; use persisted records (e.g., User.create!) not unsaved onespolicy_scope(Model) or accessible_by(current_ability) for index actions#### Pundit
class PostPolicy < ApplicationPolicy
def update?
user.admin? || record.user_id == user.id
end
end#### CanCanCan
class Ability
include CanCan::Ability
def initialize(user)
can :update, Post, user_id: user.id
can :manage, :all if user.admin?
end
end| Error | Likely Cause | Fix |
|---|---|---|
Pundit::NotDefinedError | No policy class found for the record | Create app/policies/model_policy.rb inheriting from ApplicationPolicy |
Pundit::AuthorizationNotPerformedError | authorize not called in a controller action | Add authorize @record in the action, or after_action :verify_authorized to catch misses |
CanCan::AccessDenied unexpectedly raised | Ability rules not matching the current user/role | Inspect current_ability.can?(:action, @record) in the console to debug rule evaluation |
Cover every role (admin, owner, guest) in both policy specs and request specs.
#### Minimal Pundit policy spec
RSpec.describe PostPolicy do
subject { described_class.new(user, post) }
let(:post) { create(:post, user: owner) }
let(:owner) { create(:user) }
context 'as admin' do
let(:user) { create(:user, :admin) }
it { is_expected.to permit_action(:update) }
end
context 'as owner' do
let(:user) { owner }
it { is_expected.to permit_action(:update) }
end
context 'as guest' do
let(:user) { create(:user) }
it { is_expected.not_to permit_action(:update) }
end
endWhen implementing or reviewing authorization, the output answer.md must include:
User.create!, Post.create!), never unsaved ones.curl requests or controller test commands with expected HTTP response codes (e.g. 403 Forbidden or 302 Found) when access is denied.See [references/output-style.md](references/output-style.md) for full formatting examples including Pundit and CanCanCan console output templates.
| Skill | When to chain |
|---|---|
| write-tests | When implementing authorization tests. |
Load these files only when their specific content is needed:
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.