netlify-access-control-two-layer-pattern

netlify-access-control-two-layer-pattern is a cursor rule for Cursor from netlify/context-and-tools. It costs 1,237 tokens per session, scanned A, original, MIT.

A reference pattern for protecting a Netlify-hosted app at two levels: limiting access to company employees and identifying each signed-in user. Netlify is a service for deploying websites and web apps.

In plain words
What is it for?
Use it when choosing how an internal Netlify app should handle employee access, per-user data, roles, invitations, and redirects.
Why use it?
It separates company-wide access control from user identity, helping avoid unnecessary double logins and unclear authentication designs.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Good fit Use it when choosing how an internal Netlify app should handle employee access, per-user data, roles, invitations, and redirects.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/netlify/context-and-tools/netlify-access-control-two-layer-pattern
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/netlify/context-and-tools

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for netlify-access-control-two-layer-pattern

README.md
[![agentmods](https://agentmods.dev/badge/rules/netlify/context-and-tools/netlify-access-control-two-layer-pattern/github.svg)](https://agentmods.dev/rules/netlify/context-and-tools/netlify-access-control-two-layer-pattern)
Your own site
<a href="https://agentmods.dev/rules/netlify/context-and-tools/netlify-access-control-two-layer-pattern"><img src="https://agentmods.dev/badge/rules/netlify/context-and-tools/netlify-access-control-two-layer-pattern/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for netlify-access-control-two-layer-pattern

Your own site · 80×15
<a href="https://agentmods.dev/rules/netlify/context-and-tools/netlify-access-control-two-layer-pattern"><img src="https://agentmods.dev/badge/rules/netlify/context-and-tools/netlify-access-control-two-layer-pattern.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,237 This file is loaded in full into every session.
When invoked 1,237 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.01237 $0.01237
Opus 5.5 $0.00495 $0.00495
Sonnet 5.5 $0.00247 $0.00247
Haiku 4.5 $0.00124 $0.00124

Measured 1mo ago against content hash d599cb678694, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

netlify-access-control-two-layer-pattern scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

cursor/rules/netlify-access-control-two-layer-pattern.mdc · 74 lines

How it starts

The opening of the file, as written. The whole thing — 74 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Two-Layer Pattern: Company-Only Access + Per-User Identity

A common enterprise ask conflates two concerns:

  1. Perimeter — the deployed app should be reachable only by company employees.
  2. In-app identity — the app should tell users apart (per-user data, roles).

These are different layers (see the main skill). Below are the four ways to satisfy them on Netlify, ordered from least to most friction, plus why the naive "stack both" approach forces a double login.

Option A — Invite-only Netlify Identity (best default for "just my team")

Enable Netlify Identity in invite-only registration mode and invite only company addresses. Identity becomes the perimeter and the in-app identity: no uninvited user can sign in, and every signed-in user is a real Identity user with nf_jwt and roles.

  • Plans: all (free).
  • Logins: one.
  • Per-user identity: full (roles via app_metadata, role-based redirects via nf_jwt).
  • Tradeoffs: manual invite management; no automatic provisioning from a corporate directory; relies on invite links not being shared. Great for internal tools and small teams; doesn't scale cleanly to thousands of employees.

Option B — Auth0 extension (best for a real org with an existing IdP)

Use the Netlify Auth0 extension instead of (or alongside) Identity. Configure Auth0 to federate with the company's IdP (Okta, Entra, Google Workspace, etc.). Auth0 enforces "company-only" via its connection/organization settings and supplies per-user identity — in a single sign-in.

  • Plans: Auth0 extension (enterprise-oriented); more setup than Identity.
  • Logins: one (federated SSO).
  • Per-user identity: full, from the corporate directory; supports auto-provisioning.
  • Tradeoffs: more moving parts than Identity; requires Auth0 configuration. This is the path when invite-only Identity won't scale. Configured via the Netlify Auth0 extension — see the Netlify docs setup guide for Auth0.

Option C — Basic Password Protection + Netlify Identity

Read the full file on GitHub · 74 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 74 lines · 1,237 tokens per session scan A d599cb678694

Subscribe to this mod's changes

netlify-access-control-two-layer-pattern is a cursor rule published in the GitHub repository netlify/context-and-tools (41 stars, last pushed 2d ago), licensed MIT. It adds 1,237 tokens to every session, about $0.0049 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.