Skip to content
This repository was archived by the owner on Feb 27, 2026. It is now read-only.

[WIP] Fix issue with OIDC Google auto-registration for users#314

Merged
danielalves96 merged 2 commits intonextfrom
copilot/fix-oidc-auto-registration-issue
Oct 21, 2025
Merged

[WIP] Fix issue with OIDC Google auto-registration for users#314
danielalves96 merged 2 commits intonextfrom
copilot/fix-oidc-auto-registration-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 21, 2025

  • Investigate repository structure and understand the authentication flow
  • Identify the root cause: findOrCreateUser method doesn't check autoRegister setting
  • Verify build and lint work correctly
  • Add auto-registration check in the findOrCreateUser method
  • Add appropriate error handling when auto-registration is disabled
  • Build and validate changes
  • Run CodeQL security analysis (0 alerts)
  • Verify the fix handles all scenarios correctly:
    • ✅ Blocks new user creation when autoRegister is disabled
    • ✅ Allows existing users to link OIDC providers
    • ✅ Allows existing linked users to continue logging in

Summary

Fixed the issue where OIDC Google users were being created even with auto-registration disabled.

Changes Made

File: apps/server/src/modules/auth-providers/service.ts

Added a check in the findOrCreateUser method to verify if autoRegister is disabled before creating a new user. When disabled, the system throws an error that is properly handled by the existing error handling in the controller.

Behavior

  • New users with autoRegister disabled: Login is blocked with error message "Registration via [Provider] is disabled. Contact your administrator."
  • Existing users: Can still login and link OIDC providers to their accounts
  • Already linked users: Continue to work normally

Security

  • No security vulnerabilities detected by CodeQL
  • All existing tests pass
  • Type checking and linting pass
Original prompt

This section details on the original issue you should resolve

<issue_title>OIDC Google users are created even with auto-registration disabled</issue_title>
<issue_description>

Hi,
I have configured OIDC Authentication with Google and disabled the auto-registration of new users, but new accounts are still being created when users log in with Google.

Steps to reproduce:

  1. Configure OIDC Authentication with Google.
  2. Disable auto-registration for new users.
  3. Try logging in with a Google account that doesn’t exist in the system.

Expected behavior:
The login should be blocked, and the user should not be created if auto-registration is disabled.

Actual behavior:
A new user is created even though auto-registration is turned off.

Image Image Image Image Image

Comments on the Issue (you are @copilot in this section)

Fixes #276


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Prevent new user creation when autoRegister is disabled for auth providers

Co-authored-by: danielalves96 <62755605+danielalves96@users.noreply.github.com>
@danielalves96
Copy link
Copy Markdown
Contributor

@copilot this error maybe related with linter, check

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Oct 21, 2025

@copilot this error maybe related with linter, check

I've verified all linting and type checking across the entire monorepo. All checks pass successfully:

✅ Server app: pnpm lint and pnpm type-check pass
✅ Web app: pnpm validate passes
✅ Docs app: pnpm validate passes
✅ Build: pnpm build completes successfully

No linter errors found. The code change follows all code quality standards. Commit: 166435f

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • checkpoint.prisma.io

If you need me to access, download, or install something from one of these locations, you can either:

@danielalves96 danielalves96 marked this pull request as ready for review October 21, 2025 14:15
@danielalves96 danielalves96 merged commit 1486765 into next Oct 21, 2025
1 check passed
@danielalves96 danielalves96 deleted the copilot/fix-oidc-auto-registration-issue branch October 21, 2025 17:11
anthony0030 pushed a commit to anthony0030/Palmr that referenced this pull request Jan 13, 2026
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: danielalves96 <62755605+danielalves96@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants