Update index.js#67
Conversation
🔴 MatrixReview — RED⚙️ = code-backed · 🔎 = doc-backed · 💭 = AI suggestion · 📖 = doc citation · 📝 = PR location Risk: 1 files directly affected | 1 entry points modified 🔴 SECURITY — 2 findings (2 doc-backed) · expand 🔽
🔴 ARCHITECTURE — 1 findings (1 code-backed) · expand 🔽
🟢 LEGAL — No issues found 🟡 ONBOARDING — 2 findings (2 doc-backed) · expand 🔽
Powered by MatrixReview · Report incorrect finding |
⚙️ MatrixReview FixGenerating fix... Please allow 2-5 minutes for MatrixReview to analyze the findings, generate a compliant fix, and verify it through the review pipeline. You will receive a follow-up comment with the fix and its verification status. |
⚙️ MatrixReview Fix — PR Intent InvalidMatrixReview evaluated this PR against your team's documentation and determined that the intended change should not be made as proposed. AnalysisThis PR violates multiple critical team requirements and introduces unacceptable security risks. The proxy routing layer is being introduced without authentication middleware (acknowledged by the TODO comment), which directly violates the authentication requirements documented in authentication.md. The PR template indicates the developer hasn't read the contributing guide, has no automated tests despite claiming they exist, and introduces a security vulnerability that could expose API endpoints to unauthenticated access. Additionally, the approach of adding a proxy layer without proper security controls goes against the architecture security requirements outlined in architecture-page-level-auth_security_section.md. What to do insteadThis PR should be closed immediately due to security concerns. The developer should first read the contributing guide, implement proper authentication middleware following the patterns in authentication.md, add comprehensive automated tests, and ensure the proxy layer meets all security requirements before resubmitting. Any proxy routing must include authentication, authorization, rate limiting, and proper error handling before it can be considered for production use. Want to try again? Reply to this comment with additional context and MatrixReview will attempt another fix. Example: Generated by MatrixReview |
⚙️ MatrixReview FixGenerating fix... Please allow 2-5 minutes for MatrixReview to analyze the findings, generate a compliant fix, and verify it through the review pipeline. You will receive a follow-up comment with the fix and its verification status. |
⚙️ MatrixReview Fix — PR Intent InvalidMatrixReview evaluated this PR against your team's documentation and determined that the intended change should not be made as proposed. AnalysisThis PR violates multiple critical team documentation requirements and introduces serious security and architecture violations. The SECURITY.md documentation emphasizes that security is "a top priority" and the review findings identify that the proxy lacks authentication middleware with a TODO comment indicating this is a known gap. The PULL_REQUEST_TEMPLATE_onboarding_section.md shows the developer explicitly checked "I haven't read the contributing guide" which violates basic contribution requirements. Additionally, the PR introduces a fundamental architecture change (proxy routing layer) without proper documentation updates, security controls, or automated tests, despite claiming tests are in place. The "Additional Context from Engineer" claiming this is "only used in dev environments" contradicts the PR description which mentions this is "groundwork for the v2 API migration" suggesting production intent. What to do insteadThis PR should be closed. The developer needs to first read the contributing guide, implement proper authentication middleware per security requirements, add comprehensive automated tests, and follow the proper architecture review process for such a significant infrastructure change. If this is truly dev-only tooling, it should be clearly documented as such and placed in appropriate dev-only directories with explicit safeguards preventing production deployment. Want to try again? Reply to this comment with additional context and MatrixReview will attempt another fix. Example: Generated by MatrixReview |
⚙️ MatrixReview FixGenerating fix... Please allow 2-5 minutes for MatrixReview to analyze the findings, generate a compliant fix, and verify it through the review pipeline. You will receive a follow-up comment with the fix and its verification status. |
⚙️ MatrixReview Fix — Different Approach NeededMatrixReview evaluated this PR and determined that while the goal is valid, the current approach needs to change. AnalysisThe PR's intent to create a proxy routing layer for v1/v2 API migration is technically sound and aligns with the described migration strategy. However, the implementation approach is fundamentally flawed in multiple ways: it lacks essential authentication middleware (which the developer acknowledges but dismisses as "dev only"), has incorrect routing logic that would break v2 endpoints, and introduces security vulnerabilities. The developer's claim that "this script is only used in dev environments" contradicts their own PR description stating this is "groundwork for the v2 API migration" and the TODO comment about needing auth "before it hits prod." Recommended approachImplement this as a proper API gateway with authentication middleware from the start, fix the routing order so v2 routes are matched before the catch-all, and add comprehensive error handling and logging. Consider using an established proxy solution like http-proxy-middleware with proper configuration rather than a basic connect setup. The migration strategy is valid but needs production-ready implementation even in development to avoid security debt. Want to try again? Reply to this comment with additional context and MatrixReview will attempt another fix. Example: Generated by MatrixReview |
⚙️ MatrixReview FixGenerating fix... Please allow 2-5 minutes for MatrixReview to analyze the findings, generate a compliant fix, and verify it through the review pipeline. You will receive a follow-up comment with the fix and its verification status. |
⚙️ MatrixReview FixStatus: ✅ Verified (compliant) The following changes resolve the findings from the review:
|
What does this PR do?
Adds proxy routing layer to split API traffic between v1 and v2 backends. Incoming requests on port 3002 get forwarded to the appropriate service based on path prefix. /v2/* routes hit the new v2 backend on 3004, everything else falls through to v1 on 3003.
This is groundwork for the v2 API migration so we can run both versions in parallel without touching the client.
Fixes calcom#2847
Fixes CAL-1192
Visual Demo (For contributors especially)
Video Demo (if applicable):
N/A - no UI changes
Image Demo (if applicable):
N/A - backend routing only
Mandatory Tasks (DO NOT REMOVE)
I have self-reviewed the code (A decent size PR without self-review might be rejected).
I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox. N/A
I confirm automated tests are in place that prove my fix is effective or that my feature works.
How should this be tested?
Run v1 backend on port 3003 and v2 backend on port 3004
Start the proxy with node proxy.js
Hit http://localhost:3002/some-endpoint and confirm it reaches the v1 service
Hit http://localhost:3002/v2/some-endpoint and confirm it reaches v2
Check that websocket connections still work through the proxy (they probably don't yet, known gap)
No special env vars needed. Just needs both backends running locally.
Checklist
I haven't read the contributing guide
My code doesn't follow the style guidelines of this project
I haven't commented my code, particularly in hard-to-understand areas
I haven't checked if my changes generate no new warnings