fix(security): harden public auth rate limits - #6997
Conversation
️✅ There are no secrets present in this pull request anymore.If these secrets were true positive and are still valid, we highly recommend you to revoke them. 🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryHigh Risk Overview Client IPs are now resolved by walking the forwarded chain right-to-left and skipping only New chat and file share passwords must be at least 15 characters; login still accepts legacy short secrets. Audit logs and webhook IP allow-lists use the same resolver (no Reviewed by Cursor Bugbot for commit 2fd9f2c. Bugbot is set up for automated code reviews on this repo. Configure here. |
4906c7e to
5bf1838
Compare
|
@cursor review |
5bf1838 to
40d573d
Compare
|
@cursor review |
Greptile SummaryThe PR hardens public authentication and abuse controls by resolving client addresses through trusted proxy chains, failing closed where no independent throttle exists, and adding resource-level limits alongside client-level limits.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/core/utils/request.ts | Centralizes trusted forwarding-chain resolution and returns null when a safe client identity cannot be established. |
| packages/security/src/ip.ts | Implements and tests trusted-proxy-aware client-IP resolution for forwarded address chains. |
| apps/sim/lib/core/rate-limiter/route-helpers.ts | Separates fail-closed IP limiting from explicit deferral to an independently enforced backstop. |
| apps/sim/lib/core/security/deployment-auth.ts | Adds resource-wide throttling to public password authentication while retaining client-level limits. |
| apps/sim/app/api/chat/[identifier]/otp/route.ts | Adds fail-closed chat-resource and recipient limits around public OTP delivery. |
| apps/sim/app/api/files/public/[token]/otp/route.ts | Adds fail-closed share-resource and recipient limits around public file OTP delivery. |
| apps/sim/lib/api/contracts/chats.ts | Requires stronger newly configured chat passwords while preserving the legacy login contract. |
| apps/sim/lib/api/contracts/public-shares.ts | Applies the stronger password requirement to newly created or updated public file shares. |
Sequence Diagram
sequenceDiagram
participant Client
participant Resolver as Trusted IP Resolver
participant ClientLimit as Client-IP Limit
participant ResourceLimit as Resource/Recipient Limit
participant Auth as Public Auth Handler
Client->>Resolver: Public authentication request
alt Trusted client IP resolved
Resolver->>ClientLimit: Consume client budget
ClientLimit-->>Resolver: Allowed
else Client IP unresolved
Resolver->>Resolver: Fail closed unless independent backstop exists
end
Resolver->>ResourceLimit: Consume shared resource/recipient budget
ResourceLimit-->>Auth: Allowed
Auth-->>Client: Authentication response
Reviews (5): Last reviewed commit: "fix(security): preserve independent rate..." | Re-trigger Greptile
|
@cursor review |
|
@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 2fd9f2c. Configure here.
Summary
Type of Change
Testing
bun run lintbun run apps/sim/scripts/check-block-registry.ts origin/stagingbun run check:auditsChecklist