返回顶部
A

Authorization

Build secure access control with RBAC, ABAC, permissions, policies, and scope-based authorization.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
638
下载量
2
收藏
概述
安装方式
版本历史

Authorization

## When to Use User needs to control what actions users can perform. Agent handles permission design, role hierarchies, policy evaluation, and access control middleware. ## Quick Reference | Topic | File | |-------|------| | RBAC vs ABAC comparison | `models.md` | | Implementation patterns | `patterns.md` | | Framework middleware | `middleware.md` | ## Core Rules ### 1. Auth ≠ Authorization - **Authentication:** Who you are (login, OAuth, tokens) - **Authorization:** What you can do (permissions, roles, policies) - Never mix concerns — auth happens BEFORE authorization ### 2. Principle of Least Privilege - Default deny — explicit grants only - Users get minimum permissions for their job - Audit permissions periodically (revoke unused) - Temporary elevation over permanent grants ### 3. Choose the Right Model | Model | Best For | Complexity | |-------|----------|------------| | ACL | Simple resource ownership | Low | | RBAC | Organizational hierarchies | Medium | | ABAC | Dynamic context-based rules | High | | ReBAC | Social graphs, sharing | High | Start simple → evolve when needed. ### 4. Role Design Patterns - Roles represent jobs, not permissions - Max 3 inheritance levels (admin → manager → user) - Avoid role explosion — combine with ABAC for edge cases - Document role definitions (what can this role DO?) ### 5. Permission Naming ``` resource:action:scope documents:write:own ← Can edit own documents documents:write:team ← Can edit team documents documents:delete:all ← Can delete any document ``` Consistent naming prevents ambiguity. ### 6. Policy Evaluation Order 1. Explicit deny → always wins 2. Explicit allow → checked second 3. No match → default deny 4. Log all denials for debugging ### 7. Never Hardcode ```javascript // ❌ Bad — hardcoded role check if (user.role === 'admin') { ... } // ✅ Good — permission check if (can(user, 'settings:update')) { ... } ``` Roles change. Permissions are stable. ## Common Traps - Checking roles instead of permissions → brittle when roles change - OR logic in permissions → "can edit OR is admin" creates backdoors - Caching permissions too long → stale grants after role changes - Frontend-only checks → always verify server-side - God roles → split "admin" into specific permission sets - Circular inheritance → A inherits B inherits A crashes system ## Security & Privacy **Data that stays local:** - All documentation and patterns are reference material - No data collection or external requests **This skill does NOT:** - Access your codebase automatically - Make network requests - Store any user data ## Feedback - If useful: `clawhub star authorization` - Stay updated: `clawhub sync`

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 authorization-1776419951 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 authorization-1776419951 技能

通过命令行安装

skillhub install authorization-1776419951

下载 Zip 包

⬇ 下载 Authorization v1.0.0

文件大小: 7.69 KB | 发布时间: 2026-4-17 20:03

v1.0.0 最新 2026-4-17 20:03
Initial release

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部