fix(prompt-production): harden routes, add forgot-password, cookie & trust pages, and security headers#113
Draft
support371 wants to merge 4 commits into
Draft
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Deployment failed with the following error: Learn More: https://vercel.com/docs/concepts/projects/project-configuration |
Reviewer's GuideThis PR hardens server-side route protection for app, account, community, and admin areas; implements a rate-limited, non-enumerating forgot-password flow; restores dedicated Cookie Policy and Trust Center pages; introduces SEO/crawl artifacts (robots.txt, sitemap.xml, blog redirect); and adds security headers plus a small production-readiness test to enforce key behaviors. Sequence diagram for the new forgot-password flowsequenceDiagram
actor User
participant ForgotPasswordPage
participant ForgotPasswordAPI as POST_api_auth_forgot_password
participant RateLimiter as rateLimit
participant DB as db_user
participant AuditLog as emitAuditLog
User->>ForgotPasswordPage: Submit form (email)
ForgotPasswordPage->>ForgotPasswordAPI: fetch /api/auth/forgot-password
ForgotPasswordAPI->>ForgotPasswordAPI: getRequestContext
ForgotPasswordAPI->>RateLimiter: rateLimit(ipAddress, options)
RateLimiter-->>ForgotPasswordAPI: limit
alt [rate limit exceeded]
ForgotPasswordAPI->>AuditLog: emitAuditLog(action=failed_login)
ForgotPasswordAPI->>ForgotPasswordAPI: rateLimitedResponse
ForgotPasswordAPI-->>ForgotPasswordPage: 429 { retryAfterSeconds }
ForgotPasswordPage-->>User: Show rate-limit message
else [within limit]
ForgotPasswordAPI->>ForgotPasswordAPI: request.json
alt [invalid JSON or schema]
ForgotPasswordAPI-->>ForgotPasswordPage: 400 { error }
ForgotPasswordPage-->>User: Show validation error
else [valid email]
ForgotPasswordAPI->>DB: db.user.findUnique({ email })
DB-->>ForgotPasswordAPI: user | null
ForgotPasswordAPI->>AuditLog: emitAuditLog(action=password_change, metadata.accepted)
ForgotPasswordAPI-->>ForgotPasswordPage: 200 { success, message }
ForgotPasswordPage-->>User: Show generic success message
end
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
gem-enterprise | a0763eb | Jun 26 2026, 11:57 AM |
… consent withdrawal
…xpired states, a11y
…osure, compliance, subprocessors, VDD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Description
src/proxy.tsto enforce server-side routing rules for/community-hub/*,/account/*,/billing/*,/documents/*,/messages/*,/requests/*, and admin groups including/admin,/review, and/compliance/admin.src/app/forgot-password/page.tsxand a rate-limited, Zod-validated API endpointsrc/app/api/auth/forgot-password/route.tsthat logs viaemitAuditLog, performs DB lookup with anti-enumeration behavior, and returns a safe, non-revealing response.src/app/cookie-policy/page.tsxandsrc/app/trust-center/page.tsx, updated footer (src/components/Footer.tsx) and route registry (src/lib/siteRoutes.ts) to surface the new pages, and removed the stale legacy redirect for/trust-center.next.config.js, added a permanent redirect/blog -> /resources, and addedsrc/app/robots.txt/route.tsplussrc/app/sitemap.xml/route.tsto control crawlers and publish canonical public routes.src/__tests__/production-readiness.test.tsasserting presence of cookie/trust pages, middleware protections for Community Hub routes, and the footer Cookie Policy link.Testing
pnpm install --frozen-lockfilecompleted successfully.pnpm run db:generatecompleted successfully (Prisma client generated).pnpm buildcompleted successfully and Next.js compiled and prerendered static pages.pnpm test(Vitest) passed: test suite ran and all tests passed (existing suite plus the newproduction-readinesstest).Codex Task
Summary by Sourcery
Strengthen production security and compliance by tightening protected routes, adding a secure forgot-password flow, publishing trust/legal pages, and configuring security/SEO headers and crawler controls.
New Features:
Enhancements:
Tests: