Repository navigation
Add ONBOARD_ALLOW_REGISTRATION to close self-service sign-up on self-hosted installs - #321
Open
shivanathd wants to merge 1 commit into
Open
shivanathd wants to merge 1 commit into
shivanathd wants to merge 1 commit into
Conversation
…ign-up POST /int/v1/onboard/create-account creates a new organization on every call. should-onboard only hides the console's setup wizard, so a self-hosted install stays open to sign-ups from anyone who can reach it. Add fleetbase.onboard.allow_registration (ONBOARD_ALLOW_REGISTRATION, default true so nothing changes unless an operator opts in). When it is false and an organization already exists, createAccount answers 403 with code registration_disabled, the same shape OAuth uses for OAUTH_ALLOW_REGISTRATION. The first organization can still be created. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
POST /int/v1/onboard/create-account(OnboardController@createAccount) creates a new organization and administrator on every call.GET /int/v1/onboard/should-onboardonly decides whether the console shows the setup wizard. So on a self-hosted install, anyone who can reach the API can create their own organization at any time. There is currently no setting to make an install invite-only.v0.7.73 added
OAUTH_ALLOW_REGISTRATIONfor sign-ups that start from an OAuth provider. This PR adds the matching switch for the regular onboarding endpoint.Change
config/fleetbase.php:onboard.allow_registration, read fromONBOARD_ALLOW_REGISTRATION, defaulttrue. Nothing changes unless an operator sets it, so Cloud behaves as today.OnboardController::createAccount: when the flag isfalseand an organization already exists, return403withcode: registration_disabledbefore anything is created. This is the same message and codeOAuthController::registrationOutcome()uses. The very first organization can still be created, so a fresh install can still be set up.OAuth sign-ups also finish through
createAccount, so with the flag off they are refused too. That seemed the expected meaning of "sign-up closed". Inviting users into an existing organization doesn't use this endpoint and is unaffected.Operators who also gate the route at a reverse proxy should match both
/int/v1/onboard/create-accountand/int/v1/onboard/create-account/(trailing slash). Otherwise the gate can be bypassed. The flag in this PR doesn't depend on that.Tests
OnboardControllerTesthas two new cases:createAccountreturns 403 /registration_disabledand creates no user or company.The shared test config sets the flag to
trueso the setting can't leak between tests.I ran
tests/Unit/Http/OnboardControllerTest.phpon PHP 8.2: 20/20 pass. The refusal case fails onmain, as expected.php-cs-fixer --dry-runis clean on the changed files.This PR was prepared with an AI coding tool (Claude Code) and reviewed by Shiv. Found by Mindcat (mindcat.ai).
Generated by Claude Code