access-control
Skill0 starsChanged 8 months agoMITView on GitHub
Use when writing authorization logic, route guards, or resource access
2 other projects use a version of this.
Adopted by
Most recently taken up by
- emre-guler/websectheir own version, first seen Aug 27, 2026
- iktok90-design/ai-smart-contract-auditortheir own version, first seen Jul 2, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- iktok90-design/ai-smart-contract-auditor★ 36same name
- emre-guler/websec★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository11 other files it gives its agents.
- accessibilitySkill
- accessibility-testingSkill
- api-securitySkill
- authenticationSkill
- dependency-securitySkill
- injection-preventionSkill
- input-validationSkill
- secrets-managementSkill
- security-contextSkill
- security-headersSkill
- xss-csrfSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 5 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Every protected resource must verify that the requesting user has permission.
- Distinctive: line 14
Never trust route parameters alone.
- Distinctive: line 53
Don't rely on route middleware alone.
- Distinctive: line 74
Don't scatter permission checks as ad-hoc if statements.
- Distinctive: line 93
Use UUIDs for public-facing identifiers.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Access Control
Every protected resource must verify that the requesting user has permission. Default to deny.
Related: authentication, api-security, security-context
Rule 1: Verify Resource Ownership
Never trust route parameters alone. Verify the user owns or can access the resource.
// WRONG — anyone can access any user's data
app.get('/users/:id/settings', async (req, res) => {
const settings = await getSettings(req.params.id);
res.json(settings);
});
// RIGHT — verify ownership
app.get('/users/:id/settings', async (req, res) => {
if (req.params.id !== req.user.id && !req.user.isAdmin) {
return res.status(403).json({ error: 'Forbidden' });
}
const settings = await getSettings(req.params.id);
res.json(settings);
});Rule 2: Default to Deny
Protect everything by default. Explicitly mark public routes.
# WRONG — protect individual routes (easy to forget one)
@app.route('/admin')
@login_required
def admin(): ...
# RIGHT — protect everything, whitelist public routes
@app.before_request
def require_auth():
public = ['/login', '/signup', '/health']
if request.path not in public and not current_user.is_authenticated:
return redirect('/login')Rule 3: Check Permissions in Multiple Layers
Don't rely on route middleware alone. Check in the service layer too.
// WRONG — only checked at route level
router.delete('/posts/:id', requireAdmin, deletePost);
// RIGHT — checked at route AND service level
router.delete('/posts/:id', requireAdmin, deletePost);
async function deletePost(postId, requestingUser) {
const post = await getPost(postId);
if (!post) throw new NotFoundError();
if (!requestingUser.isAdmin && post.authorId !== requestingUser.id) {
throw new ForbiddenError();
}
await removePost(postId);
}Rule 4: Use Role-Based or Policy-Based Access
Don't scatter permission checks as ad-hoc if statements. Centralize them.
// WRONG — ad-hoc checks everywhere
if (user.role === 'admin' || user.role === 'editor') { ... }
// RIGHT — centralized policy
const policies = {
'posts:delete': (user, post) => user.isAdmin || post.authorId === user.id,
'users:manage': (user) => user.isAdmin,
};
function authorize(action, user, resource) {
return policies[action]?.(user, resource) ?? false;
}Rule 5: Never Expose Internal IDs Unnecessarily
Use UUIDs for public-facing identifiers. Sequential IDs reveal data volume and are easily enumerated.
// WRONG — sequential IDs in URLs
GET /api/invoices/1042
// RIGHT — UUIDs in URLs
GET /api/invoices/a1b2c3d4-e5f6-7890-abcd-ef1234567890Quick Reference
| Do | Don't |
| Verify ownership on every request | Trust route parameters |
| Default to deny, whitelist public routes | Protect routes individually (easy to miss) |
| Check permissions in routes AND services | Rely on a single middleware layer |
| Centralize permission logic | Scatter if-statements across codebase |
| Use UUIDs for public-facing IDs | Expose sequential database IDs |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

