Skip to content

u/rbarden

In this archive from Jun 2020 to Dec 2025

0
posts
54
comments
0
media
253
score
1 saved before deletion

$request->validated and DTOs are both valid responses to mass-assignment vulnerabilities though. Sure, if you validate a field you don't want updated, for example, it will be included in the query, but, and this is the important part, the user does not have control over arbitrarily setting fields.

Same with DTOs. You're creating objects with explicit properties, no user control. If you're using magic to make a DTO automatically from $request->all or something like that, you're doing it wrong.

0 points

It doesn't really explain, well, anything. Sure I might have some years of experience now, but I have never once a) not used $fillable; or, b) confused other methods like except for validated.

Your blog post should really dive into what the vulnerability is, how it works, etc., as well as how validated solves it, how safe solves it, and how those two methods are different, to be useful.

10 points

static analysis and unit testing are beyond the project

There may be some confusion. You having static analysis and unit test for your framework, does not mean your users have to have it in their projects/uses of the framework. Static analysis and unit tests help you as the developer know that your code works and continues to work as you make changes.

I as a user of your framework would not use it without seeing tests and at least the claim that it meets some static analysis threshold. Without that, how can you be sure, and communicate to others effectively, that it does what it says?

2 points

Also, I'd just like to point out that, as written, they do not do the same thing.

Closure::... passes a closure instance to color.

->color($this->...) passes the return value of getStateColor to color

8 points

And to keep going on that, you don't even need a private property with a getter, you can shorten it down to asymetric visibility.

3 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.