Uh oh!
There was an error while loading. Please reload this page.
feat(auth): org IP allowlisting — member network restrictions - #5872
feat(auth): org IP allowlisting — member network restrictions#5872waleedlatif1 wants to merge 9 commits into
Conversation
…sign-in, sessions, API keys, realtime
…ntry labels, denial audit events, shared proxy helpers, lazy IP resolution
The latest updates on your projects. Learn more about Vercel for GitHub.
|
waleedlatif1
commented
Jul 23, 2026
waleedlatif1
commented
Jul 23, 2026
@cursor review |
PR SummaryHigh Risk Overview Enforcement is wired through Admins get a new IP access settings section and GET/PUT Reviewed by Cursor Bugbot for commit 88c0b15. Configure here. |
Uh oh!
There was an error while loading. Please reload this page.
Greptile SummaryThis PR adds organization-level IP access restrictions for enterprise members. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (10): Last reviewed commit: "fix(network): resolve IPv6 at /128 for a..." | Re-trigger Greptile |
Greptile SummaryThis PR adds organization-level IP access restrictions across authenticated product surfaces. The main changes are:
Confidence Score: 4/5The realtime enforcement path and mapped-address matching need fixes before merging.
apps/realtime/src/middleware/network-policy.ts; packages/platform-authz/src/network.ts
|
| Filename | Overview |
|---|---|
| apps/realtime/src/middleware/network-policy.ts | Adds realtime policy enforcement, but unresolved proxy chains can fall back to an allowed proxy address and denials are not audited. |
| packages/platform-authz/src/network.ts | Adds shared IP and CIDR matching, with an inconsistency between accepted mapped IPv6 CIDRs and mapped client-address matching. |
| apps/sim/lib/auth/network-policy.ts | Adds cached app-side policy resolution, trusted-IP checks, entitlement gating, and throttled denial auditing. |
| apps/sim/app/api/organizations/[id]/network-policy/route.ts | Adds member reads and enterprise-admin updates with lockout prevention and policy-version invalidation. |
| apps/sim/lib/auth/auth.ts | Adds policy enforcement during session creation and at the central session-read path. |
| apps/sim/lib/auth/hybrid.ts | Adds network-policy enforcement to successful API-key authentication. |
| apps/sim/ee/network-policy/components/network-policy-settings.tsx | Adds the enterprise allowlist editor with validation and save or discard behavior. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Authenticated request] --> B{Authentication path}
B -->|Session or API key| C[App policy enforcement]
B -->|Socket handshake| D[Realtime policy enforcement]
C --> E[Load member organization policy]
D --> E
E --> F[Resolve trusted client IP]
F --> G{Address matches allowlist?}
G -->|Yes| H[Allow access]
G -->|No or unresolved| I[Deny and record audit event]
F -. unresolved socket chain .-> J[Fallback to proxy peer]
J -. proxy may be allowed .-> H
Reviews (1): Last reviewed commit: "polish(network-policy): fix orphaned TSD..." | Re-trigger Greptile
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…pped-CIDR matching, realtime fail-open+audit consistency, drop dead exports
waleedlatif1
commented
Jul 23, 2026
Additional fix in this round from an internal enforcement-coverage audit (not flagged by review, but a real bypass): the public |
waleedlatif1
commented
Jul 23, 2026
waleedlatif1
commented
Jul 23, 2026
@cursor review |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…(covers client session), match realtime break-glass to isTruthy
waleedlatif1
commented
Jul 23, 2026
waleedlatif1
commented
Jul 23, 2026
@cursor review |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…on (app-side primary socket gate)
waleedlatif1
commented
Jul 23, 2026
waleedlatif1
commented
Jul 23, 2026
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 2ca9a67. Configure here.
waleedlatif1
commented
Jul 23, 2026
@greptile review |
Uh oh!
There was an error while loading. Please reload this page.
…extual forms (compressed/expanded/hex) match uniformly
waleedlatif1
commented
Jul 23, 2026
@greptile review |
waleedlatif1
commented
Jul 23, 2026
@cursor review |
Uh oh!
There was an error while loading. Please reload this page.
waleedlatif1
commented
Jul 23, 2026
@greptile review |
waleedlatif1
commented
Jul 23, 2026
@cursor review |
Uh oh!
There was an error while loading. Please reload this page.
waleedlatif1
commented
Jul 23, 2026
@greptile review |
waleedlatif1
commented
Jul 23, 2026
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit a073439. Configure here.
… to /64); document self-host proxy/break-glass/fail-open
waleedlatif1
commented
Jul 23, 2026
Final certainty pass (2 adversarial audits on current HEAD + full re-verification). One real bug found and fixed in 88c0b15 — IPv6 was silently masked to /64 before matching (Better Auth's |
waleedlatif1
commented
Jul 23, 2026
@greptile review |
waleedlatif1
commented
Jul 23, 2026
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 88c0b15. Configure here.
Summary
# labelper entry, up to 200). When enabled, org members can only sign in and use Sim from allowed addresses.getSessionchokepoint so every session-authenticated route and layout re-checks the policy (not just hybrid-auth routes) — a denied member resolves as signed out. Also enforced at session establishment (sign-in hook), the API-key auth path (checkHybridAuth), and the realtime Socket.IO handshake.superRefine). The settings page shows the caller's current IP.AUTH_TRUSTED_PROXIES), access is denied.DISABLE_ORG_IP_ALLOWLISTis the break-glass (read at call time, no restart needed).organization.ip_access.denied, throttled per-member) plus the policy-change event, so security teams see who's blocked and from where.AUTH_TRUSTED_PROXIES; sharedparseTrustedProxies/buildIpResolutionOptionshelpers replace three duplicated parse blocks.organization.network_policy_settingsjson column. ReusessecurityPolicyVersion(from feat(auth): org session policies — lifetime/idle limits, org-wide revocation #5862) so policy changes invalidate cached session cookies org-wide within ~60s.@sim/platform-authz/network(43 tests), shared by the app, the realtime server, and the contract validator (client-bundle-safe — nonode:net).Industry validation
Design cross-checked against 12 platforms' live admin docs (GitHub Enterprise, Datadog, Atlassian, Salesforce, Okta, Google Workspace, Notion, Figma, Slack, Workato, Zapier, Retool). Our core (enterprise-gated, IPv4/IPv6/CIDR, continuous enforcement incl. API keys, product-outward exemptions, hard save-time lockout guard, fail-closed + break-glass) matches or exceeds the mature implementations; Zapier and Retool Cloud don't offer this natively at all. The two gaps every mature impl has — per-entry labels and denial audit events — are both implemented here.
Type of Change
Testing
Checklist