Skip to content

Commit

Permalink
dont allow mass filling with table names
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Aug 6, 2020
1 parent 56e6134 commit 260dc0a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
1 change: 1 addition & 0 deletions Eloquent/Concerns/GuardsAttributes.php
Expand Up @@ -152,6 +152,7 @@ public function isFillable($key)
}

return empty($this->getFillable()) &&
strpos($key, '.') === false &&
! Str::startsWith($key, '_');
}

Expand Down
9 changes: 0 additions & 9 deletions Eloquent/Model.php
Expand Up @@ -376,15 +376,6 @@ public function qualifyColumn($column)
*/
protected function removeTableFromKey($key)
{
if (strpos($key, '.') !== false) {
if (! empty($this->getGuarded()) &&
$this->getGuarded() !== ['*']) {
throw new LogicException('Mass assignment of Eloquent attributes including table names is unsafe when guarding attributes.');
}

return last(explode('.', $key));
}

return $key;
}

Expand Down

0 comments on commit 260dc0a

Please sign in to comment.