docs: clarify User model + AUTH_MODEL behaviour#1
Open
Ynitial wants to merge 1 commit into
Open
Conversation
Two related fixes to README.md: 1. Add an Authentication section explaining that Backstage's User model is loaded by default via the AUTH_MODEL env var (set by the installer post-install). Most projects don't need to create app/Models/User.php at all. 2. Warn against re-introducing `protected $guarded = [];` when extending Backstage\Models\User from a project-side User class. The parent declares an explicit $fillable whitelist; an empty $guarded would override it and turn a future User::create($request->all()) into a privilege-escalation footgun. 3. (Drive-by) fixed the inverted markdown link in the intro - `[url](text)` was swapped, displayed the URL as link text and the word "Backstage" as the destination. Context: noticed during a pre-launch security audit on a downstream project where extending the parent User class without dropping the default Laravel-skeleton `$guarded = []` re-opened mass-assignment. The behaviour is correct in stage as-is - this PR just documents how to extend without breaking it.
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.
Summary
Two README fixes:
Add an Authentication section explaining that Backstage's
Usermodel is loaded by default via theAUTH_MODELenv var (which the installer sets post-install). Most projects don't need to createapp/Models/User.phpat all.Warn against re-introducing
protected \$guarded = [];when extendingBackstage\Models\Userfrom a project-sideUserclass. The parent declares an explicit\$fillablewhitelist; an empty\$guardedwould override it and turn a futureUser::create(\$request->all())into a privilege-escalation footgun.Drive-by: fix the inverted markdown link in the intro (
[url](text)was swapped — the URL was rendering as link text and the word "Backstage" was the destination).Why
Noticed during a pre-launch security audit on a downstream Backstage project. The project had its own
app/Models/User.phpextendingBackstage\Models\Userand a leftoverprotected \$guarded = [];from Laravel's default skeleton — together those re-opened mass assignment on the User row.Stage's design is correct as-is: it ships no
app/Models/User.phpand the installer wires upAUTH_MODELso Backstage's User is used directly. This PR just makes that explicit in the README so future projects don't silently hand-roll their own User class out of habit and re-introduce the same hole.Test plan
🤖 Generated with Claude Code