Skip to content

Implemented Authentication using nextauth#1512

Merged
arkid15r merged 31 commits intoOWASP:feature/contributor-hubfrom
Rajgupta36:feat/auth
Jun 5, 2025
Merged

Implemented Authentication using nextauth#1512
arkid15r merged 31 commits intoOWASP:feature/contributor-hubfrom
Rajgupta36:feat/auth

Conversation

@Rajgupta36
Copy link
Contributor

Resolves #1488

Tasks-

  • Implement Nextauth based github Authentication
  • Implemented new app Nest

Media

solbot-.2.mp4

@Rajgupta36 Rajgupta36 requested review from arkid15r and kasya as code owners May 23, 2025 10:19
@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 23, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Summary by CodeRabbit

  • New Features

    • Added GitHub OAuth login and authentication, enabling users to sign in with their GitHub accounts.
    • Introduced a custom user model and admin panel enhancements for user management.
    • Implemented a user menu in the frontend header for sign-in and sign-out actions.
    • Added protected routes with middleware to enforce authentication.
    • Exposed new environment variables for authentication configuration.
  • Bug Fixes

    • None.
  • Tests

    • Added comprehensive unit and end-to-end tests for authentication flows, user model, middleware, and UI components.
  • Chores

    • Updated environment setup, configuration files, and CI/CD workflows to support new authentication features and variables.

Summary by CodeRabbit

  • New Features

    • Added GitHub OAuth2 authentication, allowing users to sign in with their GitHub accounts.
    • Introduced a custom user model supporting GitHub ID and username, with admin interface enhancements for user management.
    • Implemented a new login page and user menu for authentication status and sign-in/sign-out actions.
    • Integrated session management and authentication middleware to protect routes.
    • Enabled GraphQL mutations for user authentication and user data synchronization with the backend.
  • Chores

    • Updated environment variables and dependencies to support authentication features.
    • Refined configuration for testing and coverage tools.
  • Tests

    • Added unit, integration, and end-to-end tests for authentication flows, user model, and middleware.

Walkthrough

This change introduces a complete authentication system integrating GitHub OAuth via NextAuth.js on the frontend and synchronizing authenticated users with a custom Django User model on the backend. It includes backend models, migrations, GraphQL mutations, admin configuration, frontend authentication flows, UI components, middleware enforcement, and comprehensive automated tests.

Changes

Files/Groups Change Summary
backend/apps/nest/models/user.py, .../migrations/0001_initial.py, .../models/init.py Added custom User model with GitHub ID and username, initial migration, and import exposure.
backend/apps/nest/admin.py Added Django admin configuration for the custom User model.
backend/apps/nest/apps.py Added Django AppConfig for the nest app.
backend/apps/nest/graphql/nodes/user.py Added AuthUserNode GraphQL node for the User model.
backend/apps/nest/graphql/mutations/user.py, .../mutations/init.py Added GitHub OAuth authentication mutation and mutation registry.
backend/settings/base.py Registered "apps.nest" and set custom user model in Django settings.
backend/settings/graphql.py Added mutations to the GraphQL schema.
backend/tests/apps/nest/... Added unit tests for User model, GraphQL node, and GitHub authentication mutation.
frontend/.env.example, .../utils/credentials.ts Added required environment variables and their exports for GitHub/NextAuth.
frontend/package.json Added next-auth dependency.
frontend/src/app/api/auth/[...nextauth]/route.ts Implemented NextAuth route with GitHub provider and backend sync via GraphQL mutation.
frontend/src/app/login/page.tsx Added login page with GitHub sign-in using NextAuth and UI feedback.
frontend/src/components/UserMenu.tsx, .../Header.tsx Added user menu for authentication state and integrated it into the header.
frontend/src/middleware.ts Added middleware to enforce authentication on routes.
frontend/src/wrappers/provider.tsx Wrapped providers with SessionProvider for session context.
frontend/src/server/apolloClient.ts Extended no-op Apollo client for mutation support in tests.
frontend/tests/e2e/pages/Login.spec.ts Added Playwright end-to-end tests for login flow.
frontend/tests/unit/pages/Login.test.tsx Added unit tests for the Login page component.
frontend/tests/unit/utils/middleware.test.ts Added unit tests for authentication middleware.
frontend/jest.config.ts, frontend/playwright.config.ts Updated test configs for coverage and build command adjustments.

Assessment against linked issues

Objective Addressed Explanation
Implement GitHub login with NextAuth.js on frontend (#1488)
After GitHub login, NextAuth should send user data to Django endpoint to create or update user (#1488)
No credentials login—just GitHub-based sync (#1488)

Suggested reviewers

  • kasya
  • arkid15r

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 10

🧹 Nitpick comments (6)
backend/apps/nest/admin.py (1)

8-11: Enhance admin interface usability.

The current admin configuration is functional but could be more user-friendly. Consider adding github_id to search fields and including username in the list display for better admin experience.

 class UserAdmin(admin.ModelAdmin):
-    search_fields = ("username",)
-    list_display = ("github_id",)
+    search_fields = ("username", "github_id")
+    list_display = ("username", "github_id", "date_joined", "is_active")
     ordering = ("username",)
backend/apps/nest/graphql/nodes/user.py (1)

9-9: Consider more descriptive docstring.

The docstring could be more specific about the node's purpose in authentication contexts.

-    """GraphQL node for User model."""
+    """GraphQL node for authenticated users, exposing minimal user data."""
frontend/src/components/UserMenu.tsx (1)

17-26: Consider making the OAuth provider configurable.

The sign-in functionality is well-implemented, but the GitHub provider is hardcoded.

Consider making the provider configurable:

-        onClick={() => signIn('github', { callbackUrl: '/', prompt: 'login' })}
+        onClick={() => signIn(undefined, { callbackUrl: '/', prompt: 'login' })}

This allows NextAuth to show all configured providers if multiple are added later.

frontend/src/app/api/auth/[...nextauth]/route.ts (1)

38-43: Improve error handling specificity.

Consider logging the original error for debugging while maintaining user-friendly messages.

        } catch (error) {
+          console.error('GitHub auth error:', error)
          if (error instanceof AppError) {
            throw error
          }
          throw new AppError(500, 'User sync failed')
        }
frontend/src/app/login/page.tsx (1)

32-32: Add spinning animation to the spinner icons.

The FontAwesome spinner icons should include animation classes to provide visual feedback that the system is working.

-        <FontAwesomeIcon icon={faSpinner} height={16} width={16} />
+        <FontAwesomeIcon icon={faSpinner} height={16} width={16} className="animate-spin mr-2" />

Apply the same change to line 40 as well.

Also applies to: 40-40

backend/apps/nest/graphql/mutations/user.py (1)

24-36: Consider adding rate limiting and logging for security.

GitHub API calls should be monitored and rate-limited to prevent abuse. Consider adding logging for authentication events.

import logging

logger = logging.getLogger(__name__)

# In the mutate method, add logging:
logger.info(f"GitHub authentication attempt for user: {github_user.get('login', 'unknown')}")

Also consider implementing rate limiting using Django's cache framework or a third-party solution like django-ratelimit.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9c92bc4 and e8c3e3f.

⛔ Files ignored due to path filters (1)
  • frontend/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (21)
  • backend/apps/nest/admin.py (1 hunks)
  • backend/apps/nest/apps.py (1 hunks)
  • backend/apps/nest/graphql/mutations/__init__.py (1 hunks)
  • backend/apps/nest/graphql/mutations/user.py (1 hunks)
  • backend/apps/nest/graphql/nodes/user.py (1 hunks)
  • backend/apps/nest/migrations/0001_initial.py (1 hunks)
  • backend/apps/nest/migrations/0002_alter_user_groups_alter_user_is_active_and_more.py (1 hunks)
  • backend/apps/nest/models/__init__.py (1 hunks)
  • backend/apps/nest/models/user.py (1 hunks)
  • backend/settings/base.py (1 hunks)
  • backend/settings/graphql.py (1 hunks)
  • frontend/.env.example (1 hunks)
  • frontend/package.json (1 hunks)
  • frontend/src/app/api/auth/[...nextauth]/route.ts (1 hunks)
  • frontend/src/app/login/page.tsx (1 hunks)
  • frontend/src/components/Header.tsx (2 hunks)
  • frontend/src/components/UserMenu.tsx (1 hunks)
  • frontend/src/middleware.ts (1 hunks)
  • frontend/src/server/apolloClient.ts (1 hunks)
  • frontend/src/utils/credentials.ts (1 hunks)
  • frontend/src/wrappers/provider.tsx (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (11)
backend/apps/nest/models/__init__.py (1)
backend/apps/nest/models/user.py (1)
  • User (9-38)
backend/apps/nest/graphql/mutations/__init__.py (1)
backend/apps/nest/graphql/mutations/user.py (1)
  • AuthUserMutation (51-54)
frontend/src/components/Header.tsx (1)
frontend/src/components/UserMenu.tsx (1)
  • UserMenu (7-52)
backend/apps/nest/models/user.py (1)
backend/apps/nest/graphql/nodes/user.py (1)
  • Meta (11-13)
backend/apps/nest/graphql/nodes/user.py (1)
backend/apps/nest/models/user.py (2)
  • User (9-38)
  • Meta (12-18)
backend/apps/nest/graphql/mutations/user.py (3)
backend/apps/nest/graphql/nodes/user.py (1)
  • AuthUserNode (8-13)
backend/apps/nest/models/user.py (1)
  • User (9-38)
backend/settings/graphql.py (1)
  • Mutation (14-15)
backend/apps/nest/migrations/0002_alter_user_groups_alter_user_is_active_and_more.py (1)
backend/apps/nest/migrations/0001_initial.py (1)
  • Migration (8-113)
frontend/src/app/login/page.tsx (1)
frontend/src/app/api/auth/[...nextauth]/route.ts (1)
  • signIn (19-46)
frontend/src/app/api/auth/[...nextauth]/route.ts (3)
frontend/src/utils/credentials.ts (3)
  • GITHUB_CLIENT_ID (9-9)
  • GITHUB_CLIENT_SECRET (10-10)
  • NEXTAUTH_SECRET (11-11)
frontend/src/server/apolloClient.ts (1)
  • apolloClient (37-38)
frontend/src/app/global-error.tsx (1)
  • AppError (53-64)
frontend/src/components/UserMenu.tsx (1)
frontend/src/app/api/auth/[...nextauth]/route.ts (2)
  • session (55-58)
  • signIn (19-46)
backend/apps/nest/migrations/0001_initial.py (1)
backend/apps/nest/migrations/0002_alter_user_groups_alter_user_is_active_and_more.py (1)
  • Migration (6-29)
🪛 GitHub Actions: Run CI/CD
frontend/src/server/apolloClient.ts

[error] 32-32: Unstaged changes detected. The file has a trailing comma added in the mutate function object. Run make check and use git add to address it.

backend/apps/nest/migrations/0002_alter_user_groups_alter_user_is_active_and_more.py

[error] 17-17: Ruff E501: Line too long (256 > 99 characters).


[error] 22-22: Ruff E501: Line too long (190 > 99 characters).


[error] 27-27: Ruff E501: Line too long (180 > 99 characters).

🪛 Ruff (0.11.9)
backend/apps/nest/migrations/0002_alter_user_groups_alter_user_is_active_and_more.py

9-9: Single quotes found but double quotes preferred

Replace single quotes with double quotes

(Q000)


9-9: Single quotes found but double quotes preferred

Replace single quotes with double quotes

(Q000)


10-10: Single quotes found but double quotes preferred

Replace single quotes with double quotes

(Q000)


10-10: Single quotes found but double quotes preferred

Replace single quotes with double quotes

(Q000)


15-15: Single quotes found but double quotes preferred

Replace single quotes with double quotes

(Q000)


16-16: Single quotes found but double quotes preferred

Replace single quotes with double quotes

(Q000)


17-17: Single quotes found but double quotes preferred

Replace single quotes with double quotes

(Q000)


17-17: Line too long (256 > 99)

(E501)


17-17: Single quotes found but double quotes preferred

Replace single quotes with double quotes

(Q000)


17-17: Single quotes found but double quotes preferred

Replace single quotes with double quotes

(Q000)


17-17: Single quotes found but double quotes preferred

Replace single quotes with double quotes

(Q000)


17-17: Single quotes found but double quotes preferred

Replace single quotes with double quotes

(Q000)


20-20: Single quotes found but double quotes preferred

Replace single quotes with double quotes

(Q000)


21-21: Single quotes found but double quotes preferred

Replace single quotes with double quotes

(Q000)


22-22: Single quotes found but double quotes preferred

Replace single quotes with double quotes

(Q000)


22-22: Line too long (190 > 99)

(E501)


22-22: Single quotes found but double quotes preferred

Replace single quotes with double quotes

(Q000)


25-25: Single quotes found but double quotes preferred

Replace single quotes with double quotes

(Q000)


26-26: Single quotes found but double quotes preferred

Replace single quotes with double quotes

(Q000)


27-27: Single quotes found but double quotes preferred

Replace single quotes with double quotes

(Q000)


27-27: Line too long (180 > 99)

(E501)


27-27: Single quotes found but double quotes preferred

Replace single quotes with double quotes

(Q000)

🔇 Additional comments (33)
frontend/src/utils/credentials.ts (2)

9-9: GitHub Client ID configuration looks correct

The GITHUB_CLIENT_ID can safely be exposed to the client-side as it's designed to be public in OAuth flows.


11-11: NextAuth secret configuration is properly secured

Good practice keeping NEXTAUTH_SECRET server-side without the NEXT_PUBLIC_ prefix.

frontend/package.json (1)

55-55:

Details

✅ Verification successful

Verify next-auth version for security and latest recommendations

The version 4.24.11 is from the v4 branch. Please verify this version is secure and consider if upgrading to v5 would be beneficial.


🌐 Web query:

What is the latest stable version of next-auth and are there any security advisories for version 4.24.11?

💡 Result:

As of May 23, 2025, the latest stable version of NextAuth.js is 4.24.11, released approximately five months ago. (npmjs.com)

Regarding security advisories for version 4.24.11, there are two notable vulnerabilities:

  1. CVE-2023-48309: This vulnerability, identified on November 20, 2023, involves potential user impersonation due to improper handling of authentication mechanisms. (versioneye.com)

  2. CVE-2022-31127: Discovered on July 6, 2022, this issue pertains to improper handling of email input, which could lead to security concerns. (versioneye.com)

Both advisories recommend updating to version 4.24.11 to mitigate these vulnerabilities.

It's important to note that NextAuth.js has since released version 5.0.0-beta.28, which may include further security enhancements. (releasealert.dev)

For the most current information on security advisories and updates, it's advisable to consult the official NextAuth.js GitHub repository and security advisories. (github.com)

Citations:


NextAuth.js Version is Up-to-Date

Version 4.24.11 is the latest stable v4 release and includes fixes for CVE-2023-48309 and CVE-2022-31127. NextAuth.js v5 is currently only available as beta (v5.0.0-beta.28). No security advisories affect v4.24.11, so no further changes are required. You can plan a migration to v5 once a stable release is published.

frontend/.env.example (1)

2-2: NextAuth URL configuration appropriate for development

The localhost URL is correct for development environment.

backend/apps/nest/models/__init__.py (1)

1-1: Proper Django model import pattern

This follows the standard Django convention for making models accessible at the package level.

backend/settings/base.py (2)

50-50: Nest app registration looks correct

Adding the nest app to LOCAL_APPS properly registers it with Django.


53-53:

Details

✅ Verification successful

Verify custom user model migration and compatibility

Setting AUTH_USER_MODEL to a custom model is correctly implemented, but this is a significant change that requires careful migration handling.

Please ensure that:

  1. Proper migrations have been created and applied for the custom User model
  2. Any existing user references in the codebase are compatible with the new model
  3. The database migration path from default Django User to custom User is handled properly

🏁 Script executed:

#!/bin/bash
# Description: Verify migrations exist for the custom User model and check for any user model references

echo "=== Checking for nest app migrations ==="
fd "migration" backend/apps/nest/ --type f

echo -e "\n=== Checking for User model references in other apps ==="
rg "User" backend/apps/ -A 2 -B 2 --type py | grep -v "apps/nest"

echo -e "\n=== Checking for AUTH_USER_MODEL references ==="
rg "AUTH_USER_MODEL|get_user_model" backend/ --type py -A 2

Length of output: 49318


Here’s a deeper check on the nest app to confirm migrations and the custom User model:


🏁 Script executed:

#!/bin/bash
echo "=== Checking for migrations directory under nest app ==="
find backend/apps/nest -type d | grep migrations || echo "No migrations directory found"

echo -e "\n=== Listing files under nest/migrations directory ==="
find backend/apps/nest/migrations -type f 2>/dev/null || echo "No migration files"

echo -e "\n=== Checking for custom User model in nest app ==="
rg "class User" backend/apps/nest -A2 -B2

echo -e "\n=== Checking for direct default User import ==="
rg -n "from django\.contrib\.auth\.models import User" backend --type py || echo "No direct default User imports"

Length of output: 1448


Custom User model migration verified

  • Migrations for nest.User exist (0001_initial.py, 0002_alter_user_groups…) under backend/apps/nest/migrations/
  • class User(AbstractUser) is defined in backend/apps/nest/models/user.py
  • No direct imports of the default django.contrib.auth.models.User remain in the codebase

All checks pass—no further action required.

backend/apps/nest/graphql/mutations/__init__.py (1)

3-3: Import statement looks correct.

The import of AuthUserMutation from the user module follows proper Python module structure and integrates well with the GraphQL schema setup.

backend/apps/nest/apps.py (1)

4-5: Standard Django app configuration looks good.

The NestConfig class correctly inherits from AppConfig and sets the app name following Django conventions. This properly integrates the nest app into the Django project.

frontend/src/components/Header.tsx (2)

18-18: Import statement follows proper conventions.

The import of UserMenu component follows the established import pattern used throughout the file.


123-123: UserMenu integration enhances authentication UX.

The UserMenu component is well-positioned in the header alongside other navigation controls. Based on the component implementation, it provides appropriate GitHub authentication functionality with sign-in/sign-out capabilities and user avatar display.

backend/apps/nest/admin.py (1)

1-14: LGTM! Clean admin configuration.

The admin configuration follows Django best practices and properly integrates with the custom User model.

backend/apps/nest/graphql/nodes/user.py (1)

8-13: LGTM! Secure and well-structured GraphQL node.

The implementation correctly limits field exposure to only username, which is appropriate for an authentication node. This follows security best practices by not exposing sensitive user data.

backend/settings/graphql.py (2)

14-18: LGTM! Proper GraphQL schema extension.

The mutation class is correctly defined and the schema is properly updated to include both queries and mutations. This follows graphene best practices.


6-6:

Details

✅ Verification successful

Verify the imported mutation module exists.

Ensure that the AuthUserMutation class is properly implemented in the imported module.


🏁 Script executed:

#!/bin/bash
# Description: Verify that AuthUserMutation exists in the imported module
# Expected: Should find the AuthUserMutation class definition

ast-grep --pattern 'class AuthUserMutation($$$) {
  $$$
}'

Length of output: 60


🏁 Script executed:

#!/bin/bash
# Verify existence of AuthUserMutation in the codebase

echo "🔍 Searching for class AuthUserMutation definitions"
rg -n "class AuthUserMutation" -A 5

echo
echo "🔍 Searching for any AuthUserMutation references"
rg -n "AuthUserMutation" -A 5

echo
echo "📂 Listing Python files under apps/nest/graphql/mutations"
fd -e py apps/nest/graphql/mutations

Length of output: 1825


✅ AuthUserMutation Verified

  • Found class AuthUserMutation(graphene.ObjectType) in backend/apps/nest/graphql/mutations/user.py
  • Confirmed it’s exported in backend/apps/nest/graphql/mutations/__init__.py
  • The import in backend/settings/graphql.py and usage in the schema are correct

No further changes needed.

backend/apps/nest/models/user.py (3)

12-18: LGTM! Well-structured Meta class.

The Meta class configuration is excellent with proper database table naming, ordering, and indexing strategy. The index on username will improve query performance for authentication lookups.


20-24: LGTM! Proper GitHub ID field definition.

The github_id field is correctly configured with appropriate constraints for GitHub authentication integration.


31-38: 🛠️ Refactor suggestion

Improve string representation method.

The current __str__ method could return an empty string if github_id is an empty string (not None). Consider using a more robust fallback logic.

     def __str__(self) -> str:
         """Return a human-readable representation of the user.
 
         Returns:
             str: The github_id or username of the user.
 
         """
-        return self.github_id or self.username
+        return self.github_id if self.github_id else self.username

Or for even better handling:

     def __str__(self) -> str:
         """Return a human-readable representation of the user.
 
         Returns:
             str: The github_id, username, or a fallback identifier.
 
         """
-        return self.github_id or self.username
+        return self.github_id or self.username or f"User {self.pk}"

Likely an incorrect or invalid review comment.

frontend/src/wrappers/provider.tsx (2)

5-5: LGTM! Correct NextAuth integration.

The SessionProvider import is properly added to integrate NextAuth session management.


13-20: Well-structured provider hierarchy.

SessionProvider is correctly positioned as the top-level wrapper, ensuring all child components have access to authentication context. The indentation and structure maintain good readability.

frontend/src/middleware.ts (1)

5-12: Authentication middleware logic is correct.

The middleware properly checks for JWT tokens and redirects unauthenticated users to the login page. The async/await pattern and URL construction are implemented correctly.

frontend/src/components/UserMenu.tsx (2)

10-16: Loading state implementation is correct.

The skeleton placeholder provides good UX during session loading with appropriate styling and dimensions.


28-51: Authenticated user dropdown is well-implemented.

The dropdown menu with user avatar and sign-out functionality follows good UX patterns. Styling includes proper focus states and accessibility features.

frontend/src/app/api/auth/[...nextauth]/route.ts (3)

19-46: Authentication flow with backend sync is well-implemented.

The signIn callback correctly:

  • Validates GitHub provider and access token
  • Makes GraphQL mutation to sync user with backend
  • Includes proper error handling with custom AppError
  • Only processes GitHub authentication

The GraphQL mutation structure matches the backend schema.


48-58: Token and session callbacks are correctly implemented.

The JWT callback preserves the OAuth access token, and the session callback makes it available to the client. This follows NextAuth best practices for token management.


60-64: NextAuth configuration and export are correct.

The secret configuration and handler exports for GET/POST methods follow NextAuth App Router patterns.

frontend/src/app/login/page.tsx (3)

15-27: Good session handling with proper redirect logic.

The useEffect correctly handles already authenticated users by showing a toast and redirecting to home. The dependency array is properly configured.


29-44: 🛠️ Refactor suggestion

Remove redundant authenticated state handling.

The authenticated state check on lines 37-44 is redundant since the useEffect on lines 15-27 already handles this case and redirects the user. This creates unnecessary renders and duplicate UI.

-  if (status === 'authenticated') {
-    return (
-      <div className="flex min-h-[80vh] items-center justify-center">
-        <FontAwesomeIcon icon={faSpinner} height={16} width={16} />
-        <span className="text-lg text-gray-500">Redirecting...</span>
-      </div>
-    )
-  }

Likely an incorrect or invalid review comment.


56-56:

Details

✅ Verification successful

Verify GitHub provider configuration in NextAuth.

Ensure the GitHub provider is properly configured in the NextAuth configuration to handle the signIn('github') call.


🏁 Script executed:

#!/bin/bash
# Description: Verify GitHub provider is configured in NextAuth route
# Expected: Should find GitHub provider configuration

rg -A 10 -B 5 "GitHubProvider\|providers.*github" --type ts

Length of output: 61


🏁 Script executed:

#!/bin/bash
# Re-verify NextAuth GitHub provider configuration across all files

# Search for the correct provider name
rg -A5 -B2 "GithubProvider"

# Locate the NextAuth configuration export
rg -A5 -B2 "export default NextAuth"

Length of output: 66


🏁 Script executed:

#!/bin/bash
# Broader search for NextAuth setup and GitHub provider

# 1. Find any imports from next-auth 
rg "import .*from 'next-auth" --type ts

# 2. Locate any NextAuth(...) invocations
rg "NextAuth\(" --type ts

# 3. Discover dynamic auth route files (Next.js v13 app router)
fd "\[...nextauth\]\.ts" -t f

# 4. If found, inspect those files for a GitHub provider
fd "\[...nextauth\]\.ts" -t f | xargs rg -A5 -B2 "providers *:"

Length of output: 1330


No action needed — GitHub provider is already configured

  • Verified in frontend/src/app/api/auth/[...nextauth]/route.ts:
    import GitHubProvider from 'next-auth/providers/github'
    
    export const authOptions = {
      providers: [
        GitHubProvider({
          clientId: GITHUB_CLIENT_ID!,
          clientSecret: GITHUB_CLIENT_SECRET!,
        }),
      ],
    }
  • The existing setup will correctly handle signIn('github', { callbackUrl: '/' }).
backend/apps/nest/graphql/mutations/user.py (1)

39-48: Good use of database transaction for user creation.

The atomic transaction ensures data consistency when creating or retrieving users. The logic correctly handles both existing and new users.

backend/apps/nest/migrations/0001_initial.py (3)

106-107: Good index strategy for username lookups.

The index on the username field and ordering by username will optimize common queries in the authentication flow and admin interface.


109-111:

Details

✅ Verification successful

Verify UserManager compatibility with custom fields.

Since the model has custom fields (github_id), ensure that Django's default UserManager can handle user creation properly, especially for the GitHub authentication flow.


🏁 Script executed:

#!/bin/bash
# Description: Check if there's a custom manager defined for the User model
# Expected: Should find User model definition and any custom manager

ast-grep --pattern 'class User($$$):
  $$$'

Length of output: 9455


No additional manager needed for custom field
The User model in backend/apps/nest/models/user.py subclasses AbstractUser without overriding USERNAME_FIELD, so Django’s default UserManager will continue to use the username field as expected. Your added github_id is a supplementary unique field and does not interfere with the built-in manager methods.

No changes required.


73-79:

Details

✅ Verification successful

Verify GitHub ID field constraints for authentication flow.

The github_id and username fields are both set as unique, which is correct for GitHub authentication. However, consider the implications of making both fields required since GitHub usernames can change.


🏁 Script executed:

#!/bin/bash
# Description: Check if the User model properly handles GitHub ID uniqueness
# Expected: Should find the User model definition with github_id constraints

rg -A 5 -B 5 "github_id.*unique" --type py

Length of output: 44


I couldn’t locate the github_id field definition in the models—let’s search for it (and username) across the Python sources to verify where they’re declared:


🏁 Script executed:

#!/bin/bash
# Find where github_id and username are defined in the User model
rg -n "github_id" --type py
rg -n "username" --type py

Length of output: 5076


Let’s inspect the User model definition to confirm the unique, null, and blank settings:


🏁 Script executed:

#!/bin/bash
# Show User model and field definitions for github_id and username
rg -n "class User" -C15 backend/apps/nest/models/user.py
rg -n "github_id = models.CharField" -C3 backend/apps/nest/models/user.py
rg -n "username = models.CharField" -C3 backend/apps/nest/models/user.py

Length of output: 1183


No changes needed for GitHub fields
The github_id and username fields in backend/apps/nest/models/user.py are defined as non-nullable, unique CharFields and the login mutation in backend/apps/nest/graphql/mutations/user.py always sets (and updates) username on each login. This ensures that users who change their GitHub usernames are handled correctly—no further adjustments required.

@@ -1,3 +1,5 @@
NEXTAUTH_SECRET=secret
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Improve NextAuth secret placeholder and add production guidance

The placeholder value "secret" is too weak and could lead to security issues if accidentally used in production.

Replace with a stronger placeholder and add guidance:

-NEXTAUTH_SECRET=secret
+NEXTAUTH_SECRET=your-randomly-generated-secret-here-use-openssl-rand-base64-32

Consider adding a comment above explaining how to generate a secure secret:

+# Generate a secure secret with: openssl rand -base64 32
 NEXTAUTH_SECRET=your-randomly-generated-secret-here-use-openssl-rand-base64-32
🤖 Prompt for AI Agents
In frontend/.env.example at line 1, replace the weak placeholder value "secret"
for NEXTAUTH_SECRET with a stronger, more secure placeholder. Add a comment
above this line explaining how to generate a secure secret, such as using a
command or tool, to guide users in creating a safe value for production
environments.

Comment on lines +33 to +36
const noopApolloClient = {
query: async () => ({ data: null }),
mutate: async () => ({ data: null })
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Good addition of mutate method but fix formatting issue.

Adding the mutate method to the no-op Apollo client is essential for testing authentication flows that involve GraphQL mutations. However, there's a formatting issue that needs to be addressed.

The pipeline failure indicates a trailing comma issue. Please run make check and address the formatting:

 const noopApolloClient = {
   query: async () => ({ data: null }),
-  mutate: async () => ({ data: null })
+  mutate: async () => ({ data: null }),
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const noopApolloClient = {
query: async () => ({ data: null }),
mutate: async () => ({ data: null })
}
const noopApolloClient = {
query: async () => ({ data: null }),
mutate: async () => ({ data: null }),
}
🤖 Prompt for AI Agents
In frontend/src/server/apolloClient.ts around lines 33 to 36, the no-op Apollo
client object has a trailing comma after the last method which causes a
formatting error. Remove the trailing comma after the mutate method to fix the
formatting issue and ensure the code passes the linting checks when running
`make check`.

Comment on lines +25 to +29
username = models.CharField(
verbose_name="Username",
max_length=150,
unique=True,
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Potential conflict with AbstractUser's username field.

Redefining the username field that already exists in AbstractUser could cause unexpected behavior or migration issues. Verify if this redefinition is necessary and ensure it doesn't conflict with Django's authentication framework.


🏁 Script executed:

#!/bin/bash
# Description: Check if AbstractUser already defines username field and verify the necessity of redefinition
# Expected: Should find AbstractUser's username field definition

python -c "
from django.contrib.auth.models import AbstractUser
import inspect
print('AbstractUser fields:')
for field in AbstractUser._meta.fields:
    if field.name == 'username':
        print(f'  {field.name}: {field.__class__.__name__}, max_length={getattr(field, \"max_length\", \"N/A\")}, unique={field.unique}')
"

Length of output: 457


🏁 Script executed:

#!/bin/bash
# Install Django to inspect AbstractUser fields
pip install Django

python - << 'EOF'
from django.contrib.auth.models import AbstractUser
for field in AbstractUser._meta.fields:
    if field.name == 'username':
        print(f"{field.name}: {field.__class__.__name__}, max_length={field.max_length}, unique={field.unique}")
EOF

Length of output: 2496


🏁 Script executed:

#!/bin/bash
# Install Django so we can inspect its source
pip install Django

# Locate the Django package directory
DJANGO_DIR=$(python - << 'EOF'
import django, os
print(os.path.dirname(django.__file__))
EOF
)

echo "Django source directory: $DJANGO_DIR"

# Verify AbstractUser defines its own username field
grep -n "class AbstractUser" "$DJANGO_DIR/contrib/auth/models.py"
grep -n "username\s*=" "$DJANGO_DIR/contrib/auth/models.py"

# Inspect the __str__ method in the custom user model
grep -n "def __str__" backend/apps/nest/models/user.py -A 3

Length of output: 1369


🏁 Script executed:

#!/bin/bash
# Display the full __str__ method implementation in the custom User model
grep -n "def __str__" backend/apps/nest/models/user.py -A 15

Length of output: 313


Remove redundant username override and harden __str__

Django’s AbstractUser already defines a username field (see django/contrib/auth/models.py:456). Overriding it here with identical settings can lead to migration conflicts and unexpected behavior. You should either:

  • Remove your custom username declaration and use the inherited field
  • Or, if you intend to authenticate by GitHub ID, set
    USERNAME_FIELD = 'github_id'
    and deprecate username entirely

Additionally, your __str__ currently does:

def __str__(self) -> str:
    return self.github_id or self.username

If github_id is an empty string, this still falls back to username—which itself might be empty. Consider guarding against both:

 def __str__(self) -> str:
-    return self.github_id or self.username
+    return self.github_id or self.username or '<Unnamed User>'

Locations to update:

  • backend/apps/nest/models/user.py:
    • Lines 25–29 – remove or adjust the username = models.CharField(...) override
    • Lines 31–37 – extend __str__ fallback logic
🤖 Prompt for AI Agents
In backend/apps/nest/models/user.py around lines 25 to 29, remove the redundant
override of the username field since AbstractUser already defines it, to avoid
migration conflicts. Then, in lines 31 to 37, update the __str__ method to
safely return github_id if it is non-empty, otherwise fallback to username only
if it is non-empty, and finally return a default string like 'User' if both are
empty or None.

Comment on lines +14 to +17
export const config = {
// required authentication for all defined routes under matcher
matcher: [],
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Configure the matcher to protect specific routes.

The empty matcher array means no routes are currently protected by this middleware. Consider defining the routes that require authentication.

export const config = {
  // required authentication for all defined routes under matcher
-  matcher: [],
+  matcher: [
+    '/dashboard/:path*',
+    '/profile/:path*',
+    '/api/protected/:path*'
+  ],
}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export const config = {
// required authentication for all defined routes under matcher
matcher: [],
}
export const config = {
// required authentication for all defined routes under matcher
matcher: [
'/dashboard/:path*',
'/profile/:path*',
'/api/protected/:path*'
],
}
🤖 Prompt for AI Agents
In frontend/src/middleware.ts around lines 14 to 17, the matcher array is empty,
so no routes are protected by the middleware. Update the matcher array to
include the specific route patterns that require authentication, such as paths
starting with "/dashboard" or "/profile", to ensure those routes are secured by
this middleware.

Comment on lines +31 to +37
<Image
src={session.user?.image || '/default-avatar.png'}
height={40}
width={40}
alt="User avatar"
className="h-10 w-10 cursor-pointer rounded-full object-cover"
/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

❓ Verification inconclusive

Verify default avatar asset exists.

The component references a default avatar at /default-avatar.png. Ensure this asset exists in the public directory to prevent broken images.


🏁 Script executed:

#!/bin/bash
# Check if default avatar exists in public directory
fd -t f "default-avatar.png" frontend/public/

Length of output: 45


🏁 Script executed:

#!/bin/bash
# Search the entire repository for the default-avatar asset (any extension)
fd -t f default-avatar.png .
fd -t f default-avatar.* .

Length of output: 61


Add missing default avatar asset

No occurrences of default-avatar.png were found in the repository. Without this file in the public directory, the <Image> component will render a broken link.

• Ensure frontend/public/default-avatar.png exists (or update the path to an existing asset)
• Double-check frontend/src/components/UserMenu.tsx (lines 31–37) references the correct file name and location

🤖 Prompt for AI Agents
In frontend/src/components/UserMenu.tsx around lines 31 to 37, the default
avatar image referenced as '/default-avatar.png' does not exist in the public
directory, causing broken image links. Add the missing 'default-avatar.png' file
to the 'frontend/public/' directory or update the src path in the Image
component to point to an existing default avatar asset to ensure the image loads
correctly.

Comment on lines +8 to +17
export const authOptions = {
providers: [
GitHubProvider({
clientId: GITHUB_CLIENT_ID!,
clientSecret: GITHUB_CLIENT_SECRET!,
}),
],
session: {
strategy: 'jwt' as const,
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Validate environment variables before use.

The non-null assertion operators could cause runtime errors if environment variables are not set.

export const authOptions = {
  providers: [
    GitHubProvider({
-      clientId: GITHUB_CLIENT_ID!,
-      clientSecret: GITHUB_CLIENT_SECRET!,
+      clientId: GITHUB_CLIENT_ID || (() => { throw new Error('GITHUB_CLIENT_ID is required') })(),
+      clientSecret: GITHUB_CLIENT_SECRET || (() => { throw new Error('GITHUB_CLIENT_SECRET is required') })(),
    }),
  ],

Alternatively, add validation at module load:

+if (!GITHUB_CLIENT_ID || !GITHUB_CLIENT_SECRET) {
+  throw new Error('GitHub OAuth credentials are required')
+}
🤖 Prompt for AI Agents
In frontend/src/app/api/auth/[...nextauth]/route.ts between lines 8 and 17, the
code uses non-null assertions on environment variables GITHUB_CLIENT_ID and
GITHUB_CLIENT_SECRET, which can cause runtime errors if these variables are
undefined. To fix this, add validation logic at module load to check if these
environment variables are set, and throw a clear error or handle the missing
values gracefully before using them in GitHubProvider configuration.

Comment on lines +24 to +38
response = requests.post(
"https://api.github.com/graphql",
json={
"query": """query {
viewer {
id
login
}
}"""
},
headers={"Authorization": f"Bearer {access_token}", "Accept": "application/json"},
timeout=5,
)
response.raise_for_status()
github_user = response.json()["data"]["viewer"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Improve error handling and response validation for GitHub API call.

The current implementation lacks proper error handling and response validation, which could lead to runtime errors or security issues.

+        try:
             response = requests.post(
                 "https://api.github.com/graphql",
                 json={
                     "query": """query {
                 viewer {
                     id
                     login
                 }
                 }"""
                 },
                 headers={"Authorization": f"Bearer {access_token}", "Accept": "application/json"},
                 timeout=5,
             )
             response.raise_for_status()
-            github_user = response.json()["data"]["viewer"]
+            response_data = response.json()
+            
+            # Validate response structure
+            if "data" not in response_data or "viewer" not in response_data["data"]:
+                raise ValueError("Invalid response from GitHub API")
+            
+            github_user = response_data["data"]["viewer"]
+            
+            # Validate required fields
+            if not github_user.get("id") or not github_user.get("login"):
+                raise ValueError("Missing required fields in GitHub response")
+                
+        except requests.RequestException as e:
+            raise graphene.ValidationError(f"Failed to authenticate with GitHub: {str(e)}")
+        except (KeyError, ValueError) as e:
+            raise graphene.ValidationError(f"Invalid GitHub API response: {str(e)}")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
response = requests.post(
"https://api.github.com/graphql",
json={
"query": """query {
viewer {
id
login
}
}"""
},
headers={"Authorization": f"Bearer {access_token}", "Accept": "application/json"},
timeout=5,
)
response.raise_for_status()
github_user = response.json()["data"]["viewer"]
try:
response = requests.post(
"https://api.github.com/graphql",
json={
"query": """query {
viewer {
id
login
}
}"""
},
headers={"Authorization": f"Bearer {access_token}", "Accept": "application/json"},
timeout=5,
)
response.raise_for_status()
response_data = response.json()
# Validate response structure
if "data" not in response_data or "viewer" not in response_data["data"]:
raise ValueError("Invalid response from GitHub API")
github_user = response_data["data"]["viewer"]
# Validate required fields
if not github_user.get("id") or not github_user.get("login"):
raise ValueError("Missing required fields in GitHub response")
except requests.RequestException as e:
raise graphene.ValidationError(f"Failed to authenticate with GitHub: {str(e)}")
except (KeyError, ValueError) as e:
raise graphene.ValidationError(f"Invalid GitHub API response: {str(e)}")
🤖 Prompt for AI Agents
In backend/apps/nest/graphql/mutations/user.py around lines 24 to 38, improve
error handling by wrapping the GitHub API call in a try-except block to catch
request exceptions and HTTP errors. Validate the response JSON structure before
accessing nested keys to avoid runtime errors. Add checks to ensure the "data"
and "viewer" keys exist in the response and handle cases where the API returns
errors or unexpected data gracefully.

migrations.AlterField(
model_name='user',
name='groups',
field=models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.group', verbose_name='groups'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix line length violations flagged by pipeline.

The migration has line length violations that are causing pipeline failures. While this is auto-generated code, the lines need to be reformatted to meet the project's style guidelines.

         migrations.AlterField(
             model_name='user',
             name='groups',
-            field=models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.group', verbose_name='groups'),
+            field=models.ManyToManyField(
+                blank=True,
+                help_text=(
+                    "The groups this user belongs to. A user will get all permissions "
+                    "granted to each of their groups."
+                ),
+                related_name="user_set",
+                related_query_name="user",
+                to="auth.group",
+                verbose_name="groups"
+            ),
         ),
         migrations.AlterField(
             model_name='user',
             name='is_active',
-            field=models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active'),
+            field=models.BooleanField(
+                default=True,
+                help_text=(
+                    "Designates whether this user should be treated as active. "
+                    "Unselect this instead of deleting accounts."
+                ),
+                verbose_name="active"
+            ),
         ),
         migrations.AlterField(
             model_name='user',
             name='is_superuser',
-            field=models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status'),
+            field=models.BooleanField(
+                default=False,
+                help_text=(
+                    "Designates that this user has all permissions without "
+                    "explicitly assigning them."
+                ),
+                verbose_name="superuser status"
+            ),
         ),

Also applies to: 22-22, 27-27

🧰 Tools
🪛 Ruff (0.11.9)

17-17: Single quotes found but double quotes preferred

Replace single quotes with double quotes

(Q000)


17-17: Line too long (256 > 99)

(E501)


17-17: Single quotes found but double quotes preferred

Replace single quotes with double quotes

(Q000)


17-17: Single quotes found but double quotes preferred

Replace single quotes with double quotes

(Q000)


17-17: Single quotes found but double quotes preferred

Replace single quotes with double quotes

(Q000)


17-17: Single quotes found but double quotes preferred

Replace single quotes with double quotes

(Q000)

🪛 GitHub Actions: Run CI/CD

[error] 17-17: Ruff E501: Line too long (256 > 99 characters).

🤖 Prompt for AI Agents
In
backend/apps/nest/migrations/0002_alter_user_groups_alter_user_is_active_and_more.py
at lines 17, 22, and 27, the lines exceed the project's maximum allowed length
causing pipeline failures. To fix this, break these long lines into multiple
shorter lines by splitting arguments or parameters logically, ensuring each line
stays within the length limit and maintains proper indentation for readability
and style compliance.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

♻️ Duplicate comments (1)
frontend/.env.example (1)

3-3: Enforce a strong secret placeholder
The placeholder secret is too weak for production and was previously flagged. Replace it with a strong, random example and include guidance on generating it.

-# Generate a secure secret with: openssl rand -base64 32
-NEXTAUTH_SECRET=secret
+# Generate a secure secret with: openssl rand -base64 32
+NEXTAUTH_SECRET=your-randomly-generated-secret-here-use-openssl-rand-base64-32
🧹 Nitpick comments (3)
frontend/.env.example (2)

1-2: Add guidance for GitHub OAuth credentials
The placeholders your-github-client-id and your-github-client-secret lack context on how to obtain real values. Please add a comment above these lines explaining where to register a GitHub OAuth app and retrieve the client ID and secret (e.g., GitHub Developer Settings).

+# Register a GitHub OAuth App at https://github.com/settings/developers to obtain these values
 GITHUB_CLIENT_ID=your-github-client-id
 GITHUB_CLIENT_SECRET=your-github-client-secret

4-4: Clarify the NextAuth callback URL
NEXTAUTH_URL should reflect the base URL used by NextAuth for callbacks. Add a note that this defaults to http://localhost:3000 in development and must be updated for staging/production environments.

+# Base URL for NextAuth callbacks; update to your deployed domain in non-dev environments
 NEXTAUTH_URL=http://localhost:3000
backend/tests/apps/nest/models/user_test.py (1)

24-36: Consider simplifying the string representation test.

While the current mocking approach works, you could simplify this test by directly testing the actual model instances since the __str__ method logic is straightforward.

-    def test_str_representation(self):
-        mock_user = Mock(spec=User)
-        mock_user.github_id = "gh123"
-        mock_user.username = "testuser"
-
-        with patch.object(User, "__str__", lambda s: s.github_id or s.username):
-            user = User()
-            user.github_id = "gh123"
-            assert str(user) == "gh123"
-
-            user.github_id = None
-            user.username = "testuser"
-            assert str(user) == "testuser"
+    def test_str_representation(self):
+        user = User(github_id="gh123", username="testuser")
+        # Test with github_id present
+        assert str(user) == "gh123"
+        
+        # Test with github_id as None
+        user.github_id = None
+        assert str(user) == "testuser"
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 968cdc2 and 83ea460.

📒 Files selected for processing (11)
  • backend/Makefile (1 hunks)
  • backend/apps/nest/graphql/mutations/__init__.py (1 hunks)
  • backend/apps/nest/graphql/mutations/user.py (1 hunks)
  • backend/apps/nest/migrations/0001_initial.py (1 hunks)
  • backend/settings/base.py (2 hunks)
  • backend/tests/apps/nest/graphql/mutations/user_test.py (1 hunks)
  • backend/tests/apps/nest/graphql/nodes/user_test.py (1 hunks)
  • backend/tests/apps/nest/models/user_test.py (1 hunks)
  • frontend/.env.example (1 hunks)
  • frontend/src/server/apolloClient.ts (1 hunks)
  • frontend/src/utils/credentials.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • backend/apps/nest/graphql/mutations/init.py
  • frontend/src/server/apolloClient.ts
  • frontend/src/utils/credentials.ts
  • backend/apps/nest/graphql/mutations/user.py
🧰 Additional context used
🧬 Code Graph Analysis (1)
backend/tests/apps/nest/graphql/nodes/user_test.py (2)
frontend/src/types/user.ts (1)
  • user (3-18)
backend/apps/nest/graphql/nodes/user.py (1)
  • AuthUserNode (8-13)
🪛 Ruff (0.11.9)
backend/tests/apps/nest/graphql/nodes/user_test.py

5-5: First line should end with a period

Add period

(D400)


5-5: First line should end with a period, question mark, or exclamation point

Add closing punctuation

(D415)

backend/tests/apps/nest/models/user_test.py

13-13: Magic value used in comparison, consider replacing 255 with a constant variable

(PLR2004)


17-17: Magic value used in comparison, consider replacing 150 with a constant variable

(PLR2004)

backend/tests/apps/nest/graphql/mutations/user_test.py

14-14: First line should end with a period

Add period

(D400)


14-14: First line should end with a period, question mark, or exclamation point

Add closing punctuation

(D415)


42-42: First line should end with a period

Add period

(D400)


42-42: First line should end with a period, question mark, or exclamation point

Add closing punctuation

(D415)

backend/apps/nest/migrations/0001_initial.py

34-34: Line too long (117 > 99)

(E501)


62-62: Line too long (138 > 99)

(E501)


84-84: Line too long (134 > 99)

(E501)

🪛 GitHub Actions: Run CI/CD
backend/tests/apps/nest/graphql/nodes/user_test.py

[error] 5-5: Ruff D400: First line should end with a period.


[error] 5-5: Ruff D415: First line should end with a period, question mark, or exclamation point.

backend/tests/apps/nest/models/user_test.py

[error] 13-13: Ruff PLR2004: Magic value used in comparison, consider replacing 255 with a constant variable.


[error] 17-17: Ruff PLR2004: Magic value used in comparison, consider replacing 150 with a constant variable.

backend/tests/apps/nest/graphql/mutations/user_test.py

[error] 14-14: Ruff D400: First line should end with a period.


[error] 14-14: Ruff D415: First line should end with a period, question mark, or exclamation point.


[error] 42-42: Ruff D400: First line should end with a period.


[error] 42-42: Ruff D415: First line should end with a period, question mark, or exclamation point.

backend/apps/nest/migrations/0001_initial.py

[error] 34-34: Ruff E501: Line too long (117 > 99 characters).


[error] 62-62: Ruff E501: Line too long (138 > 99 characters).


[error] 84-84: Ruff E501: Line too long (134 > 99 characters).

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: CodeQL (javascript-typescript)
🔇 Additional comments (11)
backend/tests/apps/nest/graphql/nodes/user_test.py (1)

4-10: LGTM! Well-structured test without database dependency.

The test effectively validates the GraphQL node configuration by checking the model mapping, field exposure, and field type handling. The approach of testing without database connection is appropriate for unit testing the node configuration.

🧰 Tools
🪛 Ruff (0.11.9)

5-5: First line should end with a period

Add period

(D400)


5-5: First line should end with a period, question mark, or exclamation point

Add closing punctuation

(D415)

🪛 GitHub Actions: Run CI/CD

[error] 5-5: Ruff D400: First line should end with a period.


[error] 5-5: Ruff D415: First line should end with a period, question mark, or exclamation point.

backend/settings/base.py (2)

18-18: LGTM! Appropriate environment file for testing.

Changing from .env.example to .env for the Test environment is correct, as tests should use actual environment values rather than example configurations.


48-51: LGTM! Proper Django app integration.

Adding apps.nest to LOCAL_APPS and setting the custom user model follows Django best practices for authentication customization. The AUTH_USER_MODEL setting correctly points to the new custom User model.

backend/Makefile (1)

161-161: LGTM! Enhanced test diagnostics for better debugging.

Adding --full-trace and -s options to pytest improves debugging capabilities by providing complete tracebacks and disabling output capturing. This is particularly valuable for CI/CD environments where test failures need detailed investigation.

backend/tests/apps/nest/models/user_test.py (2)

8-22: LGTM! Comprehensive model field and meta option testing.

The test structure effectively validates the User model's field definitions, constraints, and metadata without requiring database access. This approach provides good coverage of the model's configuration.

🧰 Tools
🪛 Ruff (0.11.9)

13-13: Magic value used in comparison, consider replacing 255 with a constant variable

(PLR2004)


17-17: Magic value used in comparison, consider replacing 150 with a constant variable

(PLR2004)

🪛 GitHub Actions: Run CI/CD

[error] 13-13: Ruff PLR2004: Magic value used in comparison, consider replacing 255 with a constant variable.


[error] 17-17: Ruff PLR2004: Magic value used in comparison, consider replacing 150 with a constant variable.


13-13: ⚠️ Potential issue

Replace magic value with model field inspection.

The hardcoded value 255 should be replaced to avoid maintenance issues if the model field changes.

-        assert User._meta.get_field("github_id").max_length == 255
+        github_id_field = User._meta.get_field("github_id")
+        assert github_id_field.max_length == github_id_field.max_length

Or better yet, if you want to verify a specific constraint:

-        assert User._meta.get_field("github_id").max_length == 255
+        assert User._meta.get_field("github_id").max_length > 0

Likely an incorrect or invalid review comment.

🧰 Tools
🪛 Ruff (0.11.9)

13-13: Magic value used in comparison, consider replacing 255 with a constant variable

(PLR2004)

🪛 GitHub Actions: Run CI/CD

[error] 13-13: Ruff PLR2004: Magic value used in comparison, consider replacing 255 with a constant variable.

backend/apps/nest/migrations/0001_initial.py (2)

73-79: Well-designed GitHub authentication fields.

The custom github_id and username fields are properly configured with unique constraints, which is essential for GitHub OAuth integration. This design prevents duplicate accounts and ensures data integrity.


103-108: Excellent model metadata configuration.

The model options provide good defaults:

  • Proper table naming
  • Username-based ordering for admin interfaces
  • Strategic indexing on the username field for query performance
backend/tests/apps/nest/graphql/mutations/user_test.py (3)

8-10: Well-structured test fixture.

The mock_github_response fixture provides a realistic GitHub API response structure that's reusable across tests.


13-38: Comprehensive test coverage for new user creation.

This test effectively verifies:

  • GitHub API call with proper token
  • User lookup by GitHub ID
  • New user creation with correct parameters
  • Proper return value handling

The mocking strategy isolates the mutation logic well without requiring database interactions.

🧰 Tools
🪛 Ruff (0.11.9)

14-14: First line should end with a period

Add period

(D400)


14-14: First line should end with a period, question mark, or exclamation point

Add closing punctuation

(D415)

🪛 GitHub Actions: Run CI/CD

[error] 14-14: Ruff D400: First line should end with a period.


[error] 14-14: Ruff D415: First line should end with a period, question mark, or exclamation point.


41-63: Thorough test coverage for existing user scenario.

This test ensures that existing users are properly handled without duplicate creation. The assertions correctly verify that create is not called when a user already exists.

🧰 Tools
🪛 Ruff (0.11.9)

42-42: First line should end with a period

Add period

(D400)


42-42: First line should end with a period, question mark, or exclamation point

Add closing punctuation

(D415)

🪛 GitHub Actions: Run CI/CD

[error] 42-42: Ruff D400: First line should end with a period.


[error] 42-42: Ruff D415: First line should end with a period, question mark, or exclamation point.



def test_auth_user_node_configuration():
"""Test node configuration without DB"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix docstring formatting to meet style guidelines.

The docstring lacks proper punctuation as flagged by the linting tools.

-    """Test node configuration without DB"""
+    """Test node configuration without DB."""
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"""Test node configuration without DB"""
"""Test node configuration without DB."""
🧰 Tools
🪛 Ruff (0.11.9)

5-5: First line should end with a period

Add period

(D400)


5-5: First line should end with a period, question mark, or exclamation point

Add closing punctuation

(D415)

🪛 GitHub Actions: Run CI/CD

[error] 5-5: Ruff D400: First line should end with a period.


[error] 5-5: Ruff D415: First line should end with a period, question mark, or exclamation point.

🤖 Prompt for AI Agents
In backend/tests/apps/nest/graphql/nodes/user_test.py at line 5, the docstring
"Test node configuration without DB" lacks proper punctuation. Update the
docstring to include a period at the end to comply with style guidelines.

@Rajgupta36 Rajgupta36 marked this pull request as draft May 23, 2025 16:18
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (2)
frontend/__tests__/unit/utils/middleware.test.ts (1)

26-26: Fix semicolon placement.

The semicolon should be at the end of the statement, not as a separate statement.

-        jest.clearAllMocks()
-            ; (useRouter as jest.Mock).mockReturnValue({ push: pushMock })
+        jest.clearAllMocks()
+        ;(useRouter as jest.Mock).mockReturnValue({ push: pushMock })

Actually, the semicolon appears to be unnecessary here. Consider removing it entirely:

-        jest.clearAllMocks()
-            ; (useRouter as jest.Mock).mockReturnValue({ push: pushMock })
+        jest.clearAllMocks()
+        (useRouter as jest.Mock).mockReturnValue({ push: pushMock })
frontend/__tests__/unit/pages/Login.test.tsx (1)

26-26: Fix semicolon placement issue.

Similar to the middleware test, the semicolon placement is incorrect.

-        jest.clearAllMocks()
-            ; (useRouter as jest.Mock).mockReturnValue({ push: pushMock })
+        jest.clearAllMocks()
+        ;(useRouter as jest.Mock).mockReturnValue({ push: pushMock })

Or better yet, remove the unnecessary semicolon:

-        jest.clearAllMocks()
-            ; (useRouter as jest.Mock).mockReturnValue({ push: pushMock })
+        jest.clearAllMocks()
+        (useRouter as jest.Mock).mockReturnValue({ push: pushMock })
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 83ea460 and 4565b8a.

📒 Files selected for processing (11)
  • backend/apps/nest/migrations/0001_initial.py (1 hunks)
  • backend/settings/base.py (1 hunks)
  • backend/tests/apps/nest/graphql/mutations/user_test.py (1 hunks)
  • backend/tests/apps/nest/graphql/nodes/user_test.py (1 hunks)
  • backend/tests/apps/nest/models/user_test.py (1 hunks)
  • frontend/__tests__/e2e/pages/Login.spec.ts (1 hunks)
  • frontend/__tests__/unit/pages/Login.test.tsx (1 hunks)
  • frontend/__tests__/unit/utils/middleware.test.ts (1 hunks)
  • frontend/jest.config.ts (1 hunks)
  • frontend/playwright.config.ts (1 hunks)
  • frontend/src/app/api/auth/[...nextauth]/route.ts (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • frontend/jest.config.ts
  • frontend/playwright.config.ts
🚧 Files skipped from review as they are similar to previous changes (6)
  • backend/tests/apps/nest/graphql/nodes/user_test.py
  • backend/settings/base.py
  • backend/tests/apps/nest/models/user_test.py
  • frontend/src/app/api/auth/[...nextauth]/route.ts
  • backend/apps/nest/migrations/0001_initial.py
  • backend/tests/apps/nest/graphql/mutations/user_test.py
🧰 Additional context used
🧬 Code Graph Analysis (2)
frontend/__tests__/e2e/pages/Login.spec.ts (1)
frontend/__tests__/e2e/data/mockHomeData.ts (1)
  • mockHomeData (1-286)
frontend/__tests__/unit/utils/middleware.test.ts (1)
frontend/src/middleware.ts (1)
  • middleware (5-12)
🪛 GitHub Actions: Run CI/CD
frontend/__tests__/unit/utils/middleware.test.ts

[warning] 19-19: Unexpected any. Specify a different type (@typescript-eslint/no-explicit-any)

frontend/__tests__/unit/pages/Login.test.tsx

[warning] 4-6: next-auth/react import should occur before import of wrappers/testUtil (import/order), next/navigation import should occur before import of wrappers/testUtil (import/order), @heroui/toast import should occur before import of @testing-library/react (import/order)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: CodeQL (javascript-typescript)
🔇 Additional comments (10)
frontend/__tests__/unit/utils/middleware.test.ts (2)

5-16: Good mock setup for testing middleware behavior.

The mock implementations correctly simulate the behavior of getToken and NextResponse methods, allowing for proper isolation testing of the middleware function.


25-43: Comprehensive test coverage for middleware scenarios.

The test cases effectively cover both authentication scenarios:

  • Redirect to /login when no token is present
  • Allow request to continue when token exists

The assertions properly verify both the function calls and return values.

frontend/__tests__/e2e/pages/Login.spec.ts (4)

5-24: Excellent test setup with comprehensive mocking.

The beforeEach hook properly sets up:

  • GraphQL route mocking with realistic home data
  • CSRF token cookie for security testing
  • Consistent test environment across all scenarios

This ensures isolated and reliable test execution.


26-31: Clear test for unauthenticated user flow.

The test effectively verifies that the GitHub login button is visible when users are not authenticated, using proper role-based selectors for accessibility.


33-51: Well-implemented authentication redirect test.

This test correctly:

  • Simulates an authenticated session by setting the NextAuth session token cookie
  • Verifies automatic redirection to the home page
  • Uses proper cookie configuration matching NextAuth defaults

53-66: Good coverage of loading state with session delay simulation.

The test effectively simulates real-world scenarios where session fetching takes time, verifying that appropriate loading feedback is shown to users.

frontend/__tests__/unit/pages/Login.test.tsx (4)

8-19: Comprehensive mocking setup for component dependencies.

The mock setup properly isolates the component by mocking all external dependencies:

  • NextAuth session management
  • Next.js navigation
  • Toast notifications

This ensures reliable unit testing without external dependencies.


29-34: Good coverage of loading state.

The test properly verifies that the loading state displays appropriate feedback to users while session status is being determined.


36-49: Excellent test for authenticated user flow.

This test comprehensively verifies the authenticated user experience:

  • Shows appropriate redirect spinner
  • Triggers toast notification
  • Navigates to home page

The test structure and assertions are well-designed.


51-66: Complete coverage of unauthenticated user interactions.

These tests effectively verify:

  • Login button visibility for unauthenticated users
  • Proper signIn function call with correct parameters
  • User interaction handling with fireEvent

The test coverage is thorough and well-structured.

Comment on lines +1 to +6
import { screen, fireEvent } from '@testing-library/react'
import { render } from 'wrappers/testUtil'
import LoginPage from 'app/login/page'
import { useSession, signIn } from 'next-auth/react'
import { useRouter } from 'next/navigation'
import { addToast } from '@heroui/toast'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Fix import order according to ESLint rules.

The pipeline indicates import order violations. Reorganize imports to follow the expected order: external libraries, then internal modules.

-import { screen, fireEvent } from '@testing-library/react'
-import { render } from 'wrappers/testUtil'
-import LoginPage from 'app/login/page'
-import { useSession, signIn } from 'next-auth/react'
-import { useRouter } from 'next/navigation'
-import { addToast } from '@heroui/toast'
+import { screen, fireEvent } from '@testing-library/react'
+import { useSession, signIn } from 'next-auth/react'
+import { useRouter } from 'next/navigation'
+import { addToast } from '@heroui/toast'
+import { render } from 'wrappers/testUtil'
+import LoginPage from 'app/login/page'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { screen, fireEvent } from '@testing-library/react'
import { render } from 'wrappers/testUtil'
import LoginPage from 'app/login/page'
import { useSession, signIn } from 'next-auth/react'
import { useRouter } from 'next/navigation'
import { addToast } from '@heroui/toast'
import { screen, fireEvent } from '@testing-library/react'
import { useSession, signIn } from 'next-auth/react'
import { useRouter } from 'next/navigation'
import { addToast } from '@heroui/toast'
import { render } from 'wrappers/testUtil'
import LoginPage from 'app/login/page'
🧰 Tools
🪛 GitHub Actions: Run CI/CD

[warning] 4-6: next-auth/react import should occur before import of wrappers/testUtil (import/order), next/navigation import should occur before import of wrappers/testUtil (import/order), @heroui/toast import should occur before import of @testing-library/react (import/order)

🤖 Prompt for AI Agents
In frontend/__tests__/unit/pages/Login.test.tsx lines 1 to 6, the import
statements are not ordered according to ESLint rules. Reorder the imports so
that external libraries like '@testing-library/react', 'next-auth/react', and
'next/navigation' come first, followed by internal modules such as
'wrappers/testUtil', 'app/login/page', and '@heroui/toast'. This will fix the
import order violations reported by the pipeline.

@github-actions github-actions bot removed the makefile label May 23, 2025
@github-actions github-actions bot added the ci label May 23, 2025
@Rajgupta36 Rajgupta36 marked this pull request as ready for review May 23, 2025 20:41
@github-actions github-actions bot added docker Pull requests that update Docker code nestbot labels Jun 2, 2025
Copy link
Collaborator

@arkid15r arkid15r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works, and it's a huge step forward. Thank you Raj!

Here are some suggestions for making this better:

Comment on lines +1 to +4
GITHUB_CLIENT_ID=your-github-client-id
GITHUB_CLIENT_SECRET=your-github-client-secret
NEXTAUTH_SECRET=secret
NEXTAUTH_URL=http://localhost:3000
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use NEXT_PUBLIC_ and NEXT_SERVER_ prefixes to clearly indicate the user visibility and be consistent with current naming convention.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed all variables except NEXTAUTH_URL . otherwise it throws this warning.
https://next-auth.js.org/warnings#nextauth_url

if existing_user:
auth_user = existing_user
else:
auth_user = User.objects.create(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we should extend the logic here by creating/updating the github.User and linking it to nest.User model?

@Rajgupta36 Rajgupta36 requested a review from arkid15r June 3, 2025 21:44
@github-actions github-actions bot added backend and removed docker Pull requests that update Docker code nestbot labels Jun 4, 2025
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jun 5, 2025

Copy link
Collaborator

@arkid15r arkid15r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good enough to merge into a feature branch.

I added #1555 for tracking related fixes.

Great work @Rajgupta36 !

@arkid15r arkid15r merged commit 2e1d631 into OWASP:feature/contributor-hub Jun 5, 2025
11 of 12 checks passed
@Rajgupta36 Rajgupta36 deleted the feat/auth branch June 8, 2025 12:29
github-merge-queue bot pushed a commit that referenced this pull request Jun 20, 2025
* Implemented Authentication using nextauth (#1512)

* implemented authentication using next-auth

* update code

* type fix

* updated migration

* added backend test cases

* added frontend unit test cases

* added e2e test case

* pre-commit

* fixes e2e test cases

* updated ci/cd

* updated code

* upgraded mutaitons from graphene to strawberry

* updated code

* Update code

* Update tests

* fixes

* fix test

* added relation

* Update code

* Update pnpm-lock.yaml

---------

Co-authored-by: Kate Golovanova <kate@kgthreads.com>
Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com>
Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>

* Run make update

* Bump python from 3.13.3-alpine to 3.13.4-alpine in /backend/docker (#1556)

Bumps python from 3.13.3-alpine to 3.13.4-alpine.

---
updated-dependencies:
- dependency-name: python
  dependency-version: 3.13.4-alpine
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump python from 3.13.3-alpine to 3.13.4-alpine in /schema/docker (#1557)

Bumps python from 3.13.3-alpine to 3.13.4-alpine.

---
updated-dependencies:
- dependency-name: python
  dependency-version: 3.13.4-alpine
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump python from 3.13.3-alpine to 3.13.4-alpine in /docs/docker (#1559)

Bumps python from 3.13.3-alpine to 3.13.4-alpine.

---
updated-dependencies:
- dependency-name: python
  dependency-version: 3.13.4-alpine
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Run make update

* docs: add Next.js to tech stack after migration (#1565)

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

---------

Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com>

* Update event sync process: fix KeyError 'start-date'

* Run make update

* Add test coverage for `csrf.py` (#1564)

* Add test coverage for csrf.py

Signed-off-by: bandhan-majumder <bandhanmajumder16@gmail.com>

* Update code

---------

Signed-off-by: bandhan-majumder <bandhanmajumder16@gmail.com>
Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>

* Update frontend/pnpm-lock.yaml

* Fix Authentication related bugs (#1569)

* handle empty auth credentials

* update test cases

* upgrade code

* update code

* remove check route

* fix test case

* fixes and update usermenu

---------

Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com>

* Merge main

* Migrate frontend checks to local environment

* Update login page route (#1603)

* fix route

* format fix

* introduce flag for auth

* update env

* changed default value

* fix test cases

* fix e2 test cases

* Add dynamic variable for isAuthEnabled

* Clean up

* Clean up and fix tests

* Update code

* Fix code quality issues

---------

Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com>
Co-authored-by: Kate <kate@kgthreads.com>
Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>

* Implement GraphQL resolvers for project health metrics (#1577)

* Add project_health_metrics node and query

* Add health field to the ProjectNode that represents sll ProjectHealthMetrics objects of the project

* Add tests

* Update filtering and add fields to models

* Update filtering

* Update tests

* Save new boolean values

* Add boolean mapping

* Add query tests

* Merge migrations

* Update filtering, add migrations, and update scripts

* Update tests and queries

* Add test with filters

* Update filtering

* Update tests

* Merge migrations

* Revert unnecessary work and apply suggestions

* Remove has_no_recent_commits from project

* Add missing fields for FE query

* Remove project name from the test

* Clean migrations

* Update code

---------

Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>

* Fix test cases and update code (#1635)

* update code

* fix test case

* Update middleware.test.ts

* Update code

* Update code

* Update docker configuration

* Update deps

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: bandhan-majumder <bandhanmajumder16@gmail.com>
Co-authored-by: Raj gupta <raj.gupta369@outlook.com>
Co-authored-by: Kate Golovanova <kate@kgthreads.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: RISHIRAJ MUKHERJEE <136720020+rishyym0927@users.noreply.github.com>
Co-authored-by: Bandhan Majumder <133476557+bandhan-majumder@users.noreply.github.com>
Co-authored-by: Ahmed Gouda <62152210+ahmedxgouda@users.noreply.github.com>
github-merge-queue bot pushed a commit that referenced this pull request Jun 25, 2025
* Implemented Authentication using nextauth (#1512)

* implemented authentication using next-auth

* update code

* type fix

* updated migration

* added backend test cases

* added frontend unit test cases

* added e2e test case

* pre-commit

* fixes e2e test cases

* updated ci/cd

* updated code

* upgraded mutaitons from graphene to strawberry

* updated code

* Update code

* Update tests

* fixes

* fix test

* added relation

* Update code

* Update pnpm-lock.yaml

---------

Co-authored-by: Kate Golovanova <kate@kgthreads.com>
Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com>
Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>

* Run make update

* Bump python from 3.13.3-alpine to 3.13.4-alpine in /backend/docker (#1556)

Bumps python from 3.13.3-alpine to 3.13.4-alpine.

---
updated-dependencies:
- dependency-name: python
  dependency-version: 3.13.4-alpine
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump python from 3.13.3-alpine to 3.13.4-alpine in /schema/docker (#1557)

Bumps python from 3.13.3-alpine to 3.13.4-alpine.

---
updated-dependencies:
- dependency-name: python
  dependency-version: 3.13.4-alpine
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump python from 3.13.3-alpine to 3.13.4-alpine in /docs/docker (#1559)

Bumps python from 3.13.3-alpine to 3.13.4-alpine.

---
updated-dependencies:
- dependency-name: python
  dependency-version: 3.13.4-alpine
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Run make update

* docs: add Next.js to tech stack after migration (#1565)

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

---------

Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com>

* Update event sync process: fix KeyError 'start-date'

* Run make update

* Add test coverage for `csrf.py` (#1564)

* Add test coverage for csrf.py

Signed-off-by: bandhan-majumder <bandhanmajumder16@gmail.com>

* Update code

---------

Signed-off-by: bandhan-majumder <bandhanmajumder16@gmail.com>
Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>

* Update frontend/pnpm-lock.yaml

* Fix Authentication related bugs (#1569)

* handle empty auth credentials

* update test cases

* upgrade code

* update code

* remove check route

* fix test case

* fixes and update usermenu

---------

Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com>

* setup mentorship app

* created mentor model

* created mentee model

* created program model

* created module model and update relations

* updated fields and remove unnecessary migrations

* format fix

* use through model

* cspell update

* format fix

* Merge main

* Migrate frontend checks to local environment

* Update login page route (#1603)

* fix route

* format fix

* introduce flag for auth

* update env

* changed default value

* fix test cases

* fix e2 test cases

* Add dynamic variable for isAuthEnabled

* Clean up

* Clean up and fix tests

* Update code

* Fix code quality issues

---------

Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com>
Co-authored-by: Kate <kate@kgthreads.com>
Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>

* Implement GraphQL resolvers for project health metrics (#1577)

* Add project_health_metrics node and query

* Add health field to the ProjectNode that represents sll ProjectHealthMetrics objects of the project

* Add tests

* Update filtering and add fields to models

* Update filtering

* Update tests

* Save new boolean values

* Add boolean mapping

* Add query tests

* Merge migrations

* Update filtering, add migrations, and update scripts

* Update tests and queries

* Add test with filters

* Update filtering

* Update tests

* Merge migrations

* Revert unnecessary work and apply suggestions

* Remove has_no_recent_commits from project

* Add missing fields for FE query

* Remove project name from the test

* Clean migrations

* Update code

---------

Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>

* update models and add enrollment model

* Fix test cases and update code (#1635)

* update code

* fix test case

* Update middleware.test.ts

* Update code

* Update code

* fixes

* updated suggestion

* fix format

* Update code

* Update code

* Restore lock files

* Reformat migration

* Update code

* Update code

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: bandhan-majumder <bandhanmajumder16@gmail.com>
Co-authored-by: Kate Golovanova <kate@kgthreads.com>
Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com>
Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: RISHIRAJ MUKHERJEE <136720020+rishyym0927@users.noreply.github.com>
Co-authored-by: Bandhan Majumder <133476557+bandhan-majumder@users.noreply.github.com>
Co-authored-by: Ahmed Gouda <62152210+ahmedxgouda@users.noreply.github.com>
@coderabbitai coderabbitai bot mentioned this pull request Aug 12, 2025
7 tasks
@arkid15r arkid15r mentioned this pull request Sep 9, 2025
2 tasks
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.

Implement Authentication

3 participants