-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(skilavottord): Disable IdsUserGuard for all environments except prod #16535
Conversation
WalkthroughThe changes in this pull request focus on the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (2)
apps/skilavottord/ws/src/app/modules/auth/auth.guard.ts (2)
79-81
: Enhance logging for better debuggingThe current logging could be more informative by including additional context about the IdsUserGuard status.
logger.info(`AuthGuard environment`, { environment: process.env.NODE_ENV, + message: 'IdsUserGuard disabled for non-production environment', + guardStatus: 'skipped' })
Line range hint
78-86
: Document security implications of disabled IdsUserGuardWhile disabling IdsUserGuard in non-production environments addresses the CPU spike issue, it's important to document this security trade-off.
Consider adding a code comment explaining:
- Why IdsUserGuard is disabled in non-prod
- The security implications
- Reference to ticket TS-930
// IdsUserGuard is causing constant reload on local and DEV in the skilavottord-web // To 'fix' it for now we just skip using it for non production + // Security Note: IdsUserGuard is intentionally disabled in non-prod environments + // due to performance issues (CPU spikes causing pod restarts). + // This is tracked in TS-930. Use caution when testing authentication flows. if (process.env.NODE_ENV !== 'production') {
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
- apps/skilavottord/ws/src/app/modules/auth/auth.guard.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
apps/skilavottord/ws/src/app/modules/auth/auth.guard.ts (1)
Pattern
apps/**/*
: "Confirm that the code adheres to the following:
- NextJS best practices, including file structure, API routes, and static generation methods.
- Efficient state management and server-side rendering techniques.
- Optimal use of TypeScript for component and utility type safety."
🔇 Additional comments (1)
apps/skilavottord/ws/src/app/modules/auth/auth.guard.ts (1)
Line range hint
78-95
: Verify the environment check behavior across all environmentsLet's ensure this change works as expected across all environments.
✅ Verification successful
Based on the extensive search results, I can now provide a final response regarding the environment check behavior verification.
Environment check behavior is correctly implemented and consistent with the codebase patterns
The environment check in the auth guard is following established patterns across the codebase:
The condition
process.env.NODE_ENV !== 'production'
is widely used throughout the codebase for environment-specific behaviorThe guard's environment-specific behavior is consistent with other similar implementations:
- In development: Uses
AuthGuard
andRolesGuard
- In production: Uses
IdsUserGuard
,AuthGuard
, andRolesGuard
The comment explaining the production requirement ("We are getting Invalid User error on PROD if we skip IdsUserGuard") is valid, as
IdsUserGuard
is extensively used across the codebase for user authentication in production environments.The implementation follows the established security patterns in the codebase where additional authentication guards are applied in production environments.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify environment configuration usage across the codebase # Check for other instances of environment checks echo "Checking for other environment checks in the codebase..." rg -A 2 "process\.env\.NODE_ENV|environment\.production" --type ts # Check for IdsUserGuard usage echo "Checking for other IdsUserGuard usage..." rg "IdsUserGuard" --type ts # Look for environment configuration files echo "Checking environment configuration files..." fd -e ts -e js "environment" -x cat {} \;Length of output: 161983
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #16535 +/- ##
=======================================
Coverage 36.77% 36.77%
=======================================
Files 6850 6850
Lines 142015 142015
Branches 40493 40493
=======================================
+ Hits 52224 52225 +1
+ Misses 89791 89790 -1 Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
TS-930 disable for all environments except PROD
Attach a link to issue if relevant
What
The IdsUserGuard seems to be causing loops in the skilavottord-wed on DEV and STAGING but seems to be working OK on PROD
Why
Pods are being restarted because of CPU spikes.
Screenshots / Gifs
Attach Screenshots / Gifs to help reviewers understand the scope of the pull request
Checklist:
Summary by CodeRabbit