-
Notifications
You must be signed in to change notification settings - Fork 212
[SOU-123] Fix GitLab token refresh with redirect_uri parameter #798
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
Conversation
WalkthroughThis pull request fixes GitLab OAuth token refresh failures by refactoring the token refresh request to include a conditionally-added Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This comment has been minimized.
This comment has been minimized.
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
🤖 Fix all issues with AI agents
In `@packages/web/src/ee/features/permissionSyncing/tokenRefresh.ts`:
- Around line 122-143: The GitLab redirect_uri is built via string concatenation
in tokenRefresh.ts (bodyParams and provider) and will produce double slashes if
env.AUTH_URL has a trailing slash; change the assignment so when provider ===
'gitlab' you set bodyParams.redirect_uri by normalizing with the URL constructor
(e.g., construct the callback path against env.AUTH_URL to produce a canonical
URL) instead of string concatenation, ensuring the final redirect_uri exactly
matches the original authorization request format.
🧹 Nitpick comments (1)
docker-compose-niteshift.yml (1)
9-23: Prefer named volumes (or configurable paths) for portability.Line 10 and Line 23 hard-code
/root/...which will fail for non-root users and on macOS/Windows. Named volumes keep local dev friction low and avoid path permissions issues.♻️ Suggested refactor
services: redis: @@ - volumes: - - /root/.niteshift/data/redis:/data + volumes: + - redis_data:/data @@ postgres: @@ - volumes: - - /root/.niteshift/data/postgres:/var/lib/postgresql/data + volumes: + - postgres_data:/var/lib/postgresql/data @@ +volumes: + redis_data: + postgres_data:
…r GitLab token refresh fix Co-authored-by: michael <michael@sourcebot.dev>
Description
Fixes GitLab OAuth token refresh failures caused by missing
redirect_uriparameter. GitLab's OAuth implementation requires theredirect_uriparameter to be included in token refresh requests and must match the original authorization request URI.Changes
Modified
tokenRefresh.ts: Added support for including theredirect_uriparameter in GitLab token refresh requestsAdded
docker-compose-niteshift.yml: Development configuration for local testing with Redis and PostgreSQL servicesTechnical Details
The error
invalid_grantoccurs because GitLab validates that theredirect_uriparameter in the refresh request matches the original authorization request. Previously, this parameter was omitted from the refresh token request, causing validation to fail.The fix:
Related Issues
View Niteshift Task
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.