Skip to content

Anirudh/hot fix - #79

Merged
AnirudhAP2k merged 37 commits into
masterfrom
anirudh/hot_fix
Jul 27, 2026
Merged

Anirudh/hot fix#79
AnirudhAP2k merged 37 commits into
masterfrom
anirudh/hot_fix

Conversation

@AnirudhAP2k

@AnirudhAP2k AnirudhAP2k commented Jul 27, 2026

Copy link
Copy Markdown
Owner

User description

Description


PR Type

Bug fix, Enhancement, Security, Tests, Configuration changes


Description

  • Enforce server session identity across event pitches to prevent IDOR vulnerabilities.
    • Implement fixed-window rate limiting for login, registration, and password reset endpoints.
    • Secure microservice and API routes with proper organization membership and permission checks.
    • Fix AI service tenant API key hashing using SHA-256 constant-time comparison.

Diagram Walkthrough

flowchart LR
 Client -- "HTTP / WS Requests" --> NextJS["Next.js App / BFF"]
 NextJS -- "Session Auth / Rate Limit" --> SecurityLayer["Security Middleware & Rate Limiter"]
 SecurityLayer -- "Validated Actions" --> DomainLayer["Domain Domain Actions"]
 DomainLayer -- "Prisma / DB" --> PostgreSQL[(PostgreSQL DB)]
 DomainLayer -- "Secure JWT / Master Key" --> Microservices["Microservices (AI / WS / LiveKit)"]
Loading

File Walkthrough

Relevant files
Enhancement
6 files
PitchDetailView.tsx
Add interactive event pitch detail and editing view component
+482/-0 
page.tsx
Add organization pitches listing page with role-based review views
+150/-0 
rate-limit.ts
Implement lightweight fixed-window rate limiter and IP resolver
+80/-0   
BrainstormChat.tsx
Add navigation link to user pitches from brainstorm chat 
+8/-1     
page.tsx
Add view my pitches link to AI event brainstorming header
+8/-1     
page.tsx
Add server-rendered organization pitch detail page route 
+56/-0   
Tests
3 files
pitches-actions.test.ts
Add comprehensive unit tests for pitch server actions       
+332/-0 
events-actions.test.ts
Add unit tests for event creation membership and verification checks
+179/-0 
rate-limit.test.ts
Add unit tests for the fixed-window rate limiter                 
+102/-0 
Bug fix
16 files
actions.ts
Enforce server session identity in pitch server actions   
+31/-11 
virtual-event.ts
Add database-backed authorization check for virtual room presence
+51/-6   
PitchBriefModal.tsx
Remove client-supplied user ID from pitch creation modal payload
+4/-7     
AdminPitchReview.tsx
Remove admin user ID parameter from pitch review action calls
+6/-6     
upload.actions.ts
Add server session authentication check to file upload action
+14/-2   
rooms.ts
Restrict virtual room listing to event participants and organization
hosts
+28/-1   
route.ts
Enforce rate limiting on login endpoint against brute-force attacks
+13/-0   
route.ts
Add organization membership permission check to brainstorm message
route
+7/-0     
route.ts
Add organization membership permission check to brainstorm brief route
+7/-0     
route.ts
Enforce organization ID matching on member updates and removals
+10/-0   
route.ts
Sanitize returnTo parameter to prevent open redirect vulnerabilities
+17/-1   
route.ts
Restrict KYB document fetching to organization owner and admin roles
+9/-0     
actions.ts
Require organization owner or admin role for event creation
+14/-0   
route.ts
Enforce rate limiting on password reset endpoint                 
+13/-0   
route.ts
Enforce rate limiting on registration endpoint                     
+13/-0   
auth.py
Switch tenant API key verification to SHA-256 constant-time comparison
+9/-5     
Configuration changes
4 files
next.config.ts
Add import-in-the-middle to transpilePackages configuration
+1/-0     
config.py
Add container origin host to CORS allowed origins               
+1/-1     
entrypoint.sh
Enable pgvector extension and indexes during startup         
+3/-0     
compose.yaml
Update service network environment URLs in production compose setup
+8/-1     
Documentation
2 files
code_review_2026_07_22.md
Add comprehensive platform code review report and audit follow-up
+260/-0 
code-review-expert.md
Update code review expert prompt rules and checklist context
+160/-2 
Dependencies
1 files
package.json
Add pnpm overrides for import-in-the-middle package version
+7/-4     
Additional files
4 files
requirements.txt +0/-2     
compose.dev.yaml +14/-1   
types.ts +0/-1     
validation.ts +0/-1     

@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown

PR Reviewer Guide 🔍

(Review updated until commit 3f418c0)

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Security Design Flaw

The login rate limiter is keyed by both IP and email combined (login:${ip}:${email}). This allows an attacker to perform credential stuffing by testing many different email addresses from a single IP (since each email gets its own quota of 10 attempts), or targeted brute-force on a single email by rotating IPs. Consider implementing separate rate limits: one per IP (to prevent credential stuffing) and one per email (to prevent targeted brute-force).

const limit = rateLimit(`login:${getClientIp(req)}:${email.toLowerCase()}`, {
    limit: 10,
    windowMs: 15 * 60 * 1000,
});
if (!limit.success) {
    return NextResponse.json(
        { error: "Too many login attempts. Please try again later." },
        { status: 429, headers: { "Retry-After": String(limit.retryAfter) } }
    );
}

@github-actions

Copy link
Copy Markdown

PR Code Suggestions ✨

No code suggestions found for the PR.

@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit 3f418c0

@AnirudhAP2k
AnirudhAP2k merged commit 36060aa into master Jul 27, 2026
6 of 10 checks passed
@AnirudhAP2k
AnirudhAP2k deleted the anirudh/hot_fix branch July 27, 2026 15:17
@AnirudhAP2k
AnirudhAP2k restored the anirudh/hot_fix branch July 27, 2026 15:18
@AnirudhAP2k

Copy link
Copy Markdown
Owner Author

🎉 This PR is included in version 1.24.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant